I was wondering if there is easy solution to this or I'm stuck with following:
When updating DB:
dti.Pass = Crypter.Encrypt(dti.Pass);
_db.SubmitChanges();
When selecting from DB:
Data.DbTableItem dti = _db.Single(a=a.Id == id);
dti.Pass = Crypter.Decrypt(dti.Pass);
Meaning - I am not really into writing repetitive code and this seems like logical thing to be supported by LINQ; so I'm wondering if it is.
How do guys suggest to share a constants file between PHP and JavaScript, in order not to repeat code? XML file? I am assuming mixing up javascipt inside PHP would not be the right solution!? Thanks
Lets say I have a integer result and an array of integers, lets say [a,b,c] (not a fixed length). I need to detect if result=a*i +b*j + c*k, with i,j,k=0.
I prefer a solution in C/C# if it is possible.
PS The problem is from a reservation system, a trip can be sold if its durations is a combination of given durations.
Thanks!
Given the following function:
def foo(a, b, c):
pass
How would one obtain a list/tuple/dict/etc of the arguments passed in, without having to build the structure myself?
Specifically, I'm looking for Python's version of JavaScript's arguments keyword or PHP's func_get_args() method.
What I'm not looking for is a solution using *args or **kwargs; I need to specify the argument names in the function definition (to ensure they're being passed in) but within the function I want to work with them in a list- or dict-style structure.
Besides the service.StartType = ServiceStartMode.Automatic my service does not start after installation
Solution
Inserted this code on my ProjectInstaller
protected override void OnAfterInstall(System.Collections.IDictionary savedState)
{
base.OnAfterInstall(savedState);
using (var serviceController = new ServiceController(this.serviceInstaller1.ServiceName, Environment.MachineName))
serviceController.Start();
}
Thanks to ScottTx and Francis B.
Hello,
if you have a function "test a b" which returns true if a and b are connected directly and if you have a given unordered list of things, what would be an elegant and fast solution to filter all connected things from given list?
Example:
let test a b = let diff = a - b in diff == 0 ;;
let lst = [4;1;7;3;8;9;2;0] ;;
filter_connected 2 lst ;;
- [4;1;3;2;0]
Any hints?
Hi,
I'm looking for a tool to enumerate all methods and properties on an activeX binary.
Right now, my solution consists in adding the activeX as a reference in a VB6 project, then use the object explorer (F2).
Is there anything quicker than that?
Ms ActiveX Control Pad isn't an option, as it's far less usable than the VB IDE.
Thanks
I would like the compiler to detect all non-localized strings in my solution. This means any string in an .aspx or .cs file that doesn't come from a resource file.
The weird thing is If there is a javascript onClick() on a button, postback works otherwise, there is no postback. This was working very recently. I am not sure what recent changes made to the application made this happening throughout the site. The solution suggested by this link does not work as well (that link is applicable to .NET 1.1 though). Any idea whats going on?
Hi everybody,
I have a display problem when I try to use a ajax combobox inside a tab control:
when my tab control loads on the page where the combobox is, everything works fine; however, if it loads on a another page, the you change to the page which contains the combobox, the right button (which opens the list of the combobox) isn't displayed at all.
Has someone been through this behavior? And maybe found a solution ?
Thanks in advance !
Not that I would want to use this practically (for many reasons) but out of strict curiousity I would like to know if there is a way to reverse order a string using LINQ and/or LAMBDA expressions in one line of code, without utilising any framework "Reverse" methods.
e.g.
string value = "reverse me";
string reversedValue = (....);
and reversedValue will result in "em esrever"
EDIT
Clearly an impractical problem/solution I know this, so don't worry it's strictly a curiosity question around the LINQ/LAMBDA construct.
lets say i have a method which has two parameters. i have been implementing them as:
if(aObj instance of Marble) {
if(bObj instance of Bomb) {
this.resolve((Marble)aObj,(Bomb)bObj);
}
}
as you can see its not a very pretty solution. i plan to implement using double dispatching, but with two parameters which both need double dispatching, im afraid im a bit stumped. any ideas please.
im implementing in java btw.
Is there anyway to find the month difference in php? I have the input of from date 2003-10-17 and todate 2004-03-24. I need the results how many month is there within these two days. Say if 6 months, i need the output in months only. Thanks for guide me for day difference.
I find the solution through mysql but i need in php. Anyone help me, Thanks in advance.
Inspired by Raymond Chen's post, say you have a 4x4 two dimensional array, write a function that rotates it 90 degrees. Raymond links to a solution in pseudo code, but I'd like to see some real world stuff.
[1][2][3][4]
[5][6][7][8]
[9][0][1][2]
[3][4][5][6]
Becomes:
[3][9][5][1]
[4][0][6][2]
[5][1][7][3]
[6][2][8][4]
Update: Nick's answer is the most straightforward, but is there a way to do it better than n^2? What if the matrix was 10000x10000?
Hello
Is it possible to call functions from class like this:
$class = new class;
$function_name = "do_the_thing";
$req = $class->$function_name();
Something similar solution, this doesn't seem to work?
Martti Laine
I'm trying to compare two entries in a database, so when a user makes a change, I can fetch both database entries and compare them to see what the user changed, so I would have an output similar to:
User changed $fieldName from $originalValue to $newValue
I've looked into this and came accross array_diff but it doesn't give me the output format I need.
Before I go ahead and write a function that does this, and returns it as a nice $mtextFormatDifferenceString, can anyone point me in the direction of a solution that already does this?
I don't want to re-invent the wheel..
Hello,
I must cleanup some HTML code to remove <style> and <link> tags inside the <body> tag.
I'm already using PHP Tidy to do some cleanup but I did not found how to remove those tags with PHP Tidy.
Do you have a solution ? Or maybe another markup cleaner PHP class...
Hi to all,
i'm not a VB programmer but i need a vbscript that convert image file (from local disk) to be converted to binary data and the passed to webservice. I realize how to pass data to webservice but i can't find how to convert the image file to binary data. I spend a lot of time to find some kind of solution but with no luck.
Can somebody help me?
Thanks!
I have prepared a Silverlight application and my database is in the server. Its running smoothly for small set of data but for large data set giving an error : Remote Serve returned an error:notFound. How can i resolve it,please any one solve this problem.
I have build it in ASP.NET with C#. So kindly provide the solution in C# if possible.
pdb and winpdb both seem to be missing this essential (to me) feature. I saw something suggesting WingIDE has it but I'd prefer a solution that is free, and if I do have to pay, I'd prefer to pay for something that is better than Wing.
Hey everybody,
I just recorded some song and cut it into two parts. The first part contains an intro and the second is supposed to loop. What I want to do now, is to have a simple graphical animation (5 keyframes or so) that loops as well, while the music plays along.
There's probably a simple solution to it, when you're familiar with AS. Unfortunately this is the first thing I've ever tried to do with Flash.
I'm using Flash CS4.
Greetings
Hi there.
Im sure the solution is simple but I cant figure it out :(
I need to combine two jquery selectors in one selector:
$(this) + $('input[type=text]:first')
$(this) is e.g div#selected so the result should be:
$('div#selected input[type=text]:first').focus();
How to do?
I'm trying to get the same result of a .NET application (see the link Hide TabControl buttons to manage stacked Panel controls for details), but using the MONO runtime instead of the MS .NET runtime.
Pratically, when the custom control is executed using the MONO runtime, the underlying message is not sent to the control, causing the tab pages to be shown...
There is a portable solution which is elegant as the linked one? If it is not possible, what are possible workarounds (apart from removing/adding tabs at runtime)?