{"QuestionId": 26611062, "AnswerCount": 1, "Tags": "", "CreationDate": "2014-10-28T14:36:06.510", "AcceptedAnswerId": "26611590", "Title": "PostgreSQL to MySQL conversion of large tables", "Body": "

I need to convert a table from PostgreSQL to MySQL. The size of the table is 5.2GB. I am doing it on workbench, but after some 3minutes I am getting errors like below.

\n\n

HY001:14:Out of memory in allocating item buffer.

\n\n

I have tried changing innodb_log_file_size, innodb_log_buffer_size, query_cache_size, key_buffer_size and some other variables, but no go.

\n\n

Can someone help me in doing this. Is there is any other conversion tools to do this. It will be great if I solve the above error too.

\n", "Lable": "No"} {"QuestionId": 26681557, "AnswerCount": 1, "Tags": "", "CreationDate": "2014-10-31T18:52:36.330", "AcceptedAnswerId": "26681739", "Title": "Rails validation - inclusion", "Body": "

I am trying to add a validation to prevent the user from entering a url that does not include the word 'mywebsite' in it.

\n\n
validates :url, inclusion: { in: %w(mywebsite), message: \"Must be a mywebsite.com subdomain\" }\n
\n\n

The problem with the above code is that it will only accept 'mywebsite' as a valid argument, while I'd like it to accept any argument which includes the word mywebsite in it. Example: mywebsite.com/something

\n\n

How should I approach this?

\n", "Lable": "No"} {"QuestionId": 26819262, "AnswerCount": 1, "Tags": "", "CreationDate": "2014-11-08T16:19:51.487", "AcceptedAnswerId": null, "Title": "WebView falsely shows my \"no connection\"-page", "Body": "

I've made a WebView where it checks internet connection and if there is none it will display an error-page.

\n\n

It worked just fine until it recently when it would just display the error-page even though me having cellular data on, this persists even on WiFi's.

\n\n
package se.welovecode.tismatapp;\n\nimport android.support.v7.app.ActionBarActivity;\nimport android.annotation.SuppressLint;\nimport android.os.Bundle;\nimport android.view.KeyEvent;\nimport android.view.Window;\nimport android.webkit.WebSettings;\nimport android.webkit.WebView;\nimport android.webkit.WebViewClient;\n\n@SuppressLint(\"SetJavaScriptEnabled\") public class MainActivity extends ActionBarActivity {\n\nWebView myWebView;\n@Override\nprotected void onCreate(Bundle savedInstanceState) {\n    super.onCreate(savedInstanceState);\n    requestWindowFeature(Window.FEATURE_NO_TITLE);\n    setContentView(R.layout.activity_main);\n    final WebView myWebView = (WebView) findViewById(R.id.webview);\n    myWebView.loadUrl(\"http://www.welovecode.se/t-matapp\");\n    WebSettings webSettings = myWebView.getSettings();\n    webSettings.setJavaScriptEnabled(true);\n    myWebView.setWebViewClient(new WebViewClient() {\n    public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {\n    myWebView.loadUrl(\"file:///android_asset/index.html\");\n\n        }\n    });\n    }\n\n@Override\npublic boolean onKeyDown(int keyCode, KeyEvent event) {\n\n    if (keyCode == KeyEvent.KEYCODE_BACK) {\n        return false;\n    }\n\n    return super.onKeyDown(keyCode, event);\n}\n};\n
\n", "Lable": "No"} {"QuestionId": 26895470, "AnswerCount": 1, "Tags": "", "CreationDate": "2014-11-12T19:57:57.130", "AcceptedAnswerId": null, "Title": "Crystal Reports: Converting Selected Row Data to Column Data", "Body": "

Is it possible to transpose data for a select column in Crystal? Here is my issue... I am using ttx file to get data fields for the Crystal Report...

\n\n

I want only the tax_type and the tax_rate and tax amount to show up in the same row as the product sold. The tax_rate is stored in a separate table that needs to be pulled in as a column as well. I need to group and sum on product, buy, sell, tax_type, and then net the whole amount to come up with net total which I kinda know how... but I am stuck at transposing a row. Basically I only want to show row as column where tax type, amount, and rate matches transaction number and YN_tax == 1. The tax rate is stored in a totally separate table... Mind you that tax will not be applicable to each transaction... Here are the table Details

\n\n

Details Table\n

\n    Transaction Sales_Date buy_sell  Product location  ProductType    price  amount  YN_tax  tax_type\n    123456       11/9/2014  Sell    DEF      Brazil      trinkets     5     703.08
\n 123457 11/9/2014 Sell ABC Canada widget 10 213.5
\n 123458 11/9/2014 Buy DEF Brazil trinkets 2 630
\n 123459 11/9/2014 Buy DEF Brazil trinkets 3 34.41
\n 123457 11/9/2014 Sell ABC Canada SalesTax 3 688.2 1 SalesTax\n 123458 11/9/2014 Buy DEF Brazil FederalTax 2 132 1 FedTax\n

\n\n

Tax Rates Table\n

\n    title           rate\n    SalesTax        8.25\n    FedTax          9.75\n    

\n", "Lable": "No"} {"QuestionId": 26951445, "AnswerCount": 3, "Tags": "", "CreationDate": "2014-11-15T22:25:29.787", "AcceptedAnswerId": "26951498", "Title": "Having issues exiting my while loop", "Body": "

I have been testing my code for the past few hours and I am stumped. This program takes a text file of names, turns the names into a list, prints the names, sorts the names, prints the sorted names, then allows you to search through the list. Everything seems to be working fine, but the one issue I have is exiting the while loop. If y or Y is selected you can search again, but that also happens if anything else is selected. I added a print statement outside the loop so if anything other than y is selected then the program should end with that last printed string, but it doesn't seem to be working. Does anyone have any ideas about why it isn't working and what I could change to get it to work?

\n\n

Thank you for your time.

\n\n
#define the main function\ndef main():\n\n    #create a variable to control the loop\n    keep_going = 'y'\n\n    #setup loop to search for name\n    while keep_going == 'y' or keep_going == 'Y':    \n\n        #call input name function\n        names = input_name()\n\n        #call print name function\n        print_name(names)\n\n        #sort the printed list\n        names.sort()\n\n        #call the print name function\n        print_name(names)\n\n        #call the output name function\n        output_name(names)\n\n        #call the search name function\n        search_name(names)\n\n        #add user input for another search\n        search_again = input('Would you like to make another search?(y for yes): ')   \n\n    #print if anything other than y or Y is selected\n    print()\n    print('Goodbye!')\n\n#define the input function   \ndef input_name():\n\n    #open the names.txt file\n    infile = open('names.txt', 'r')\n\n    #read contents into a list\n    names = infile.readlines()\n\n    #close the file\n    infile.close()\n\n    #strip the \\n from each element\n    index = 0\n    while index < len(names):\n        names[index] = names[index].rstrip('\\n')\n        index += 1\n\n    #return the list back to main function    \n    return names\n\n#define the print name function\ndef print_name(names):\n\n    #print the contents of the list\n    for name in names:\n        print(name)\n\n#define the output name function\ndef output_name(names):\n\n    #open file for writing\n    outfile = open('sorted_names.txt', 'w')\n\n    #write the list to the file\n    for item in names:\n        outfile.write(item + '\\n')\n\n    #close the file\n    outfile.close()\n\n    #return to main function\n    return\n\n#define the search name function\ndef search_name(names):\n\n    #add a user input to search the file\n    search = input('Enter a name: ')\n\n    #determine whether the name is in the list\n    if search in names:\n\n        #get the names index\n        name_index = names.index(search)\n\n        #print the name was found and give the items index\n        print(search, \"was found in list. This item's index is\", name_index)         \n\n    else:\n\n        #print the item was not found\n        print(search, 'was not found in the list.')    \n\nmain() \n
\n", "Lable": "No"} {"QuestionId": 27096346, "AnswerCount": 1, "Tags": "", "CreationDate": "2014-11-24T00:49:23.990", "AcceptedAnswerId": "27097033", "Title": "Getting value with array", "Body": "

I am struggling to get the value of an element in a particular array. I would like to get the value of the \"logo\" in this case to return \"Logo Google 2013 Official.svg\" from the code below. \nAny help is greatly appreciated.

\n\n
<html>\n<head>\n</head>\n<body>\n\n<html>\n\n<body>\n<h2>Search</h2>\n<form method=\"post\">\nSearch: <input type=\"text\" name=\"q\" value=\"google\" />\n<input type=\"submit\" value=\"Submit\">\n</form>\n\n<?php\n\nif (isset($_POST['q'])) {\n$search = $_POST['q'];\n\n\n$url_2 = \n\"http://en.wikipedia.org/w/api.php?   \naction=query&prop=revisions&rvprop=content&format=json&titles=$search&rvsection=0&continue=\";\n$res_2 = file_get_contents($url_2);\n$data_2 = json_decode($res_2);\n\n\n?>\n\n<h2>Search results for '<?php echo $search; ?>'</h2>\n<ol>\n<?php foreach ($data_2->query->pages as $r): \n\n?>\n\n<li>\n\n<?php foreach($r->revisions[0] as $a); \necho $a; ?>\n\n</li>\n<?php endforeach; ?>\n</ol>\n\n<?php \n}\n?>\n\n</body>\n</html>\n
\n\n

The resulting $url_2 is http://en.wikipedia.org/w/api.php?action=query&prop=revisions&rvprop=content&format=json&titles=google&rvsection=0&continue=

\n", "Lable": "No"} {"QuestionId": 27156138, "AnswerCount": 1, "Tags": "