|
Hi,
I want to make a managerial app using Xamarin. Is there any free SQL Server on the cloud which I can use in Visual Studio during app development (and as a database source for my app)?
I just only need to have a small amount of storage. My clients will be less than 100.
|
|
|
|
|
There are some - normally associated with free websites - but ... would I use one? Not on your Nellie!
They are free for a reason: very limited storage, very poor or non-existent / expensive tech support, availability and speed can be very low. You really do get what you pay for!
"100 clients" doesn't necessarily mean "low storage volume", it depends on the number of clients and the space each will use. Add to that, that space is not the same as bandwidth / processing time: responses need to be timely as well as small!
And these apply to the website and the DB - so unless you really don't care for security, uptime, or space, I'd pay for it. There are good one available cheap, but use Google to find one i your country if possible - it makes support much easier and (hopefully) quicker.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Azure SQL Service has a trial period for use. Is it possible to put an SQLite database file in the cloud and use the cloud IP address for reading/writing database on clients' devices?
|
|
|
|
|
That is a spectacularly bad idea, and most installations of SQL Server will not allow it - to do that you have to expose the whole DB server to the internet along with all the DBs it handles, with all the security problems that opens up!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I recently ran into a problem where I'm running a C# program on the Windows command line and the % character is breaking things. So it's like runthisprogram.exe -variables -outputname "I am a filename 100%.mkv".
The % in the above path when passed to the application errors. They say I have to escape the % to get it to work and they are correct, but if
I am a filename 100%.mkv
is in a variable, how do I dynamically search the contents and if there is a % replace it with %%
Thanks.
|
|
|
|
|
How about
myString = myString.Replace("%", "%%");
|
|
|
|
|
|
To add to what Dave has said, that sounds like they are giving you the runaround: unless you are creating a batch or powershell file from your string then the '%' character has no special significance in either a command line to an application, or a filename. You can happily execute a C# program and hand it a single '%' as part of a file name:
using System;
namespace OneOffConsole
{
class Program
{
static void Main(string[] args)
{
foreach (string s in args)
{
Console.WriteLine(s);
}
}
}
}
Microsoft Windows [Version 10.0.19043.985]
(c) Microsoft Corporation. All rights reserved.
C:\Users\PaulG>cd "D:\Documents\AA Backed Up\My Projects\OneOffJobs\OneOffConsole\bin\Debug"
C:\Users\PaulG>D:
D:\Documents\AA Backed Up\My Projects\OneOffJobs\OneOffConsole\bin\Debug>oneoffconsole -variables -outputname "I am a filename 100%.mkv"
-variables
-outputname
I am a filename 100%.mkv
D:\Documents\AA Backed Up\My Projects\OneOffJobs\OneOffConsole\bin\Debug>dir >"x 100%.txt"
D:\Documents\AA Backed Up\My Projects\OneOffJobs\OneOffConsole\bin\Debug>type "x 100%.txt"
Volume in drive D is GriffData
Volume Serial Number is 4CA5-2F85
Directory of D:\Documents\AA Backed Up\My Projects\OneOffJobs\OneOffConsole\bin\Debug
08/06/2021 06:39 <DIR> .
08/06/2021 06:39 <DIR> ..
20/06/2019 17:39 4,079,616 itextsharp.dll
20/06/2019 17:39 3,180,097 itextsharp.xml
20/06/2019 17:39 169,984 itextsharp.xmlworker.dll
08/06/2021 06:35 4,608 OneOffConsole.exe
25/06/2019 06:47 189 OneOffConsole.exe.config
08/06/2021 06:35 19,968 OneOffConsole.pdb
08/06/2021 06:39 0 x 100%.txt
7 File(s) 7,454,462 bytes
2 Dir(s) 805,619,617,792 bytes free
D:\Documents\AA Backed Up\My Projects\OneOffJobs\OneOffConsole\bin\Debug>
But that's worrying to me: because '%' isn't a special character in Windows, or C# - but it is in SQL, and only when passing strings to a database without using parameterised queries.
And that's very dangerous as it leaves an application wide open to something called "Sql Injection" which can destroy your entire database. Applications should always use Parameterized queries instead.
When you pass strings directly, you cause problems because SQL receives commands like:
SELECT * FROM MyTable WHERE StreetAddress = 'Baker's Wood' The quote the user added terminates the string as far as SQL is concerned and you get problems. But it could be worse. If I come along and type this instead: "x';DROP TABLE MyTable;--" Then SQL receives a very different command:
SELECT * FROM MyTable WHERE StreetAddress = 'x';DROP TABLE MyTable; Which SQL sees as three separate commands:
SELECT * FROM MyTable WHERE StreetAddress = 'x'; A perfectly valid SELECT
DROP TABLE MyTable; A perfectly valid "delete the table" command
And everything else is a comment.
So it does: selects any matching rows, deletes the table from the DB, and ignores anything else.
I'd suggest that you ask the developers why the '%' character is causing problems within a well-formed and quoted filename, and ask to see the code that it affects.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Joseline Riker wrote: The % in the above path when passed to the application errors. But you have not explained what error or where it occurs. As it stands using the % character in a filename is perfectly legal.
|
|
|
|
|
Try
I am a filename/Am I? .sav
File names are that; they should adhere to the naming rules, and aren't intended as a label.
Bastard Programmer from Hell
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
note: this is not about AOP, IL weaving, Furty, PostSharp, etc., although those facilities are related to this discussion.
Context: in WinForms both these notification methods have, imho, very limited uses.
Do you use these mechanisms more frequently in WPF ? Are they valuable to you ? Essential/integral in MVVM ?
Have you ever developed your own notification-with-cancellation mechanism (i have, for WinForms).
0) there's an excellent overview of how INotifyPropertyChanged can be used in different C# versions by SO's resident genius, Marc Gravell: [^]
1) INotifyPropertyChanging has no cancel mechanism ... unless you consider throwing an error in some context you have no control over sweet-smelling code According to PostSharp docs: "INotifyPropertyChanging interface is not portable (in Xamarin, it is even a part of a different namespace)."
2) INotifyPropertyChanged is just post-facto notification. There does appear to be a special benefit in using it with SQL and Linq: [^] ... i've never played with that.
Of course, you could trigger update of a binding connection. And, using Caller Information Attributes is easy in a Notify* changed handler ... imho, those attributes are of very limited value.
3) through "heroic" programming, you can create custom EventArgs that inherit from the INotify* versions and extend them to implement cancellation. however, in your subscribing objects' handlers you will have to cast the incoming args to their extended form.
there's an outstanding 2 article series here on CP from 2007: [^] that shows this kind of EventArgs extending as a way to get cancellation.
«One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali
modified 7-Jun-21 22:00pm.
|
|
|
|
|
BillWoodruff wrote: Do you use these mechanisms more frequently in WPF ? Hardly done any WPF.
BillWoodruff wrote: 1) INotifyPropertyChanging has no cancel mechanism ... unless you consider throwing an error in some context you have no control over sweet-smelling code According to PostSharp docs: "INotifyPropertyChanging interface is not portable (in Xamarin, it is even a part of a different namespace)." Cancelling an update would be exceptional, and not the rule. Never tried Xamarin; Mono is enough for me.
BillWoodruff wrote: 2) INotifyPropertyChanged is just post-facto notification. There does appear to be a special benefit in using it with SQL and Linq: [^] ... i've never played with that.
Of course, you could trigger update of a binding connection. And, using Caller Information Attributes is easy in a Notify* changed handler ... imho, those attributes are of very limited value. Dunno, never tried; I like close control over my queries.
BillWoodruff wrote: 3) through "heroic" programming, you can create custom EventArgs that inherit from the INotify* versions and extend them to implement cancellation. however, in your subscribing objects' handlers you will have to cast the incoming args to their extended form. Why would you, if it is already there? Exceptions aren't that expensive.
Bastard Programmer from Hell
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Thanks for you thoughts ! A major use of cancellation+notify code is to implement external validation on a per instance basis for your class. The multi-cast event driven technique enables external subscribers to define the validation code and/or the actions taken if validation passes or fails.
imho, locating responsibility for validation/data integrity outside the class can be seen as a "separation of concerns" strategy.
Of course, you could implement validation as a singleton within the class, so all external consumers are using the same validation.Eddy Vluggen wrote: Cancelling an update would be exceptional, Every time you use some validation method, potentially, cancelling an update can occur.Eddy Vluggen wrote: Exceptions aren't that expensive. When you allow external clients to inject executable code, potentially any of those clients could crash their code by throwing an error: meanwhile, back at the ranch, the calling class' code is waiting ...
«One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali
modified 8-Jun-21 20:37pm.
|
|
|
|
|
BillWoodruff wrote: Every time you use some validation method, potentially, cancelling an update can occur. Yes, but that'd be exceptionally, not the rule.
BillWoodruff wrote: When you allow external clients to inject executable code, potentially any of those clients could crash their code by throwing an error: If you allow external clients that, you got a bigger problem on your hands and them throwing an exception is not the most dramatical consideration.
During classes, we considered all humans interacting with the systen to be potentially evil. It kinda sticked; you prepare for the worst.
Bastard Programmer from Hell
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
I'll add to Eddy's information, except as applies to WPF.
This is probably the simplest view, but I use INotifyPropertyChanged for program properties that are bound to screen controls. When the program is changing the value rather than the user it lets you update the value whenever you like, and the screen updates naturally. The benefit of doing things this way is that the relationship between the property and the control is defined by the binding, so that it works the same everywhere. You don't have to worry about changing update code wherever you change the value.
I'll admit I don't particularly like the binding mechanism. It's complex and expressing bindings directly in XAML can be an exercise in frustration. I set most of my bindings in the C# code-behind because the XAML syntax is so awkward.
Software Zen: delete this;
|
|
|
|
|
Thanks, Gary, that's the type of reply i hoped i'd get !
i never explored binding in Win Forms beyond DataSet to Grid. List to ComboBox.
«One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali
|
|
|
|
|
Glad to be of help.
In its way binding is very useful. It lets you handle conversions between the on-screen depiction and your internal representation consistently. For data entry you can add your own validation rules and integrity checks.
One caveat to my statements. I don't do data base applications so I'm not familiar with more elaborate bindings, say between a data base table and a grid control. I imagine there are quite a few articles here on CP and examples in the wild that can help if you need it.
Software Zen: delete this;
|
|
|
|
|
This is sort of a "What would you do in this situation" post.
Our company has had a Windows program in use for many years since VB6.
The short description is that this program collects data points. It also makes use of DDE to make that information available to Excel. The user enters the server and topic in an Excel cell and gets the value from our program or can set a new register to monitor.
I have been asked to update the program to .NET and add some features. I am doing this is C#.
DDE is of course outdated and I have been trying other alternatives OLEDB / Interop and such.
The problem is that management wants all of the configuration to be on the Excel side so that its stored with the worksheet. (As it had been previously). For example my program shouldn't put a value in a specific cell. Rather it should behave like the DDE example did. and it shouldn't be using VBA to call the program via dlls or anything as the customer won't have access to that.
My background is not primarily .NET and I don't do much with OLE/COM/Interop ect.
I have been reading as much as I can and I have gotten to the point that if I know what cells to work with from the C# side I can get most of the functionality I want. However I have no idea how I would make this work such that the customer can specify everything about the shared data on the excel side.
Any thoughts? How would you approach a solution?
Edit: Edited to try to clarify that the management is really just trying to retain the functionality that the previous software versions had via DDE. As a developer I am trying to determine the best solution knowing DDE is obsolete. As of yet I haven't been able to find a newer technology that will meet the specific requirements of this tool. Its not a contentious situation or anything like that and I have no issues speaking up when I don't believe things make sense.
So really the question should be rephrased as.... "How would you approach a technical solution?"
Regards,
modified 10-Jun-21 23:34pm.
|
|
|
|
|
So your company wants you to create a solution in Excel but will not allow you to use VBA (or the current scripting language). Management straight out of the 1980s.
You may be able to launch the c# app from a button in the excel sheet, you can also use c# as the scripting language behind the sheets (it is no VBA after all )
I think there may be events available on the cell (onleave maybe) which may be used to access the code behind.
I also think there are excel clones that can be embedded into a c# winforms app that looks and feels like excel that hooks in all the usual events so you can use c# to do the work.
I would stronly recommend telling management that they are shooting themselves in the foot!
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
Love the username Mycroft. and the 1980s comment.
The spreadsheets in this case would generally be setup by the customer using our equipment. Our prior app just acted as a server. At the moment the argument is that all of my solutions are too complicated for the customer or won't save with the excel file. Its for industrial customers not the typical office user.
I thought I might be able to get away with automation and maybe referencing by named ranges. I haven't been able to get it to work from the C# app trying to use named ranges though. Not without the app
already knowing what they are.
Believe me. They have heard my complaints. This is a rarely used feature but they insist it still needs to support it without changing it much. I may have to wind up using DDE (NDDE maybe?) though I would really rather not.
Thanks for the suggestions. 
|
|
|
|
|
eremitic19 wrote: The problem is that management wants all of the configuration to be on the Excel side Yup. That's the problem.
And what made those managers such specialists that they get to decide about a technical problem?
eremitic19 wrote: How would you approach a solution? I'd be asking management what qualifies them to dare bring solutions to the table.
And yes, not going to make you popular, but that's what I'd do, since that's what they paying me for.
Bastard Programmer from Hell
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
I have an application that receives messages from a network that describe object events and status (think of a CAN Bus data logging type of application).
My plan is to record 'change' events (actual change as opposed to re-transmit) to disk along with 'key frames' (status of all objects) to allow later playback of the data. Data format is not predetermined. I'll work with whatever is the best fit.
I am looking for code that would support playback controls such as 'play', 'pause', 'rewind', 'start playing at <time>', 'fast forward', etc.
My searching of the web gets me lots of things having to do with audio and video playback but nothing in the area of arbitrary data playback.
I can 'roll my own' but a head start would be helpful.
Thanks in advance for your thoughts ...
|
|
|
|
|
You need to be more specific about what you mean by "arbitrary data playback". A system restore involves a "pause, rewind and play" (but there's nothing to see).
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
To be more specific ...
My application is a signal system I have designed for "Ride On Railroads" (7.5" gauge typically here in the USA).
The system consists of controller nodes distributed around the railroad. Each of these nodes detects track occupancy, calculates which train should be permitted to proceed and sets signals accordingly.
All of this data (track occupancy, signal head settings, etc.) is broadcast on a single CAN Bus in real time.
There can be one or more PCs attached to the network for monitoring and control (NOT control of train movements, that's totally done by the controller nodes).
One of the things the PCs support is display of train movements to passengers as well as one or more dispatchers.
I want to record this CAN Bus data as a stream of 'change' events as well as periodic "key frame" records to a disk file. The key frame record records the current status of every object (track, signal, etc.) on the railroad. Thus, starting at a 'key frame' and proceeding forward in time you have a time record of everything that happened on the railroad.
I want to be able to switch the display screen from the 'live data stream' (what is currently happening on the railroad) and display what happened at an earlier time ... i.e.: replay the railroad activity.
So, I need to be able to support things like "play back the data stream from 5pm yesterday", etc.
This is done all the time with audio and video streams but I have not been able to find any examples of code that will do it for an arbitrary stream of data.
I also need to decide the file format that would be efficient for recording the data stream and allows somewhat random read start points. Least efficient, but would work, would be for me to just do a 'binary search' in the file by picking a point in the file and scanning for a key frame, check the time, and jump forward or backward depending on the result of the comparison. No complicated indexes needed. Writing of the stream to disk is a MUCH more frequent activity than read so writing needs to be optimized over reading/playback.
It's kind of like a data acquisition system that gathers a stream of data and you want to be able to play it back from an arbitrary point.
Again, I can roll my own but figured it was worth checking to see if something existed that was close to my needs but all my searches only show up tools for audio or video.
As an aside: forward seems easy, skip back "x seconds" is harder/less efficient.
For more information on the system in general see: http://www.minirailsolutions.com[^]
In this document is an example of the track display: SComm | MiniRailSolutions – Automatic Signals For Ride-on Railroads[^]
|
|
|
|
|
I've never heard of any such tools, probably because of the infinite nature of "arbitrary data".
|
|
|
|
|
"Play back" then simply depends on the "player" having a proper interface; i.e. the same one for real-time playing and historical.
In real-time, you add to a concurrent queue (enque / dequeue) AND a concurrent serial log (append). The real-time "playing" uses the "real-time" queue.
In play-back, you load what you want to the "play-back" queue (a reference) from the serial log, and a new instance of the player runs off of that.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|