|
Hi
I An application built with vs2013. And setup file with installshield le from vs2013 did create.
After installing the app when I click on the desktop shortcut application that gives this error:
unable to open the physical file
"c:\Windows\system32\database.mdf".Operating system error 2:
"2(The system cannot find the file specified.)"
changed database context to 'master'
Please help to solve this error
|
|
|
|
|
mahdiiiiyeh wrote: "2(The system cannot find the file specified.)" What part of that message do you not understand?
|
|
|
|
|
|
OK, and what do you still not understand about "file not found"?
|
|
|
|
|
Start by checking the connection strings: they are either wrong or very badly designed.
You should not keep database in Window system folders: they are not supposed to be accessible to the general user, and certainly shouldn't be writable without app elevation.
At a guess, you have hard coded connections strings which don't specify a path, just a file name - so the "current directory" is used, and that happens to be the System32 folder.
But without your code, that's as specific as we can be.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Thanks for the reply.
but ,I do not save the database in the Window system folders.
Database in the installation path.
"C:\Program Files (x86)\test\My Product Name\database.mdf"
the problem is that field "start in" in properties shortcut is empty.
Uploadfiles.io - untitled1.png[^]
I copied installation location in the field and fixed.
("C:\Program Files (x86)\test\My Product Name)
Now,What is your suggestion?
modified 8-Apr-17 6:37am.
|
|
|
|
|
Of course it's empty! That's why it's a problem ... and why it's looking in the "current" folder and getting Windows/System32. Ignore that.
Start by moving the database to a proper location - that one will give you problems as it isn't writable for most users. Move it to a "Data" folder - Where should I store my data?[^] will help - and use that location instead.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
To solve the problem of empty "start in" field
in vs2013->solution Explorer->Project setup1->Configure the target system->shortcuts/folders->
working directory ->[INSTALLDIR]
Uploadfiles.io - untitled2.png[^]
thank you very much for reply
|
|
|
|
|
Do not put your database in the installation directory: that's read only on many systems, and likely to get more strictly enforced in future to prevent virus activity.
Move it to a data folder!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
using a data mining technique means how form cluster.plz can u send me a source code for this
|
|
|
|
|
It doesn't quite work like that.
We do not do your work for you.
If you want someone to write your code, you have to pay - I suggest you go to Freelancer.com and ask there.
But be aware: you get what you pay for. Pay peanuts, get monkeys.
The idea of "development" is as the word suggests: "The systematic use of scientific and technical knowledge to meet specific objectives or requirements." BusinessDictionary.com[^]
That's not the same thing as "have a quick google and give up if I can't find exactly the right code".
So either pay someone to do it, or learn how to write it yourself. We aren't here to do it for you.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Which hospital are you working for? I just want to know so that I make a point to never end up there.
|
|
|
|
|
The basic version of the algorithm is really very simple.
- guess k points that might be means of clusters. It matters how you do it, a simple trick is just pick some random samples.
- classify your data using the current means
- compute the means of the clusters thus formed, make them the new means
- repeat until it stops changing
- repeat all of the above with new initialization until you like the results (the update step gets caught in local minima)
These are all steps that anyone who can write code should be able to implement from scratch, there's nothing crazy in there.
|
|
|
|
|
I have the following:
MyService service = new MyService();
_services.Add(service);
Task.Factory.StartNew(() =>
{
service.Start();
}, service.CancellationTokenSource.Token)
.ContinueWith(task =>
{
switch (task.Status)
{
case TaskStatus.RanToCompletion:
AddStatus(string.Format("Service '{0}' completed", task.Id));
RemoveSelectedService(task);
break;
case TaskStatus.Canceled:
AddStatus(string.Format("Service '{0}' cancelled", task.Id));
RemoveSelectedService(task);
break;
case TaskStatus.Faulted:
AddStatus(string.Format("Service '{0}' errored", task.Id));
break;
}
});
In the ContinueWith how do I get a reference to the 'service' class?
Thanks
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
Return it and pick it up from the task Result.
This space for rent
|
|
|
|
|
Return it from itself?
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
If it works similar like a thread, then you can pass an object as a parameter; according to MSDN there is indeed an overload that provides exactly that.
Task.ContinueWith Method (System.Threading.Tasks)[^]
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Either return it from the StartNew lambda and pick it up from the result, as Pete suggested:
Task.Factory.StartNew(() =>
{
service.Start();
return service;
}, service.CancellationTokenSource.Token)
.ContinueWith(task =>
{
var service1 = task.Result;
...
});
Or, since you're using a lambda method, you can reference it using the closure, in the same way as the StartNew delegate:
Task.Factory.StartNew(() =>
{
service.Start();
}, service.CancellationTokenSource.Token)
.ContinueWith(task =>
{
service.DoSomethingElse();
...
});
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
i understand the both factory and factory method pattern. in factory pattern we create instance of my classed by another class function dynamically where i pass some parameter to another class function and based on that parameter another class function return right instance of class.
in factory method pattern we have to proceed one further step. in factory method pattern subclass create instance of my class. i do not find a scenario where people has to go for factory method pattern. so please some one come with a scenario where normal factory pattern will not be used rather people prefer to use factory method pattern.
here i am posting two set of code first one done by factory pattern and second one done by factory design pattern
1st set of code where factory pattern used
public enum Shipper
{
UPS = 1,
FedEx = 2,
Purolator = 3
}
public interface IShip
{
void Ship();
}
public class ShipperPurolator : IShip
{
public void Ship()
{
MessageBox.Show("Purolator ship start");
}
}
public class ShipperUPS : IShip
{
public void Ship()
{
MessageBox.Show("UPS ship start");
}
}
public class ShipperFexEx : IShip
{
public void Ship()
{
MessageBox.Show("FedEx ship start");
}
}
public class ShipperFactory
{
public static IShip CreateInstance(Shipper enumModuleName)
{
IShip objActivity = null;
switch (enumModuleName)
{
case Shipper.UPS:
objActivity = new ShipperUPS();
break;
case Shipper.FedEx:
objActivity = new ShipperFexEx();
break;
case Shipper.Purolator:
objActivity = new ShipperPurolator();
break;
default:
break;
}
return objActivity;
}
}
Calling this way
IShip objActivity = null;
private void btnUPS_Click(object sender, EventArgs e)
{
objActivity = ShipperFactory.CreateInstance(Shipper.UPS);
objActivity.Ship();
}
private void btnFedEx_Click(object sender, EventArgs e)
{
objActivity = ShipperFactory.CreateInstance(Shipper.FedEx);
objActivity.Ship();
}
private void btnPurolator_Click(object sender, EventArgs e)
{
objActivity = ShipperFactory.CreateInstance(Shipper.Purolator);
objActivity.Ship();
}
now same thing done by factory method pattern where i have to write more code to get the job done
public interface IShip
{
void Ship();
}
public class ShipperPurolator : IShip
{
public void Ship()
{
MessageBox.Show("Purolator ship start");
}
}
public class ShipperUPS : IShip
{
public void Ship()
{
MessageBox.Show("UPS ship start");
}
}
public class ShipperFedEx : IShip
{
public void Ship()
{
MessageBox.Show("FedEx ship start");
}
}
public interface IShipFactory
{
IShip GetShipper();
}
public class ShipperFexExFactory : IShipFactory
{
public IShip GetShipper()
{
return new ShipperFedEx();
}
}
public class ShipperUPSFactory : IShipFactory
{
public IShip GetShipper()
{
return new ShipperUPS();
}
}
public class ShipperPurolatorFactory : IShipFactory
{
public IShip GetShipper()
{
return new ShipperPurolator();
}
}
calling like this way
IShipFactory _IShipFactory = null;
private void btnUPS_Click(object sender, EventArgs e)
{
_IShipFactory = new ShipperUPSFactory();
_IShipFactory.GetShipper().Ship();
}
private void btnFedEx_Click(object sender, EventArgs e)
{
_IShipFactory = new ShipperFexExFactory();
_IShipFactory.GetShipper().Ship();
}
private void btnPurolator_Click(object sender, EventArgs e)
{
_IShipFactory = new ShipperPurolatorFactory();
_IShipFactory.GetShipper().Ship();
}
please tell me a solid scenario when people feel right to choose factory method pattern. thanks
tbhattacharjee
|
|
|
|
|
|
He doesn't like reading: it makes it difficult to be a Help Vampire.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
It's like a stake through the heart.
This space for rent
|
|
|
|
|
Quote: He doesn't like reading
Yeah, and that is exactly why a few days ago I failed to understand his thread on hashing/encryption collected 30+ replies.
|
|
|
|
|
It surprised me as well. Granted, I did reply - but that was to warn people that he was a Help Vampire.
This space for rent
|
|
|
|
|
In our collective defence, most of 'em were to Gerry - who was trying to defend the indefensible without knowing anything about what he was saying.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|