## Can i use a string as an end of line delimeter when importing a csv to mysql?

Very basic question but im struggling with it. When i am importing a csv file to mysql is it possible to use any character or string as an end of line delimeter? If so is it possible from the admin window ‘Import’? Or must i do so in a sql query (doesnt seem logical).

So far i have had issues using everything besides \n and auto in the php my admin window. I tried the € sign i tried ///. Didnt work and got errors relating to an incorrect end of line delimeter.
Any help would be much appreciated. Thank you.

## WordPress, fetching users with an exact match in a string of comma separated values in user_meta

I have data saved in user_meta -> areapref field. It is basically a string of comma delimited post IDs (e.g. 2, 37, 200, 300 etc.)

I need to check if the user has a particular ID in this field. If so… do stuff.

I can check if an ID is in areapref using LIKE. But I believe this has an issue. If one location is ID=10, and another is ID=100 – both will match with 1, or 10? Or am I misunderstanding LIKE. I fear CONTAIN would have the same issue.

I need to know how to get a list of users who have an ‘exact match’ within the areapref string? So search for ID 2, will return only 2, NOT 22, or 20, 200 etc. I’ve spent hours going through stackexchange/overflow/wp codex and cannot find an answer… though I am dense!

Here’s enough code I hope to show what I’m currently doing… any ideas greatly appreciated.

function ds_notify_new_event( $post_ID ){$  url = get_permalink( $post_ID );$  event = get_the_title( $post_ID );$  localeID = get_post_field( 'location_id', $post_ID); global$  wpdb; $locale =$  wpdb->get_var( $wpdb->prepare( " SELECT post_id FROM {$  wpdb->prefix}em_locations WHERE ID = %d ", $localeID ) );$  args = array(         'role'    => 'subscriber',         'meta_query' => array(                 array( 'key' => 'areapref', 'value' => $locale, 'compare' => 'LIKE' ), // just checks usr is ok with email array( 'key' => 'notify', 'value' => 'yes', 'compare' => '=' ) ), 'fields' => array( 'display_name', 'user_email' ) ); // retrieve users to notify about the new post$  users = get_users( $args );  // do stuff with users ## conversion failed when converting datetime from character string while inserting and updating to database I’m trying to insert time and date separately and calculate if it is late to the set time and then insert it to database… here’s my try code for update string Date = DateTime.Now.ToString("dd-MM-yyyy"); string Time = DateTime.Now.ToString("h:mm:ss tt"); SqlCommand comm2 = conn.CreateCommand(); comm2.CommandText = "Update Time_Logs SET Time_Out = ‘" + Time + "’ where Emp_Id = ‘" + EmpId.Text + "’ and Date = ‘" + Date + "’"; try { conn.Open(); comm2.ExecuteNonQuery(); MessageBox.Show("Time_Out…"); conn.Close(); TimeCompute(); } catch (Exception x) { MessageBox.Show(x.Message); conn.Close(); } and here is the code for inserting string Date = DateTime.Now.ToString("dd-MM-yyyy"); string Time = DateTime.Now.ToString("h:mm:ss tt");  SqlCommand comm = conn.CreateCommand(); comm.CommandText = "INSERT INTO Time_Logs (Emp_Id, Date, Time_In) VALUES('" + EmpId.Text + "','" + Date + "','" + Time + "')"; try { conn.Open(); comm.ExecuteNonQuery(); MessageBox.Show("Time_In..."); conn.Close(); DateTime time = DateTime.Parse(Time); DateTime inDate = DateTime.Parse("8:00:00 AM"); TimeSpan ts1 = inDate.TimeOfDay; TimeSpan ts = time - inDate; if (ts < ts1) { SqlCommand comm2 = conn.CreateCommand(); comm2.CommandText = "Update Time_Logs SET Late = '" + ts + "' where Emp_Id = '" + EmpId.Text + "' and Date = '" + Date + "'"; conn.Open(); comm2.ExecuteNonQuery(); conn.Close(); } else { SqlCommand comm2 = conn.CreateCommand(); comm2.CommandText = "Update Time_Logs SET Late = '" + ts + "' where Emp_Id = '" + EmpId.Text + "' and Date = '00:00:00'"; conn.Open(); comm2.ExecuteNonQuery(); conn.Close(); } } catch (Exception x) { MessageBox.Show(x.Message); conn.Close(); }  ## rest_sanitize_value_from_schema doesn’t sanitize string This is a part of a simplified piece of code. It accepts a JSON post, validates it against a schema and if ok, sanitize the JSON structure $  schema = array(         'type'       => 'object',         'properties' => array(             'email' => array(                 'type'   => 'string',                 'format' => 'email',             ),             'name'  => array(                 'type' => 'string',             ),         ),     );      $json = json_decode( '{"email":"info@test.com","name":"John <script>x.js</script>Doe"}', true );$  result = rest_validate_value_from_schema( $json,$  schema );     if ( is_wp_error( $result ) ) { echo 'Error'; die(); }$  clean = rest_sanitize_value_from_schema( $json,$  schema ); 

I’m expecting that the <script>x.js</script>part is stripped from the JSON-name field in ‘rest_sanitize_value_from schema’, but its not happening.

Looking into the function ‘rest_sanitize_value_from_schema’ on trac (rest-api.php lines 2471) it’s obvious why it is not sanitized because all strings are just casted to string!?

if ( 'string' === $args['type'] ) { return (string)$  value; } 

Is it me doing something wrong or is it a bug in ‘rest_sanitize_value_from_schema’.

## Persistent connection string errors .NET Core

I am migrating a full framework application to .NET Core. Under the full framework, it used the following connection string with the IBM .NET Connector for DB2:

"Server=localhost:50000;Database=testdb;" 

The code then assigned UserID and Password properties from credentials vault.

Now, under Core, with the IBM .NET Core connector for DB2 specifically v.2.0.0.100 (long-term support, according to IBM), this connection string throws an exception when a connection string builder is created from it:

{System.ArgumentNullException: Value cannot be null.    at System.Threading.Monitor.ReliableEnter(Object obj, Boolean& lockTaken)    at IBM.Data.DB2.Core.DB2ConnPool.ReplaceConnStrPwd(String value, String newvalue, Boolean onlyPwd)    at IBM.Data.DB2.Core.DB2Connection.RemoveConnectionStringPassword(String value, Boolean bMask)    at IBM.Data.DB2.Core.DB2ConnectionStringBuilder..ctor(String connectionString) 

There is no InnerException. I presume that some mandatory parameters of the connection string that I am not aware of have to be populated under Core, whereas under full framework they were optional. A careful read of IBM documents on DB2 connector Core yielded no mentions of connection string changes, unless I missed them. This blog post mentioned no such breaking changes.

Is anyone aware of mandatory connection string parameters that are missing from my connection string specifically for .NET Core connector?

## Exporting string with newline and tab symbols to LaTeX

We have a string that has "tab" symbol between letters "B" and "C" and "newline" symbol between letters "C" and "D":

Input:

"A B\tC\nD" 

Output:

The output is formatted accordingly to special symbols used.

But when I export the same string to LaTeX, the special symbols \n and \t are interpreted literally like so:

Input:

ExportString["A b\tc\nd", "TeXFragment"] 

Output:

$\text{A b$$\backslash$$tc$$\backslash$$newlined}$ 

If you put this Latex code into some TeX file the document will display literally "A B\tC\nD" and without "tab" and "newline" symbols.

How to tell the Mathematica to export the special symbols into LaTeX accordingly?

## How do I test the string it’s a sentence?

For example, string= "this is a sentence." The best way for I can think about is DictionaryWordQ. However, "this a is sentence." can’t be found in this way. "this a is sentence." is not a sentence because it’s not grammar correct. Anyone has a better idea?

## Specific number form to CForm to String

I am using a custom function to transform my expressions to a specific NumberForm but when I subsequently do expression//CForm//ToString they don’t work. This is because any NumberForm merely change the out cell frontend. Any idea how to solve this?

## casting custom string to date in SQL

I have a column with strings such as 2015-W02, meaning the second week of 2015. I would like to convert it to a date (e.g., corresponding to the Saturday of that week). It does not seem that CONVERT nor PARSE support this style. Any idea how to do that?