w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Error when trying to run a minitest unit test
Run your test using bundle exec ruby test/test_foo.rb to make sure you use your bundled gems (in this case minitest). Just running ruby test/test_foo.rb will use your globally installed Rubygems. If you want to dig around a little more, try looking in /home/emile/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/minitest/autorun.rb, around line 15.

Categories : Ruby

Yii: Fixtures And Setup() In Unit Test
Fixtures are loaded in CDbTestCase in the setUp() method. So if you want to override this method you should call the parent first: public function setUp() { parent::setUp(); // use fixtures here } As for your second question: No, you have to create a separate fixture file for every table. The fixture system can't manage related records.

Categories : PHP

py.test and fixtures - how to choose only one variant of params
Firstly I'd like to point out this is actually a fairly odd case. Are you really sure the tests are not meaningful at all for the combinations you want to skip? Having said that the way I have solved this myself is to simply use if snmtp_server == 'other-provider.com' and message == 'html': pytest.skip('impossible combination') inside the test function. It's rudimentary but works good enough for this unusual and rare case.

Categories : Python

How can I load fixtures from functional test in Symfony 2
You can load the fixtures in your test's setUp() method as you can see in this question. You can use the code in the question but need to append --appendto the doctrine:fixtures:load command in order to avoid the confirmation by the fixtures-bundle. The better solution is to have a look at the LiipFunctionalTestBundle which makes using data-fixtures easier.

Categories : Symfony2

minitest-spec-rails went wrong when I make some functional test
Rails expects controller names to be plural, like so: PublishersController Your test is using a singular controller name, PublisherController, which doesn't exist. This can be caused by a typo when using generators. To fix it, change Publisher to Publishers. Remember to change the filename as well.

Categories : Ruby On Rails

Django 1.3 testing without recreating database / loading fixtures for every run of the test
I was able to do this by hacking into some django code. The parts that need to be edited is, FILE: django/db/backends/sqlite3/creation.py change the code as follows: setting confirm = 'yes' in line 55 commenting out all occurrences of os.remove(test_database_name) FILE: django/db/backends/creation.py change the code as follows comment 359 to 376 (the syncdb & flush part in create_test_db function. almost everything in _create_test_db. (almost everything == code part which does the undesired stuff which we are trying to eliminate) almost everything in _destroy_test_db. almost everything in destroy_test_db. Hope that helps!

Categories : Django

Grails Fixtures + Build-Test-Data tries to create duplicate IDs for objects
The exact test case works flawless for me. I have latest version of fixture and build test data plugin and am using Grails 2.2.2. //Domain classes: class User { String username Company company } class Company { String name } Build test data never stank for me. My approach to a problem seldom does. :-)

Categories : Hibernate

InnoDB table errors: Doesn't exist/exist. Orphaned tables? Invisible database in mysql command clients
Ok nevermind. I finally fixed it. After adding the lines [mysqld] innodb_file_per_table to my.cnf, I dropped the whole database. Of course I dumped it earlier and recreated + restored the database. No problems here.

Categories : Mysql

Logic Error Cleaning up Empty Tables
I'm not 100% sure I understand your exact requirement to hide a table. I am going under the assumption that an "empty" table has only 1 row in it with header info. Any other rows would have content, making that table non-empty. I decided to leverage this and check for the number of non-header rows: $('table.grid').each(function (i) { //Select all rows in this table that aren't .header var rows = $(this).find("tr").not(".header"); if (rows.length == 0) { //no rows except for header - hide the table. $(this).hide(); } }); You can see this in a fiddle here, using the HTML you provided. It's hiding the second table because it has no rows beyond the headers. Just a note... if you control the server side of this application, your absolute best strateg

Categories : Javascript

Select data from one table and insert into another existing table, which doesn't exist in the table
I think you are looking for this INSERT INTO table4( id1, id3) SELECT id1, id3 FROM table2 INNER JOIN table1 ON table1.id2 = table2.id2 Left JOIN table3 ON table2.name2 = table3.name3 WHERE name2 LIKE 'input' and table3.name3 is null or something similar. Left (outer join) gets all the records in table2 whether they exist or not. If they don't table3.name3 will be null, so those are the chaps you want.

Categories : Mysql

SQL BETWEEN return empty rows even if value exist
If you are getting results by separately running different where clauses doesn't guarantee that AND 2 where clauses will return an answer. There has to be intersection of rows to get result while AND. You should validate your data and see if overlapping exists.

Categories : SQL

Create an empty file in a directory which may or may not exist
mkdir -p /data/app/log/ > /data/app/log/app.log.pos If you need to use sudo, you should sudo the entire script. It's a good practice to avoid putting sudo calls into scripts. Instead, the person who invokes the script is the one who should call sudo. But if you really want to do sudo in the script, do something like: mkdir -p /data/app/log/ sudo rm /data/app/log/app.log.pos # optional sudo touch /data/app/log/app.log.pos

Categories : Bash

check whether the empty string exist in an input field
you should be checking for $(inputBar).val() not just $(inputBar) that will just return the object itself not the value of the text in the input box

Categories : Jquery

How to test a controller action that does not exist?
Here is what I came up with: context "as any user" do describe "not routable actions" do it "rejects routing for :new" do expect(get: "/products/new").not_to be_routable end it "rejects routing for :create" do expect(post: "/products").not_to be_routable end it "rejects routing for :edit" do expect(get: "/products/#{@product.id}/edit").not_to be_routable end it "rejects routing for :update" do expect(put: "/products/#{@product.id}").not_to be_routable end it "rejects routing for :destroy" do expect(delete: "/products/#{@product.id}").not_to be_routable end end end However one test fails: Failure/Error: expect(get: "/products/new").not_to be_routable expected {:get=>"/products/new"} not to be routable, but

Categories : Ruby On Rails

Test if a cookie exist with it name in a variable
Assuming you're using Wordpress, the_ID(): Displays the numeric ID of the current post. This tag must be within The Loop. the_ID() is a template function and it will just print the ID, it doesn't return it. To return the ID, use get_the_ID() instead. <?php $quesID = get_the_ID()."GCQuestion"; if(isset($_COOKIE[$quesID])){ ... }

Categories : PHP

PHP inserting empty row in mysql table when file upload is empty
If I recall correctly, the file upload field will create an entry in $_FILES whether it is empty or not. With that being the case, you're best to check either that $_FILES['fileupload']['size'][$key] is greater than zero OR that $_FILES['fileupload']['name'][$key] is not empty. That should give you an answer for each file upload you have on your form (even if you have many.)

Categories : PHP

postgresql query to select rows in a table that don't exist in a link to another table
You can use a simple LEFT JOIN and check that the resulting user_contact part does not exist (ie. IS NULL); SELECT c.* FROM contact c LEFT JOIN user_contact uc ON c.id = uc.contact_id AND uc.user_id='456' WHERE c.customer_id = '123' AND uc.contact_id IS NULL An SQLfiddle to test with.

Categories : SQL

ruby on rails - test if array exist
What you probably want is: <% if t.has_key?('message') %> But in most cases, the following will do equally as well: <% if t['message'] %>

Categories : Arrays

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'customgrid_grid_role' doesn't exist
This table should have been created during upgrade. Looks like the upgrade script didn't run. To trigger it again, edit the core_resource table. Search for a row with customgrid_setup and reset the version number to your version before your upgrade. After that, flush magento cache in backend. On the next page call the installer will be rerun.

Categories : Magento

MySQL Create Table Error - Table Doesn't Exist
This looks like a data dictionary problem. You can get more information by checking the error log. (See the MySQL docs here). Possibly, you have an orphaned table. If so, the solution is to create a table of the same name in a different database, then copy the .frm file to the current database. Then you can DROP the table, and a subsequent CREATE should then succeed. More details on troubleshooting this sort of problem can be found here

Categories : Mysql

Test that should throw an exception when specified file doesn't exist
You absolutely CAN send a temporary file to a "function". I suggest that you need to send the entire file path instead of just words since each time the test is run the file will be located in a new temp folder. Like args[5] = words.getAbsolutePath();

Categories : Java

How to find records are exist or not from table in mysql table
How about something like SELECT * FROM tbl_user WHERE NOT EXISTS ( SELECT 1 FROM tbl_user_responce WHEREN tbl_user.email = tbl_user_responce.responce_email ) Or even something like SELECT tbl_user.* FROM tbl_user LEFT JOIN tbl_user_responce ON tbl_user.email = tbl_user_responce.responce_email WHERE tbl_user_responce.responce_email IS NULL

Categories : Mysql

Print data even if it is null/empty/none existed. Note: some cells doesn't exist
You can achieve this by looping for every month, and outputting the value if there is one from the database, or 0 if not. For example; $rows = array(); while ($row = $adb->fetch_array($result)) { $rows[$row['month']] = $row['margin']; } for ($i = 1; $i < 13; $i++) { $margin .= (isset($rows[$i]) ? $rows[$i] : 0) . ', '; }

Categories : PHP

package grails.plugins.springsecurity does not exist in jUnit test
I'm not sure why this particular issue is happening, but you can't really test security with unit tests. Spring Security is implemented as a filter chain, so you need to create a request and apply the chain. This could be properly mocked, but it would be a lot of work. Your best bet is to use functional tests, with a real running server and real requests. The risk of false positives with other approaches is way too high.

Categories : Java

What tools exist for managing a large suite of test programs?
We rolled our own, we have a whole test infrastructure. It manages the tests, has a number of built in features for allowing the tests to log results, the logs are managed by the test infrastructure to go into a searchable database for all kinds of report generation. Each test has a class/structure that has information about the test, name of test, author, and a variety of other tags. When running a test suite you can run everything or run everything with a certain tag. So if you want to only test SRAM you can easily run only tests tagged sram. Our tests are all considered either pass or fail. pass/fail criteria is determined by the author of the individual test, but the infrastructure wants to see either pass or fail. You need to define what your possible results are, as simple as

Categories : Testing

Django test DoesNotExist: Contact matching query does not exist
You shall use setUp method, not setup. This method is called before running every test. class BatchTestCase(TestCase): def setUp(self): # create test objects here # ...

Categories : Python

When test is runing to watch in parallel if specific element exist
Check out EventFiringWebDriver which may help, http://onlineseleniumtraining.com/how-to-working-with-listeners-in-selenium-webdriver/

Categories : Java

Insert into another table where the columns exist in table 2
You can set default value for col 4 & col 5 to NULL and then run this query : INSERT INTO table1 (col1, col2, col3) SELECT col1, col2, col3 FROM table2; It should work but you have to explicitly specify the columns in common between the two tables.

Categories : PHP

how to put logic in 2 different mysql table?
SELECT T.username FROM user T WHERE T.id NOT IN ( SELECT F.to FROM follow F WHERE F.from = ( SELECT T2.id FROM user T2 WHERE T2.username = "RKO" ) )

Categories : Mysql

doing jQuery logic foreach button of table row
HTML <input type='button' class="button" value="<?php echo $company->id ?>"/> JS $(document).ready(function(){ $('.button').click(function(){ alert($(this).val()); $(this).prop("disabled",true); });

Categories : Javascript

Complex Logic to update a table in sql server
You can write an SQL query also select [Regno], [Date], [Year], [Batch] as KEY, case when (ISNULL(H1,'')='' OR ISNULL(H2,'')='' OR ISNULL(H3,'')='' OR ISNULL(H4,'')='' OR ISNULL(H5,'')='') THEN NULL when (H1='P' and H2='P' and H3='P' and H4='P' and H5='P') THEN 'P' when (H1='P' and H2='P' and H3='P') THEN 'P' when (H4='P' and H5='P') THEN 'P' ELSE 'A' END as APP from Table1 SQL Fiddle

Categories : Sql Server

Test for empty Listobject header
As said by Doug Excel just creates a default header name of "Column1". If you want to read column header you can use the below code. Sub sample() Dim tbl As Object Set tbl = Sheets("sheet1").ListObjects("Table1") MsgBox Trim(tbl.ListRows(1).Range.Cells(0, 1)) End Sub

Categories : Excel

How-to Test if Umbraco property is empty
umbraco.library:GetMedia cannot return null, you may get an error back if no media was matched, in example <error>No media is maching '123123'</error> The thing is that your code works but you dont close the <xsl:attribute name="src"> as you should <xsl:attribute name="src"> <xsl:value-of select="$url" /> </xsl:attribute> If you for some reason really like to ensure that there is an image in there you should write a "test" and count values in the nodeTypeAlias <xsl:variable name="media" select="umbraco.library:GetMedia(sectionImage, 0)" /> <xsl:if test="count($media[@nodeTypeAlias='Image']) > 0"> <xsl:variable name="url" select="$media/umbracoFile" /> <xsl:element name="img"> <xsl:attribute name="src">

Categories : Xslt

mySQL logic: output of table join not correct
If I understood correctly, this may be useful for you: SELECT a.* FROM ( SELECT *, 'finished' as event_type FROM finished_events UNION SELECT *, 'flagged' as event_type FROM flagged_events) a ORDER BY a.schedule, a.time_stamp

Categories : PHP

Why would ALTER TABLE DROP CONSTRAINT on an empty table take a long time?
Check pg_locks and verify that no other transaction has a lock on the table. Even a read lock will prevent ALTER TABLE. x select pg_class.relname, pg_locks.* from pg_locks left outer join pg_class ON (pg_locks.relation = pg_class.oid) where pg_locks.relation = 'auth_user'::regclass; By filtering for where not granted in your original query you're only showing outstanding locks, not the locks that're blocking them. The fact that this lock has not been granted tells me that this is a locking problem. Another transaction holds a lock on this table that prevents the ALTER TABLE from acquiring the AccessExclusiveLock it needs to proceed. This might just be a transaction that SELECTed from the table at some point. You can find it by joining on pg_stat_activity: select c.relname,

Categories : Postgresql

PHP test if POST is empty from FORM fields
Empty isn't a particularly good validation tool when used blindly and on it's own. From the PHP manual page it will return true if: "" (an empty string) 0 (0 as an integer) 0.0 (0 as a float) "0" (0 as a string) NULL FALSE array() (an empty array) $var; (a variable declared, but without a value) Regarding the variables that you've used the likely values would pass as expected but I could just put some whitespace (" ") in the form fields and have it pass. You will want to trim($_POST["lastname"]) and others before you check it against empty(). One other thing to think about in the future is that empty() returns TRUE for 0 or 0.0 which is often undesirable behaviour. For example if your form asked me the age of my children and one of them was only recently born, I would put in 0 a

Categories : PHP

How do I test for an empty string in a Bash case statement?
Here's one workaround: case _${command} in _start) do_start ;; _stop) do_stop ;; _config) do_config ;; _) do_default ;; *) do_help ;; esac Obviously you can use whatever prefix you like.

Categories : String

How to test whether a command output is non-empty in POSIX shell?
You can check the exit status of the command also. Usually, commands if successfuly run, return an exit status of 0. git ls-files --killed > /dev/null if [ $? -eq 0 ] OR if you want to only depend on the output of the command , you can use the "head -1" along with you 1st option since anyway it looks you are not doing any processing with your command output apart from knowing the result.

Categories : Bash

Getting familiar with MVC - how do I work with session logic, additional classes and background logic
Why not use one of the many existing MVC frameworks available for PHP? There are a lot out there (CakePHP, CodeIgniter, Yii etc etc). If you really want to re-invent the wheel, go ahead! However the existing frameworks represent the culmination of a lot of development by smart people, so you are getting a great head start by adopting one. Furthermore, they are well documented and have good tutorials which will answer the questions you are asking and also many you haven't asked yet.

Categories : PHP

The specified table does not exist[entity]
I don't see where you actually create a Match Object. if you have you need to include that code in the question as well. and if you haven't, that would explain why it doesn't exist. Addition in order to add Match Objects to a list you will have to create the objects first then add them to the list, I don't think you can create the whole list of objects before creating each individual object. more Additional Information the object still needs to be created before you can add items to it. that is what the error is telling you. you don't have the object to insert data into. Match Table1 = new Match(); this creates a new Match object which allows you to access the pieces of the object and insert data into the object like this Table1.MatchNumber = 42 you can't add to something t

Categories : C#



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