MediaWiki - tables not showing - mediawiki

Using MediaWiki 1.18, phpMyAdmin 2.10.1 , mysql 5.0.67, Semantic MediaWiki 1.7.1.
I'm trying to create tables in my mediawiki but they just appear as text. I thought this was a part of the base code, but perhaps there is an addon I have to install? I've tried:
{| class="prettytable"
|-
|
fdasfda
|
afda
|-
|
fdafda
|
fdafdsa
|}
This just displays as {| class="prettytable"|-|fdasfda|afda|-|fdafda|fdafdsa|}
Any idea how to solve this?
Update: I just enabled the two beta options:
Enable enhanced editing toolbar
Enable dialogs for inserting links, tables and more
After doing that, I can use the toolbar to create a table, which is visible after editing, but attempting to copy/paste code for a table still does not work.

I just used class="wikitable" instead.

Your line-feeds may be your problem. I've had issues with that in the past. Try..
{| class="prettytable"
|-
| fdasfda
| afda
|-
| fdafda
| fdafdsa
|}
Also, your class="prettytable" css could be broken.. Try the table without it.

Related

How to change the tag name of an xml prior to LOAD XML in MySQL using UpdateXML

I have created a simple XML below for easy appreciation of my case. I am importing this XML at runtime to a MySQL table using Load XML. Unfortunately, the XML below has some weird structure that gives a some setbacks to me.
<?xml version="1.0" ?>
<transportation>
<vehicles>
<cars>
<car>
<id>1</>
<name>toyota</>
<model>corolla</>
<type>
<id>1</>
<name>sedan</>
</type>
</car>
<car>
<id>2</>
<name>ford</>
<model>explorer</>
<type>
<id>2</>
<name>suv</>
</type>
</car>
</cars>
</vehicles>
</transportation>
Using the Load XML, I was able to import this (4,000 records) to a table I created in 0.2 seconds. EXCEPT, the type which has the child or id and name as shown below are giving me null values.
From my research, someone had said the Load XML is not capable of reading child or grand child nodes but I couldn't find any documentation. Except that it is my case now.
+----+---------+----------+---------+-----------+
| id | name | model | id | name |
+----+---------+----------+---------+-----------+
| 1 | toyota | corolla | null | null |
+----+---------+----------+---------+-----------+
| 2 | ford | explorer | null | null |
+----+---------+----------+---------+-----------+
What I am trying to achieve now is to manipulate the XML prior to importing it. I was able to produce a variable #xml inside in MySQL. Now, my next move is to modify the #xml in the following structure, concatenating the type tag along with its child tags — id and name;
<?xml version="1.0" ?>
<transportation>
<vehicles>
<cars>
<car>
<id>1</>
<name>toyota</>
<model>corolla</>
<type_id>1</>
<type_name>sedan</>
</car>
<car>
<id>2</>
<name>ford</>
<model>explorer</>
<type_id>2</>
<type_name>suv</>
</car>
</cars>
</vehicles>
</transportation>
The reason for this is that, I do not want to do the manipulation of the data after importing it to MySQL. My application will be handling hundreds of XML files at the same time with thousands or even millions, as time passes, of records for each XML. My best option is to do it prior to importing XML.
This is what I have done so far:
/* CREATE #XML */
Create Temporary Table xmltable_temp (
id Int Not Null Auto_increment Primary Key,
xml_data LongText Not Null);
Set #xmlfile = Load_File(".../MyXML.xml");
Insert Into xmltable_temp Values (Null, #xmlfile);
Select xml_data from xmltable_temp Limit 1 INTO #xml_var;
/* UPDATEXML (working on this now) */
SELECT UpdateXML(#xml_data, '????', '????') AS xmldata;
/* LOAD XML */
Load XML Infile ".../MyXML.xml"
Into Table db.xmltable
Rows Identified by '<cars>';
Right now, I am looking at the UpdateXML documentation, but I am not really sure if this is the right direction. I am still having a hard time appreciating the dynamics of UpdateXML but should be okay.
My question now is: Is this the right direction?
Secondly, is it possible for you guys to shoot me a solution? Perhaps, some guidance will do also?
I will appreciate any help here.

PHPStorm refactor shortcut to give an alias in use statement

When I try to use a class that causes name conflict ie. I have two classes with the same name but different namespaces and I try to use both of them PHPStorm shows a prompt to rename the second class = give it an alias with as.
<?php
use MyNamespace\SomeClass;
use MyOtherNamespace\SomeClass as SomeOtherClass;
I would like to be able to call this prompt any time when pointer is on a class preferably from a keyboard shortcut. Is this possible?
With PhpStorm 2018.3 you can use "Replace with Alias" feature: https://blog.jetbrains.com/phpstorm/2018/12/new-refactorings-in-phpstorm-2018-3/
You can use PHPStorm refactoring feature (cursor on SomeOtherClass, Shift+F6), it allows to rename alias and its usages.
click here to see the screenshot
If you have already used SomeClass in your script without an alias, first you should set an alias with the same name:
use MyNamespace\SomeClass as SomeClass;
and then refactor this alias, as decribed above.
Another one solution:
If you import a conflicting name, like Foo\MyClass and you already have use Bar\MyClass; in your document, you should be faced with the following prompt
+--------------------------------------------+
| Import class |
+--------------------------------------------+
| Alias name: |
| [________________________________________] |
| |
| [X] Always create alias while class import |
| |
| [ OK ] [ Cancel ] |
+--------------------------------------------+
The trick is to check the "Always create alias" checkbox to always be
faced with the prompt while importing.
Forgot to mention that you should also uncheck the settings
Settings > Editor > General > Auto Import > [ ] Enable auto-import in
file scope
Settings > Editor > General > Auto Import > [ ] Enable auto-import in
namespace scope
https://laracasts.com/discuss/channels/general-discussion/phpstorm-importing-namespaces-with-aliases/replies/99388

Rails 4. Migrating (some) legacy DB data from old db to rails existing DataBase

I have a task to import old data from old DB to new Rails app. Old program was created in Delphi and is outdated so customer decided create rails app for replacing it. I have dump file, and I am creating local MySQL db now and inserting there data for last 8 years (mysql is working for over an hour already) :)
Now I am not sure about the way old data should be imported. The problem is that old db tables and columns are named differently from what I have in my App and there are many of unused and unneeded columns/tables there. So I need select only some of them and insert into App DB. Could You please suggest the best solution for this case?
Thank you in advance!
You can adjust old db to rails app and work with it
Let's imagine you have old DB with the following table old_posts
old_posts
________________________________________
sysid | name | description |
_______________________________________
| | |
1 | The best post| Some description |
_______________________________________
| | |
2 | Another post| Another descrip |
________________________________________
In rails you can define table_name with
More information in doc:
http://api.rubyonrails.org/classes/ActiveRecord/ModelSchema/ClassMethods.html#method-i-table_name
Also you can redifine attributes with alias_attribute
More information in doc:
http://api.rubyonrails.org/classes/Module.html#method-i-alias_attribute
To change primary key primary_key
More information in doc:
http://api.rubyonrails.org/classes/ActiveRecord/AttributeMethods/PrimaryKey/ClassMethods.html#method-i-primary_key-3D
The example will be seems as
class Post < ActiveRecord::Base
self.primary_key = 'sysid'
self.table_name = 'old_posts`
alias_attribute :name, :title
alias_attribute :description, :content
end
Then you can invoke:
p = Post.find(1)
p.title #= > The best post
Also you can use legacy database separately from rails app database
http://ilikestuffblog.com/2012/09/21/establishing-a-connection-to-a-non-default-database-in-rails-3-2-2/

Command history in mysql client only showing last line of multiline query

I'm using Mysql's command-line client in Screen/Tmux, from Bash in OSX's Terminal.app.
When using arrow-up to re-display a previously run query that spanned more than on line, AND when the cursor is on the very last line of the Terminal, the command in mysql's command history gets 'truncated', or cut off. This never happens when I use the same tools on my Ubuntu workstation
Here's a visual representation of what happens:
Typing some query; nothing wrong here.
+-------------------------------------------+
|mysql> |
|mysql> |
|mysql> |
|mysql>select * from tables where legs = 4 a|
|nd colour = 'green'; |
+-------------------------------------------+
Run it, results are displayed:
+-------------------------------------------+
|| 2 | ....... | ..... | |
|+---+---------+-------+ |
| x rows in set (0.00 sec) |
| |
|mysql> |
+-------------------------------------------+
Hitting [arrow-up] to re-display last query leaves me with:
+-------------------------------------------+
|| 2 | ....... | ..... | |
|+---+---------+-------+ |
| x rows in set (0.00 sec) |
| |
|nd colour = 'green'; |
+-------------------------------------------+
Hit [arrow-up] again, I get:
+-------------------------------------------+
|| 2 | ....... | ..... | |
|+---+---------+-------+ |
| x rows in set (0.00 sec) |
|mysql>select * from tables where legs = 4 a|
|nd colour = 'green'; |
+-------------------------------------------+
Could the be solved by changing a setting? Or is it a bug in Mysql's client?
Software versions:
OSX 10.7.3
Terminal Version 2.2.2 (303)
GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin11)
mysql Ver 14.14 Distrib 5.5.19, for osx10.7 (i386) using readline 5.1
Screen version 4.00.03 (FAU) 23-Oct-06
tmux 1.6
You have a few options I can think of to make your life easier in this regard:
readline commands combined with mysql options:
readline accepts commands similar to basic emacs commands (can be set to vi as well), or example CTRL-a returns you to the start of a line.
this combined with set horizontal-scroll-mode On, a readline that you set in ~/.inputrc, which allows you to get your input in 1 straight line, putting your cursor at the very end. Combine it with CTRL-a to immediately jump to the beginning and it's quite convenient.
~/.inputrc:
$if Mysql
set horizontal-scroll-mode On`
# uncomment the commands below to use vi keybindings
#set keymap vi
#set editing-mode vi
$endif
(some systems, OSX 10.5 for certain I believe use libedit instead of readline, in which case you need to put it all in ~/.editrc, if you're not sure about your system issue the mysql --version command )
To look for commands you issued you also have CTRL-r, which allows you to type in a term and your history will be searched for the last occurence.
interesting commands are:
CTRL-P go to the Previous command in your history
CTRL-N go to the Next command in your history
CTRL-R Reverse-search through your history
CTRL-S Search forward through your history
CTRL-A Move the cursor to the beginning of the line
CTRL-E Move the cursor to the end of the line
CTRL-W delete a Word backwards
ALT-D delete a word forwards
CTRL-F move the cursor Forward 1 character
CTRL-B move the cursor Backward 1 character
ALT-F move the cursor Forward 1 word
ALT-B move the cursor Backward 1 word
ALT-_ undo
Depending on your shell and the underlying they might not all work or be intercepted though. For example on Konsole, which I use on kde, I had to disable flow-control in advanced settings to allow for CTRL-s amongst others.
Finally mysql also gives you the \e command which allows you to edit your commands in your general file editor, if vi or emacs isn't your thing, try nano, it's easy and works well. The main disadvantage of using this is that when scrolling up newlines are ignored bu tabs and spaces aren't. It's a unix only thing but OS X should do fine there, can't check since I don't own any Apple computers, sorry. :)
To more easily use this command you could put a readline string macro in ~/.inputrc
e.g. Control-o: "\\e;\n" would bind CONTROL-o to \e; followed by enter for instant execution. (look at the Keybindings Section)
use an alternate shell:
such as altSQL: it gives syntax colouring, nice history scrolling and some other niceties, big bonus is that you have the source so you can adapt what you want.
drop the shell and go GUI:
Finally I'd like to plug the nice MySQL workbench to work on your databases, it's cross-platform, free and in my humble opinion a nice tool to work with.
I realise it's not a perfect solution and each have advantages and drawbacks but I hope this has helped you along somewhat.

my stopwords list is loaded but not working

I have a modified stopwords list file, which basically took out the word 'alone'. I have updated my /etc/my.cnf
ft_stopword_file=/etc/new_stopwords_list.txt
After restarting my mysql server, I did the following to show that mysql is indeed picking up the new variable.
SHOW VARIABLES LIKE '%ft_stop%'
+------------------+-----------------------------+
| Variable_name | Value |
+------------------+-----------------------------+
| ft_stopword_file | /etc/new_stopwords_list.txt |
+------------------+-----------------------------+
Afterward, I did a REPAIR TABLE to update the index. However, when I do a search, the new setting does not seem to take effect. What am I doing wrong?
What mode are you using?. It could be because of the 50% threshold. Did you you check in this direction.
http://dev.mysql.com/doc/refman/5.0/en/fulltext-fine-tuning.html