Click here to Skip to main content
15,032,623 members

Comments by cigwork (Top 26 by date)

cigwork 30-Jun-19 16:27pm View
> If sm.CheckKey(frmActivation.PasswordDecrypt(tActivationKey, tEncryptionKey))

On the basis of the fragment shown on any run after FirstRun frmActivation will be null (nothing) when the line above is executed. Given this I'd expect a null reference exception to be thrown. That plus the prehistoric on error goto handling is likely to give interesting results.

If the code is genuinely going from the attempt to open the activation dialog on first ever run to connection open then that suggests the activation form is being closed without any user interaction, so an error condition in frmActivation, perhaps an exception being swallowed, resulting in the form closing before it has a chance to display anything.
cigwork 25-Nov-16 4:09am View
As Griff says there's not a lot to go on, but this looks a bit like a WebService/WCF request failing because the data to be returned is too large to be serialized in the maximum allowed size of string.

If that is what's going on then the interface needs to redesigned so that repeated calls can be made to allow the data to be retrieved in chunks. So instead if one method in your service, say GetAllData(), you have a couple; GetDataHeader() which returns stats on the data (such as a set of key IDs) and a GetDataChunk() method which (perhaps) works through the key IDs returned by the header call getting each chunk.

It's a failure that's bitten me in the past. Part of the problem, especially where the data is serialized as XML, is that although the raw data being sent is significantly less than string maxlen the repeated field names, including those for zero length string fields, in the XML (or even JSON) string push it over the limit.
cigwork 17-Nov-16 14:15pm View
Doesn't satisfy your "built in to EF" requirement, but I hacked this, link below, together a few years ago because I too like to have the columns in a DB described. Might get you out of a hole in the short term.
cigwork 10-Jun-16 15:23pm View
Well just spent a day or so trying Android Studio 2 and have uninstalled it. Can't run the HAXM emulator on my machine (fair enough it's a Celeron box), but, worse, the armabi emulator(s) won't run either and 17 minutes for gradely to build "hello world" is just taking the mickey.

Until I replace this machine will have to plod on with Eclipse/ADT even though I won't be able to target newer APIs. At least the Eclipse/ADT emulator works and building a "real" application only takes a few tens of seconds at most.

I'm pretty cheesed off, but at least this isn't work related.
cigwork 8-Mar-16 13:51pm View
So the JSON string couldn't be parsed. Try googling JSON and "invalid token" and see what sort of problems give that exception. Then go back to the code and see what's wrong with the input string.

Suggest that you create a console project and just play around with hard coded JSON strings and converting them to .Net classes until you're comfortable with the tech. Then go back and try it in your main project.
cigwork 7-Mar-16 14:11pm View
That is never going to work.

Please go back and re-read what I wrote; especially the sentence, "Create a class Transaction (or any other name that you choose) that has properties that match the names of the fields in your JSON string." then go back and look at what you have written.
cigwork 2-Mar-16 14:31pm View
Depends how "clever" you want to be and what want to do with the address.

You could use System.Net.IPaddress if you're working with .Net

Or if there isn't already an IPAddress class in the libraries you have access to you could create your own IPAddress class with all sorts of "useful" features like construction from string, validation of entered string, splitting the string into octets, various formatted string representation (hex or octal or ...) or whatever else you think might be fun.

Or you could just use a string as previously suggested and trust the user to enter a sane address. It all depends how robust you want your solution to be.
cigwork 26-Dec-15 6:25am View
1. You have a table that is holding date/time information as varchar rather than datetime. This is generally considered to be a less than sensible decision.
2. You (probably) have a UI that doesn't validate input dates adequately.

This has allowed someone to enter a "date" value that isn't a date, a date outside the min/max range for a SQL date or a valid date in a format for some locale other than that of the DB server.

The only solution at this point is to identify the offending row(s) and attempt to convert the "bad" data to "good". You then need to go back and see if whether or not it is possible to update the application to prevent the problem happening again.

It's probably going belly-up on the EXPENSE_REQUISITION_DETAIL.From_Date or To_Date column(s).

,CASE(D.Expense_Head_Id) WHEN 12 THEN (CONVERT(VARCHAR(11),D.From_Date,103)+' '+COALESCE(Start_Time,'') +' - ' + COALESCE(End_Time,''))
ELSE (CONVERT(VARCHAR(11),D.From_Date,103)+' '+COALESCE(Start_Time,''))
END AS 'FromDate'

,(CONVERT(VARCHAR(11),D.To_Date,103)+' '+COALESCE(End_Time,'')) AS 'ToDate'
cigwork 3-Jan-15 4:44am View
Have a butcher's at these and all should be a bit clearer.

BTW. A colleague _seems_ to have found a problem on Windows machines with AMD processors not running the new emulator at all; even with hardware acceleration off. I'm increasingly tempted to hold off and wait for SP1/V2.
cigwork 20-Dec-14 5:21am View
Thanks for that. The problem (as I understand it) is that it is no longer going to be a case of preference because The Chocolate Factory is dropping Eclipse as the IDE so it will be A.S. or nothing (chiz chiz). What I'd also like to know, hence the supplementary q., is whether or not A.S. is stable enough for me to make the cut-over now or to hang on a bit. Quite happy to hang on for SP1/V2 of A.S 'cos Android is hobby stuff only for me and I'm not interested in being at the bleeding edge for "fun" stuff; bad enough dealing with it in the day job.
cigwork 5-Sep-14 0:49am View
Check that the account the IIS/ASP process runs under has access to the F:\ drive. "File / Dir not found" exception is quite common (IME) when a process doesn't have sufficient rights.
cigwork 29-Jun-14 3:18am View
I know I can solve this problem in code, I've already done so. Artificial problem? Yes. Where does it say questions on this forum have to be for, "real world problems"? This is an experiment/tutorial exercise to see whether or not XAML lives up to the hype and because it looked like a fun thing to try.
cigwork 18-Apr-14 5:11am View
What about colour analysis? In the UK and those European countries using the Euro the currency notes are of different colours. So one possible solution might be to take the bitmap containing the image of the note and work out its average colour (most non white pixels of a specific colour of all colours found perhaps?) and compare the value with previously determined reference values. If you want to cope with multiple currencies then if reference colour values are grouped by locale it should be possible to offer the most likely identification of a note based on current locale in the case where notes from different countries have the same reference colour.

Something as crude as this should work reasonably quickly without needing a round-trip to the server. You could fall back to a server to request an update of reference colour values should you encounter an average colour value not held locally.

Alternatively you could provide the application with a training mode. Present it with a series of notes and let it work out the reference values for each note for itself. This would take account of vagaries in the image quality of individual device cameras and allow a user (with help from a sighted friend) to set up the app. for any currencies that he or she commonly uses. The application then becomes self supporting.

Of course none of this will work for coins nor for currencies like the U.S. dollar which have notes of a uniform colour.
cigwork 12-Apr-14 15:03pm View
Indeed you could, but the problem is in Access so the query needs to be something that stands a chance of being converted to Access
cigwork 23-Dec-13 16:18pm View
Ahh, you've come to the wrong place mate. You want GCHQ or mebbe the NSA. :)
cigwork 22-Dec-13 16:27pm View
Assuming you are using Eclipse and the Android plug-ins:

Have you tried running this in the emulator rather than directly on the target machine? If you do then the logcat window will (very probably) tell you where you've gone wrong.

If there's nothing showing in logcat wrap the failing code in a try/catch block and in the catch call android.util.Log.e method with the exception info.

catch (Exception e) {
Log.e("MyActivity::MyMethod", e.getMessage());

It's probably a null pointer or other uninitialised variable. It nearly always is for me. :)
cigwork 15-Dec-13 1:28am View
If you need to do something like that then all I can suggest is that you use a Cursor. It will let you process the table a row at a time. Cursors are normally regarded as a last resort solution because they are slow. If your employee table isn't too big then that probably won't be a problem.

Cursors help page.
cigwork 5-Dec-13 14:27pm View
OK I'm stumped too. A quick search on teh interwebs shows you are not alone. This problem has been turning up for a couple of years now.

The link below although for C++/MFC is interesting because its 1st suggestion is to uninstall the acrobat PDF reader. What happens if you try to select files that aren't PDFs? There's also a link to a hotfix that may be of interest.

Another suggestion that seems to be made on a regular basis in the various articles is to get rid of any Windows Explorer shell extensions you may have loaded. It seems that bugs in these can cause this sort of behaviour.

The following links have a work-around which the authors freely admit are a bit smelly.

Unsafe code.
You can mark code as "unsafe" to allow the use of Windows APIs that don't/won't/can't play nicely in .Net's memory managed and garbage collected (or safe) world. AFAIK you can't use the "unsafe" keyword in VB, but if your project references a library DLL written in (say) C# that has unsafe methods then that could be a source of your woes.
cigwork 4-Dec-13 15:04pm View
Does this happen on the very first attempt or only after some random number of attempts? If the latter have you tried calling ofd.Dispose() before exiting the click event handler?

Have tou tried specifying a local path that you know the process will have access to? If that works, check that the process has access to the server path. Perhaps the dlg is trying to do something clever if there's no access and failing?

' Can we see the server directory?
Dim dI As IO.DirectoryInfo = New IO.DirectoryInfo(ofd.InitialDirectory)
Dim fA As io.FileAttributes = dI.Attributes
Catch ex As Exception
' Might get caught. Might not if a security exception is thrown.
End Try
cigwork 28-Nov-13 14:27pm View
If you can't you use two (or more if necessary) sort columns can you concatenate values?
Something like ...

case when name like 'PackageTotal' then '00' else '01' + name end as CombinedSort
from sortTest
order by CombinedSort

myDataView.Sort = "CombinedSort ASC"

If you can't add columns to the result set then perhaps return a single InvoiceItemLevel with a prefix as shown for the CombinedSort above and then (oh this is horrible) use a template column rather than a "plain text" column in your datagrid to display the invoiceitemlevel without the sort prefix
cigwork 5-Nov-13 16:51pm View
Have you tried:
0 - Checking that the target machine has a version of the .Net framework that matches or supersedes the one on your dev. machine?

1 - Building a single "hello world" window/page WPF app and seeing if that will run on a test machine? If it doesn't then you can _probably_ rule out problems in the main app.

If "hello world" runs then have you considered:

2 - Replacing the initial start view/page with a simple "It Lives" with no/minimal property bindings and no additional namespace references?

3 - Checking that any DLLs required/used in the failing start page/window are actually built/installed on the test machine?

4 - Tracing the startup sequence in the Windows Application event log?
cigwork 13-Aug-13 15:11pm View
You can't validate filesize server side this way.

If I remember correctly the HTTP max request is intended to be used as a first line of defence against DOS attacks mounted using large requests. For this reason any request exceeding the server's configured limit will throw an exception before any application code is executed.
cigwork 16-Jul-13 15:02pm View
If the server holding the files can be configured as an FTP server then you can use
WevRequestMethods.Ftp.DownloadFile see:

Have a look at this Code Project article based on framework 2
cigwork 30-Jun-13 5:11am View
Yes, but the multi-byte character encoding schemes used to handle many non-Latin alphabets mean that there isn't necessarily a 1:1 match between a byte (char) and what's painted on the monitor.
cigwork 18-Jun-13 15:07pm View
What is the purpose of the "sOutlet" columns in the stock table? I expect I have misunderstood something, but they don't seem to add anything to the structure you've outlined. If they are just cruft then I'd expect to be able to use something like this...

, branch.[name]
, stockdetail.S15
, stockdetail.S30
from [stockdetail]
inner join [branch]
on [branch].[name] = [stockdetail].[storeID]
inner join [stock]
on [stock].[PID] = [stockdetail].[PID]
and [stock].[disable] = 0
cigwork 9-Dec-12 4:08am View
To share an image I think you will first have to load it to an image sharing site like flickr and then put the URL of the image in your reply or comment.

It would also help if you posted a code fragment showing how you are changing the form's backcolor.