|
You do not retrieve the content based their locale, instead you retrieve the content based on the column.
If your table structure is — annoying — designed as the following,
PK_Table | SomeColumn | GujratiContent | ...
Then you can do something like this,
SELECT GujratiContent FROM table_name
That would return only the content from the column which contains Gujrati data. Other columns would be skipped. But, since SQL Server (or any SQL database) has no idea about the language, locale or content meaning, other than the fact that is it ASCII, Unicode or anything else... It cannot understand how to get Gujrati.
Secondly, if you meant to say that your Gujrati content gets lost, while you store the data in the database and upon retrieval it returns boxes, and question marks only. Then the problem is that you are not storing it as Unicode. Gujrati is an International language, and not English (or Latin), thus you need to use Unicode encoding instead of ASCII. One way to do that is to ensure Unicode data gets inserted, thus when you retrieve, Unicode data will be returned,
INSERT INTO table_name (column1, column2, GujratiContent, column3)
VALUES (1, 'ABC', N'Gujrati data here', DATE());
See this article to understand how Microsoft platforms understand Unicode.
See this article of mine to cross-check, Reading and writing Unicode data in .NET, SQL Server and .NET framework both support Unicode, it is up to you to check how you are passing the data.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
Are you asking how you retrieve data entered in the Gujarati script (encoded in a Unicode compliant Gujarati font [^] ) ... not Devanagiri ?
I voted for Afzaal's answer, and you should, too
«While I complain of being able to see only a shadow of the past, I may be insensitive to reality as it is now, since I'm not at a stage of development where I'm capable of seeing it. A few hundred years later another traveler despairing as myself, may mourn the disappearance of what I may have seen, but failed to see.» Claude Levi-Strauss (Tristes Tropiques, 1955)
|
|
|
|
|
Hello,
I am trying to write a database table to a csv file.
It works, but the problem i have is that it adds an "extra column" without a header but the rest of the cells containing:
System.Data.Linq.EntitySet`1[BookLendingLib.Models.RentedBook]
I am using LinqToSql for my database, and i have 3 tables: Books, Readers, and RentedBooks(RentedBooks being an associative table with BookId and ReaderId to define the books rented by a reader).
In my database designer file the RentedBook is "tagged" as an AssociationAttribute and i assume its related to the RentedBooks table.
What should i do to fix this?
These are the methods i use to export to csv:
<pre>private static IEnumerable<string> ToCsv<T>(IEnumerable<T> list)
{
var fields = typeof(T).GetFields();
var properties = typeof(T).GetProperties();
foreach (var @object in list)
{
yield return string.Join(",",
fields.Select(x => (x.GetValue(@object) ?? string.Empty).ToString())
.Concat(properties.Select(p => (p.GetValue(@object, null) ?? string.Empty).ToString()))
.ToArray());
}
}
private void ExportBookDb(string saveFilePath)
{
BookDBDataContext bDC = new BookDBDataContext();
if (ExclBookList != null)
{
ExclBookList.Clear();
}
ExclBookList = new ObservableCollection<Book>(bDC.Books);
Book bPropNames = new Book();
using (StreamWriter textWriter = File.CreateText(saveFilePath + ".csv"))
{
textWriter.WriteLine(nameof(bPropNames.Id) + "," + nameof(bPropNames.Title) + "," + nameof(bPropNames.Author) + "," + nameof(bPropNames.Isbn) + "," + nameof(bPropNames.Quantity) + "," + nameof(bPropNames.RezervedQty));
foreach (var line in ToCsv(ExclBookList))
{
textWriter.WriteLine(line);
}
}
Thank you in advance!
|
|
|
|
|
Your ToCsv method returns the string representation of the value of every public field and property of the entity you pass in.
The value System.Data.Linq.EntitySet`1[BookLendingLib.Models.RentedBook] suggests your entity contains a navigation property which returns a collection of RentedBook entities. This is a property, just like any other, and so will be included in the output.
Your code will also not work correctly if any property value contains a comma.
Try using a proper CSV library, like CsvHelper[^]:
private void ExportBookDb(string saveFilePath)
{
using (var bDC = new BookDBDataContext())
using (var textWriter = File.CreateText(saveFilePath + ".csv"))
using (var csv = new CsvWriter(textWriter))
{
csv.WriteRecords(bDC.Books);
}
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I tried it(csv Helper), and it works.
Thank you!
|
|
|
|
|
Hi Team
I am novice developer in C# and was given a test to complete. There is an existing class, but i dont know how to implement these two functions and methods; Please team i sincerely need help and once i passed it would be employed as C# developer.
using System.Collections.Generic;
using System.Linq;
using TestCode.Models;
namespace TestCode
{
public class StatsCalculator
{
public IEnumerable<team> TeamReferenceData { get; set; }
public IStatsWeighting StatsWeighting { get; set; }
public StatsCalculator(IEnumerable<team> teamReferenceData, IStatsWeighting statsWeighting)
{
TeamReferenceData = teamReferenceData;
StatsWeighting = statsWeighting;
}
// TODO: Return the player for the specified player number, or null if not located.
// The playerNumber parameter must be > 0. If it is not then return a null result.
// Note
// Team.Players has the players for the team.
// Player.PlayerNumber is the field to be compared against
public Player PlayerByPlayerNumber(int playerNumber)
{
return null;
}
// TODO: For each team return their win % as well as their players win %, sorted by the team 'win %' highest to lowest.
// If a teamId is specified then return data for only that team i.e. result list will only contain a single entry
// otherwise if the teamId=0 return item data for each team in TeamReferenceData supplied in the constructor.
// If a team is specified and cannot be located then return a empty list (list must be empty and not null).
// NB! If any player on the team has played 100 or more matches then IStatsWeighting must be invoked with the required parameters
// ONLY make this call if one or more of the player matches is >= 100.
// The result must be stored in the PlayerWeighting field inside the TeamValue result class.
// If all the players within the team has played less than 100 matches each then PlayerWeighting must be set to 0.
// Note
// Team Win % is Team.Victories over Team.Matches
// Player Win % is Player.Wins over Player.Matches i.e. the sum of all players win / matches on the team.
public IEnumerable<teamvalue> TeamWinPercentage(int teamId = 0)
{
return new List<teamvalue>();
}
}
}
// instructions for this test
What must be completed:
Inside StatsCalculator.cs are 2 methods with ToDos that must be implemented. These are PlayerByPlayerNumber and TeamWinPercentage
Read the ToDo's in order to understand what each method must do.
You must implement these 2 methods. Please implemented any tests (in the test project) you feel are relevant.
|
|
|
|
|
This is effectively your homework: it's a test to see how well you can do a specific task (which may or may not have any bearing on the final employment). As such, if we do it for you - which is what you are asking - then that gives the company the wrong idea about your skill and ability level. They will believe that you are an experienced developer with significant experience in C# and perhaps give you the job on that basis.
That isn't fair: not on them (recruitment is a very expensive process), not on you (who wouldn't last long in the job once they find out you lied about doing it yourself), and especially not on your fellow applicants who can do the job they are being hired for.
If you can't follow instructions such as those you have been given, then you aren't ready for that job. I'd suggest that you try applying for jobs you can do until you have brought your skill level up to the required standard.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I have to question you getting this job. The assignment you've given is not complicated at all. In fact, it's pretty trivial. If you can't do this assignment, you're not going to be in that job for very long.
Sorry, but that's the brutal reality of the industry.
modified 8-Aug-17 10:29am.
|
|
|
|
|
Hello everyone,
I want ask about very old libraries / snippers
- CommandLine Parser,
- NDesk Console ( ManyConsole )
- PowerArgs
- CommandLine
and more...
Why do they not work for me? I tried libraries but they are not successful. Just I have idea own parameters like mkbundle.cs from Github. I already read. mkbundle is great helper and you think mkbundle's example parameters better than hard understandable libraries: Is it correct?
I found https://github.com/mono/mono/blob/master/mcs/tools/mkbundle/mkbundle.cs mkbundle.cs from Github and shows how do I understand like I create arguments / parameters.
I write example:
class Program
{
private SDLWindow game;
static int Main(string[] args)
{
int argIndex = args.Length;
game = new SDLWindow();
for (int i = 0; i < argIndex; i++)
{
switch (args[i])
{
case "-width":
case "-w":
game.Width = int.Parse(args[++i]);
break;
case "-height":
case "-h":
game.Height = int.Parse(args[++i]);
break;
case "-game":
break;
default:
break;
}
}
game.Run(60);
return argIndex;
}
}
class SDLWindow : GameWindow
{
public SDLWindow()
{
WindowBorder = WindowBorder.Fixed;
}
}
Just example like game's parameters
game -w 1024 -h 600
output: http://i.imgur.com/lP8R3hF.jpg
Is it correct? If I understand parameters like hl.exe -game for example changes current game directory:
/basedir is default directory - If I use "-game" than /othergamedir -> "-game othergamedir"
Thanks for answer!
Example of game's parameters like hl.exe -w 1200 -h 600, etc any game with parameters
modified 4-Aug-17 21:47pm.
|
|
|
|
|
What results are you getting? Do you have an error message you can share with us?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Really? I don't see that....
Non errors! Just I want know if they have same. Thanks!
I thought you have code like mkbundle.cs from Github.
Thanks!
|
|
|
|
|
Here's mine:
ParsedCommandLine[^]
I have a list of several others. You may have to roll your own or change how you want it to work.
|
|
|
|
|
Thanks! I will roll for my own. And I am very happy because I know C# language now.
Best regards
|
|
|
|
|
Member 13310103 wrote: Why do they not work for me? Most likely because you are doing something wrong. But unless you explain what you mean by "not work" it is impossible to give a useful answer.
|
|
|
|
|
Aug-03-2017
Hi everybody and thanks in advance.
I'm writing my own media player using c# and the windows media player.
It's all going ok while working in the VS2013 but when I tried to share the resulting .exe file, the application don't start, don't display anything, don't do anything...
Am I missing something..? Any ideas please...
Thank you all..
|
|
|
|
|
Have a look in the event log see if anything is being written there. That's generally the best place to start hunting for clues.
This space for rent
|
|
|
|
|
Hi,
As soon as you rely on external components (i.c. WMP) several things could go wrong: WMP may not be installed, or it may be disabled (maybe this[^] could help), or you are trying to use a WMP browser plug-in that isn't installed (possibly by using the WebBrowser Control).
As such possibilities exist, your code should be such that it gracefully degrades, so the least you should do is catch exceptions and report to the user in functional terms; what I tend to always do is include a log facility that reports to the programmer in technical terms. Furthermore, if you were to use some operation that may never terminate, you should figure out a way to give it a timeout anyway.
FWIW: if you access Controls on a thread that didn't create them, all kind of weird things may happen, and not necessarily in a reproducible way.
Hope this helps,
|
|
|
|
|
I believe you can also get to the Event-Logs in windows via Visual Studios Env; which is better, since it groups up items for you. The path I use is Server Explorer>Servers>[Computer]>Event Logs>Application>[Your App].
Ben Scharbach
Temporalwars.Com
YouTube:Ben Scharbach
|
|
|
|
|
Hi all of you...
Thanks for your replies, still can't figure out what's going on but yes, I'm looking into the log..
It's helping... thanks!
|
|
|
|
|
Hi, my office hire a vendor to develop MIS system for internal use. The system is develop and configured with Microsoft SharePoint and their code is written in C#.Net language. Everything is running fine but one thing that really concern me is the implication of wrong setting or functionality when we we ask them to update the new feature or fix any issue, the target feature/issue is developed or fixed. But their code is impact to the other module of the system that cause something wrong. I have discussed with them and found that they are modify some share function or code which work great for target request module but impact the function of other module which later on we found.
My question from here is: do anyone in here know any style or tool to help them to manage their code more efficiency so making the progress of updating some feature won't impact to the functionality of other feature. Thank in advance!
Best regards,
Kanel
|
|
|
|
|
All this is kind of vague: what's a specific example you have observed ?
Are you competent enough in C# and .NET architecture to understand the code base ? To judge how well it's put together ? Is it your job to deal with the code ?
The possible structural issue here ... your dependency on a 3rd. party's code which you can't maintain/fix yourself (evidently) ... well, that may be something you can't modify. And, the idea of giving the 3rd. party some magic tool that will change everything ... seems like a fantasy.
On a business level, do you have any form of leverage with the 3rd. party ? Are they willing, able, to change ? The best leverage, of course, is financial; can you take your business elsewhere; are there funds they have not been paid, yet, etc.
You'd really have to describe the full context of the business relationship to say much more.
«Differences between Big-Endians, who broke eggs at the larger end, and Little-Endians gave rise to six rebellions: one Emperor lost his life, another his crown. The Lilliputian religion says an egg should be broken on the convenient end, which is now interpreted by the Lilliputians as the smaller end. Big-Endians gained favor in Blefuscu.» J. Swift, 'Gulliver's Travels,' 1726CE
|
|
|
|
|
What i have found in here is when the vendor change/update one module to meet our requirement, there is an impact to the functionality of the other module in our MIS system. As talk with them, I found that the problem because they use the share code module that is why they change their code to fit with one module it is impact to the code in another module.
It is hard for me to raise to management for the support contract to fix an issue that is not produce during first system development but it is an issue of produced by another support task. I think if there is any method or tool that help them to manage their code efficiency so there is no impact from one module to another module when there is any change made in the code.
|
|
|
|
|
I don't think there is any such thing as a tool to fix bad design/programming. You need to get your management involved in this, it is a business issue not a technical one.
|
|
|
|
|
|
As Richard suggested you are suffering from bad design or probably undisciplined coding. There are various tools built into Visual Studio to help find dependencies, these have obviously not been used.
There are also various practices and strategies to avoid the situation you find yourself in. It is good and normal practice to create shared methods, what you are missing is the skill and discipline to support the application. You have a crappy vendor!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|