Xamarin ignoring my accents - c#

I'm building and iOS App using Xamarin Studio and having some problems with the accents. Seems that the file enconde is wrong or something like that, but I can't find where/how to fix it.
For example, assuming that label is an outlet to a UILabel on my storyboard:
label.Title = "Álbum";
is showing "Album" without the accent on the interface.
If I try to do an Insert into a SQLite database like this:
connection.ExecuteScalar<EventData>("Insert Into EventData (Id, Description, Kind) values ('1', 'Mamãe chegando.', 0)");
I get an error in the SQL. But the same SQL when used on a sqlite console runs without a problem.
And when I run this SQL without the "ã", works even on the Xamarin.
Any idea how to fix it?

Related

Entity Framework Error 3004 while trying to add a field into a table

this question is about adding a new field called "Position" of type integer into an existing table via the Entity Framework designer. What I expect to happen (correct me if I am wrong) is add the field, select to update the database via the model and get the new field created in my database. Instead of this, I get an "Error 3004 Problem in mapping fragments at line xxx". My environment is using Visual Studio 2015 with EF5, and the database is hosted on Oracle MySQL. The project I am working on is a website which was given to me to maintain and upgrade further.
Here are my steps:
1. Discover the table in the model browser, click Show in Diagram.
2. Inside the model I right-click on the table -> Add New -> New Scalar Property and type the new field "Position" inside the table.
3. Click save icon to save the model
4. Then I get an Error 3004:
5. I realise that in the mapping details my new field isn't showing and I can't type in there to add it manually.
6. I can see the new field has been added to the syncitem class in fact I want this to be an integer so I go ahead and change it by hand.
Tried to click save again and re-compile but I still get the same error. I need to say at this point that I have spent an entire day searching around on the web about various error codes I got other than just 3004 but here is where I stopped and turned to SO for guidance. I know there are other threads here about Error 3004 and I did read quite a few them. One of the pieces of advice I found was to change the DDL generation template to one that supports MySQL since Visual Studio will default to SQL (this is done by clicking on the white space inside the designer and then clicking the Properties tab):
I tried that as well but nothing changed, the error persists... I also tried deleting the entire table in the designer and updating from the database, the table re-appeared but with a torrent of "Error 11007" lines, plus the table's associations are not wired correctly. Another thing I did was to open the .edmx file in Notepad++ and see if I can add my new field in there, but it just felt wrong doing it like that so I quit.
Am I approaching this in the wrong way? All I want to do is add a new field! I have come to a stop, my experience with EF is not great, I felt lots of frustration with this database's particular setup, quite frankly I dare say that I think it is somewhat broken. It's like dealing with a brand new religion whenever I have to touch it!
In the long run I want to upgrade to EF6 and get rid of the designer but that's another story.
Any advice on my problem will be greatly appreciated.
Thanks.
Eventually I had to tamper with the XML file of the model (the .edmx file) to manually add in my new field and set it to integer, as there was nothing I could do to satisfy Visual Studio. The web project I am working on looks rather complicated with loads of sub-projects in it like "DataAccess", "EntityModel", "ManagerLayer", my web folders and a host of other directories. I think my EF needs a complete re-do, my guess is that it started with a very old EF version and is shuffling its feet right now in terms of maintainance.

How can I create and menage two and more tables with SQLite - Windows Phone 8?

I am working on my Diploma work (Windows Phone 8 project), but unfortunately reached an impasse and don't have much time for more searching, so I beg you for help. I am using the following Tutorial: https://code.msdn.microsoft.com/windowsapps/WindowsPhone-8-SQLite-96a1e43b. Everything here is clear, but can someone give me an example (where and how the code should be updated) how to create related table with one 'String' (City) for example, so I can display the data (in this case name and phone number) only for the chosen city.
I suggest you to use SQLite-Net (https://github.com/praeclarum/sqlite-net)
You can install the library using Nuget and is very easy to use.
It has some limitations, but it will simplify the way you create tables, insert/read data, etc...
There are tons of documentation on How to use Sqlite-net...

Visual Studio 2013 Query editor errors and MYSQL

I have the following MYSQL query:
SELECT
stat_number,
sqldate,
sqlvalue,
ID,
CAST(GROUP_CONCAT(IF(YEAR(sqldate)= 2013, sqlvalue, NULL)) AS UNSIGNED) AS Y2013,
CAST(GROUP_CONCAT(IF(YEAR(sqldate)= 2014, sqlvalue, NULL)) AS UNSIGNED) AS Y2014,
CAST(GROUP_CONCAT(IF(YEAR(sqldate)= 2015, sqlvalue, NULL)) AS UNSIGNED) AS Y2015,
weekofyear(sqldate) AS `weekofyear(sqldate)`
FROM statval1
WHERE (stat_number = 495) AND (sqldate >='2013-01-01' OR sqldate <'2015-12-31')
GROUP BY weekofyear(sqldate)
ORDER BY weekofyear(sqldate)
It works great everywhere else EXCEPT in Visual Studio 2013 query Editor,
Does anyone knows how to make it work? or what is wrong with the query editor?
I keep getting the error:
Error in list of function arguments: '=' not recognized. Error in list
of function arguments: 'AS' not recognized. Unable to parse query
text.
If i ignore the error and keep going the datagrid seems to display the correct data, but nothing shows in the charts, I get no columns at all to select the x,Y axis. I recently started learning C# in Visual studio 2013 and I am trying to recreate a software that I made in PHP/MYSQL and recreated in Object Pascal/MYSQL but this is really putting me off visual studio.
It only took a couple of weeks to create a reporting software in Lazarus, pascal programming from not knowing anything at all, and it has taking me a week just to get MYSQL server talking properly with in Visual Studio 2013 and now the query do not work, but they work perfectly fine with object-pascal, PHP, JAVASCRIPT, ETC.
The lines baffling VS2013 are the ones like this:
CAST(GROUP_CONCAT(IF(YEAR(sqldate)= 2013, sqlvalue, NULL)) AS UNSIGNED) AS Y2013,
Your query works OK otherwise in VS2013.
But, what does this query mean? Are you sure it's well formed? You're taking advantage of MySQL's nonstandard extension to GROUP BY in an inscrutable way. Read this: http://dev.mysql.com/doc/refman/5.6/en/group-by-handling.html
You might consider reworking this query so it's standard.
Also, this date selection logic omits the last day of 2015. Is that what you want?
(sqldate >='2013-01-01' OR sqldate <'2015-12-31')
I could be wrong, and will be glad to be proven wrong but the VS 2013 query editor is geared towards MS SQL and only knows that syntax. The query is ok for MYSQL but in MS SQL you can not name a variable inside a function call.
Anyone else have any insight into this as I'm now curious as well?
My advice is : try to remove each attributes of the select statment and test if the query is responding an error.
With this way you can locate which attribute is giving that error.
I think , but im not sure that, the error is caused by thos : ‘ ’
Try to remove them as well.

Entity Framework Cyrillic displayed as question marks

I am writing an application and I am using Entity Framework and MSSQL. I have some cyrillic data(Bulgarian, if that matters) in the database. Problem is when I try to read it from the program I get question marks(?????????) but when I try from SQL Management studio everything shows up fine. Collation is set to Cyrillic_General_CI_AS and I am using nvarchar for the columns I store cyrillic characters in. I need your help. How can I fix this?
I found the solution. It turns out that the data that comes out of the database is perfectly fine. The problem was in the displaying. I was using a console project for testing and it apparently didn't like the cyrillic font. Changing the font of the console fixed my problem.

How can I Access an already existing SQLite database in mono for android

I'm currently working on a project where the application I'm creating needs to include a database. I've got no problems so far creating my own SQLite database from my application and accessing it is not a problem either. The problem for me is accessing an already existing database that I've included in the assets of the application.
I've seen many examples of solutions online where this is done by copying the database to the /files folder and then used something called SQLiteOpenHelper, which seems like a good solution. However, they've all been using Java so far and since I'm using C# (developing in Xamarin-studio which uses Xamarin.Android a.k.a. mono for android) those solutions doesn't really work for me.
Could anyone please give me som instructions about how to do this in mono? Or if you now other ways to solve the problem show me how to do those?
Thank you in advance
Have you tried following the Java guides on Xamarin?.
I had a lot of Android/Java experience before starting with Xamarin, and what I've found is that all of the android platform classes and fields are present in Xamarin (with some modifications to include C# naming conventions like camel case, enums, etc). So try following the guides from Java on your Xamarin project and if you hit a problem ask here or at http://forums.xamarin.com/

Categories