Start index error while doing Code First Migration - migration

I am trying to add fields from VB.Net class file to SQL database, while doing "Add Migration" It is showing "startIndex cannot be larger than length of string."
enter image description here

I had the same error message when i tried to make a migration. The cause in my case was an empty value for MigrationId for a particular migration in the _MigrationHistory table.
This field must have a value in the same format as the string parameter of the attribute [Migration("YYYYMMDDHHMMSS_SeedData")], which is described in the other answer.

Most of all you have some class in your data project with attribute Migration (maybe for seeding data or something similar) which name is not in expected format like this:
[Migration("YYYYMMDDHHMMSS_SeedData")]
Adjust the migration name to be in YYYYMMDDHHMMSS_Description format to fix the error startIndex cannot be larger than length of string.

Related

Big Query - extract json field which contains emoji?

In my BQ database table I have a column called payload which contains raw facebook webhooks JSON payloads as string. One of them contains a text with an emoji like Sample 🏦. In big query it look like
{"object":"page","entry":[{"id":"xxxx","time":1602757469275,"messaging":[{"sender":{"id":"xxxx"},"recipient":{"id":"xxxx"},"timestamp":1602757469062,"message":{"mid":"m_xxxx","text":"Sample \ud83c\udfe6","quick_reply":{"payload":"{\"key\": \"value\"}"},"tags":{"source":"source"}}}]}]}
I would like to create a view with a column text with extracted text field value from the raw json. I created an sql like
SELECT
JSON_EXTRACT_SCALAR(payload, '$.entry[0].messaging[0].message.text') as text,
FROM `my_table.facebook.webhook_received`
Sadly the result I get looks like that Sample ��
Does anyone know how to make big query decode the emoji properly or at least just not change it to those � signs ?
Those characters you have embedded are not for a bank icon which is your issue I believe.
Run the following in BQ and it returns the desired emoji:
select " Sample \U0001f3e6"
Ref:https://emojipedia.org/bank/
The two you have provided seem to default to the '?', invalid character
http://unicode.scarfboy.com/?s=U%2Bdfe6
edit: what ever is handling the message maybe throwing the encodings you're seeing in your message which may be the actual problem.
If you are using BigQuery Python client and its load_table_from_json method, there is a Unicode bug (especially its byte is over 0xFFFF, like 🏦) in the previous version, and I have submitted this bug fix which is already included in the latest release include it, https://github.com/googleapis/python-bigquery/releases/tag/v2.24.0. By the way, you should use \U0001F3E6, not \ud83c\udfe6 (UTF-16 hex type) to present 🏦 in your Python code with BigQuery.
Unicode Character 'BANK': https://www.fileformat.info/info/unicode/char/1f3e6/index.htm,
https://charbase.com/1f3e6-unicode-bank

Updating date in fields in project

I have the following problem updating MS Project fields with VBA:
I try this:
For Each t In ActiveProject.Tasks
'The following displays correctly Mo 14.05.18
Debug.Print Format(CDate("14.05.18", " ddd dd.mm.yy"))
'The following results in an error 438 (Method not supported)
t.Datum3 = Format(CDate("12.05.18","ddd dd.mm.yy"))
'this works fine but i'm not able to sort it proberly since it is a text sort for date fields, which is not wanted ...
't.Text25 = Format(CDate("12.05.15","ddd dd.mm.yy"))
Next t
It seems that not the format is a problem (I tried various formats, I even read it from the object to verify with format should be used) but generally, I'm not able to update date fields, I've got these problems with predefined date fields from MS Project as well as with user defined date fields.
Text fields don't make any problems at all.
Run-time error 438: Object doesn't support this property or method
You are getting the run-time error 438 because the Task object does not have a property called Datum3. Even though the field title in the German version is "Datum3", the actual property name is Date3. (see MS Project object model, German version)
Secondary issue
While MS Project will accept date field values formatted as text, it is not necessary and bad form as it implies the date field is text. Instead set the values like this:
t.Date3 = CDate("14.05.18")
Note: The display format for date fields is set in the Project Options (see Change the Date Format or Ändern des Datumsformats).
Rachel's answer is best... but, another approach if your core need is to sort and you are stuck with text, is to use dates in ISO 8601 format: YYYY-MM-DD . See https://en.wikipedia.org/wiki/ISO_8601 for details. Or better yet: https://xkcd.com/1179/ .

SMSS: text qualifier in the Tasks > Data Import?

I am trying to import a file, source here and selections here (select all fields and select "Pilkkueroteltu (otsikollinen)" and then click Jatka to download), with two header rows, " as text qualifier, comma as a field separator and with UTF-8 format. I am unable to do this in Micsosoft Server SQL Management Studio. I will focus now only on the text qualifier where " does not work (only reading the first quote as text qualifier).
where I am unable to specify the column separator, no idea why this is occurring.
Update 1
Refresh/Reset buttons fixed the initial preview but I am getting the following preview error in the step Select Source Tables and Views later.
Update 2
I get the LocaleID error The LocaleID 11 is not installed on this system.
(SQL Server Import and Export Wizard). I am getting the same error despite Locale/Code page settings, what is causing this?
How to specify the text qualifier in the MSMM?
I tried to replicate your scene. Very first, I had to delete first heading entry eg : "Kuntien avainluvut 1987-2016"
Please see : sample image
Column delimited is: ,
Might not be accurate answer or different from something which you expect, but by applying above settings, I could import data through SSMS2012
edit : based on comments.
Here is the detailed steps :
next,
next, you need to change column width of first column as it gave me data truncate error
next,
I have also got a dtsx package for the same, but I don't know how can I share it with you here.

Change default Culture/Decimal localization

I´m having a problem when trying to use a view Model that as a decimal property. Because my decimal region/culture format uses "," and not "." as decimal separator.
When I try to post that model, I get the following error:
The value xxx is not valid for the "field".
I´m using jquery.unobstrusive and jquery.validation. So when I make the submit the model get validated and a error is shown an a label with the error above.
The thing is, the property does not have any kind of attributes (Required,Regex,Range). So that error is produced by the middleware/framework when trying to parse the string to decimal.
If I type a decimal like: 40.05 the form submit with success.
If I type a decimal like: 40,05 the form submit fails with the above error.
I have already read about Globalization at:
https://docs.asp.net/en/latest/fundamentals/localization.html#globalization-and-localization-terms
but could not find the "path" trought setting my globalization culture.
At MVC4/5 we were used to add a web.config tag at system.web and that's it. But at MVC6 that doesn´t seem to be the way.
Any tips?

Validate number of attributes with date_select

I'm doing something like the following: Validate number of nested attributes.
I'm checking for existence of at least one nested attribute.
This was working fine when I was using a text input for the date but I've changed it to use a date_select instead and now the same validation code shows an error saying that not enough have been chosen.
When it fails validation and reloads the form it also doesn't "build" an instance of the nested attribute either so it just shows my "[+]" link
Anybody got any ideas?
Failing everything I'll just have to put the text field back (probably using type=date).
Col
I decided to just put the text field back.