Sunday, 8 September 2013

How to deal MyISAM data corruption with myisamchk

How to deal MyISAM data corruption with myisamchk

How to deal MyISAM format data corruption with myisamchk in MySQL. If
Tables, Triggers, Views and Primary Keys become are corrupted. Then you
run access the tables through mysql while you run myisamchk and check
tables after run myisamchk and get a warning that a table is corrupt even
when it is not. After performing myisamchk the three files in the database
directory are shown in the following table.
tbl_name.frm Definition (format) file
tbl_name.MYD Data file
tbl_name.MYI Index file
Sometimes myisamchk is failure and cannot be guarantee to repair corrupt
MySQL database. If you are not able to repair corrupt database with
myisamchk, then find the tool which is repair corrupted MySQL database
automatically

Issue running Python sample code for Google Cloud Datastore

Issue running Python sample code for Google Cloud Datastore

GCD and the API client used to work fine for me but now I run into the
following issue when trying the getting started sample code from google
cloud datastore from here:
https://developers.google.com/datastore/docs/getstarted/start_python/
Running the code repeatedly says:
WARNING:oauth2client.util:new_request() takes at most 1 positional
argument (2 given)
And eventually I get a RuntimeError: maximum recursion depth exceeded
while calling a Python object With the following repeated stack trace
repeated:
File "test.py", line 91, in <module>
main()
File "test.py", line 19, in main
resp = datastore.begin_transaction(req)
File
"/usr/local/lib/python2.7/dist-packages/googledatastore/__init__.py",
line 81, in begin_transaction
return get_default_connection().begin_transaction(request)
File
"/usr/local/lib/python2.7/dist-packages/googledatastore/__init__.py",
line 59, in get_default_connection
_options['credentials'] = helper.get_credentials_from_env()
File "/usr/local/lib/python2.7/dist-packages/googledatastore/helper.py",
line 71, in get_credentials_from_env
Credentials. refresh (http)
File "/usr/local/lib/python2.7/dist-packages/oauth2client/client.py",
line 516, in refresh
self._refresh(http.request)
File "/usr/local/lib/python2.7/dist-packages/oauth2client/gce.py", line
82, in _refresh
response, content = http_request(uri)
File "/usr/local/lib/python2.7/dist-packages/oauth2client/util.py", line
132, in positional_wrapper
return wrapped(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/oauth2client/client.py",
line 475, in new_request
self._refresh(request_orig)
File "/usr/local/lib/python2.7/dist-packages/oauth2client/gce.py", line
82, in _refresh
response, content = http_request(uri)
File "/usr/local/lib/python2.7/dist-packages/httplib2/__init__.py", line
1570, in request
(response, content) = self._request(conn, authority, uri, request_uri,
method, body, headers, redirections, cachekey)
File "/usr/local/lib/python2.7/dist-packages/httplib2/__init__.py", line
1367, in _request
(response, content) = self.request(location, redirect_method,
body=body, headers = headers, redirections = redirections - 1)
File "/usr/local/lib/python2.7/dist-packages/oauth2client/util.py", line
132, in positional_wrapper
return wrapped(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/oauth2client/client.py",
line 475, in new_request
self._refresh(request_orig)
I installed googledatastore via pip with the following versions installed:
Requirement already satisfied: googledatastore in
/usr/local/lib/python2.6/dist-packages
Requirement already satisfied: protobuf>=2.5.0 in
/usr/local/lib/python2.6/dist-packages/protobuf-2.5.0-py2.6.egg (from
googledatastore)
Requirement already satisfied: oauth2client>=1.1 in
/usr/local/lib/python2.6/dist-packages/oauth2client-1.1-py2.6.egg (from
googledatastore)
Requirement already satisfied: uritemplate>=0.5.2 in
/usr/local/lib/python2.6/dist-packages (from googledatastore)
Requirement already satisfied: setuptools in
/usr/local/lib/python2.6/dist-packages/setuptools-0.6c11-py2.6.egg (from
protobuf>=2.5.0->googledatastore)
Requirement already satisfied: httplib2>=0.8 in
/usr/local/lib/python2.6/dist-packages/httplib2-0.8-py2.6.egg (from
oauth2client>=1.1->googledatastore)
Requirement already satisfied: python-gflags in
/usr/local/lib/python2.6/dist-packages/python_gflags-2.0-py2.6.egg (from
oauth2client>=1.1->googledatastore)
Requirement already satisfied: simplejson>=2.5.0 in
/usr/local/lib/python2.6/dist-packages (from
uritemplate>=0.5.2->googledatastore)
Installing collected packages: googledatastore, httplib2, oauth2client,
protobuf, python-gflags, setuptools, simplejson, uritemplate
Successfully installed googledatastore
And have tried it with different combinations of oauth2client version 1.2,
with Python2.6 and Python2.7 on Ubuntu Lucid and Ubuntu Precise.

Dynamically decide the table name in execute sql task for create table statement

Dynamically decide the table name in execute sql task for create table
statement

I want to know if this is possible to do in SSIS Execute SQL task. I want
to check for existence of a table and if not existing create a table. I
want to keep the Table name in a variable so I can execute the task
against different databases and be able to change the tablename.
As an example I have this code: if not exists (select * from sysobjects
where name='Table1' and xtype='U') Create Table Table1( Col11 varchar(10)
primary key, Col12 varchar(10) );
For Flexibility I want to store the value Table1 in a variable and keep
changing it to create different tables each time I run the package.

Update post terms

Update post terms

The function wp_set_post_terms() works fantastically however I'm looking
to add some terms to a post at a later date. I've tried using
wp_set_post_terms() and wp_set_object_terms() but they just overwrite
what's already there. I thought wp_add_object_terms() was the answer to my
question but it has the same functionality whereby overwriting the
original terms.
Any way to append terms via code?

Pass a Parent Class as an Argument - Python

Pass a Parent Class as an Argument - Python

Is it possible to leave a parent class unspecified until an instance is
created e.g. something like this:
class SomeParentClass:
# something
class Child(unspecifiedParentClass):
# something
instance = Child(SomeParentClass)
This obviously does not work. But is it possible to do this somehow?

Saturday, 7 September 2013

How can I rearrange this so input Ctrl-z(end of file signal) breaks loop while still testing for valid inputs in c++

How can I rearrange this so input Ctrl-z(end of file signal) breaks loop
while still testing for valid inputs in c++

==================================================================================
I have two problems here.
1. When I enter a valid input(positive number) it is successfully put into
the vector but then returns down to the next blank line waiting for
another input when it should just ask the same question again. And it
does. just only every other input Why is it stopping on a blank line like
that? 2. How can I rearrange this so Ctrl-z will signal end of file
instead of failing as
an invalid input?
do
{
cout << "\nPlease enter a homework score<'Ctrl-z' when done>: ";
cin >> value;
while(cin.fail() || value < ZERO)
{
cout << "not a valid positive numerical value. try again. \n";
cin.clear();
cin.ignore(numeric_limits<int>::max(),'\n');
cout << "\nplease enter a valid homework score<'Ctrl-z' when
done>: ";
cin >> value;
}
assignmentScore.push_back(value);
}while(cin >> value);

How can I construct a table header than spans multiple rows in HTML?

How can I construct a table header than spans multiple rows in HTML?

I would like to construct a table as follows:
| Major Heading 1 | Major Heading 2 |
| Minor1 | Minor2 | Minor3 | Minor4 |
----------------------------------------------
| col1 | col2 | col3 | col4 |
rest of table ...
Seeing as how there is only 1 line for TH elements, how can I construct
the header row such as the columns line up? Hierarchical tables doesn't
seem like a good option because the column widths won't line up, and I
also can't use two rows with TH tags with colspan.