|
hammerstein05 wrote: Code Obfuscators
I second that. I've seen the one from RustemSoft actually make Reflector crash when doing a very aggressive obfuscation.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
As in the one reply you got, I'd second hammerstein's suggestion of looking into an obfuscater. Though they are not 100% effective, they do make it difficult to reverse engineer your code.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
I agree. I know many of the people I work with should be embarrassed by their work and should not want people to see it. Obfuscation is a good way to hide that embarrassing source code. ;)
led mike
|
|
|
|
|
funny !
|
|
|
|
|
|
Hey guys, im having trouble figuring the ContextMenu out.
Im trying to use it on a WPF control, a calender / roster. When the user right clicks a cell that reperesents the days the context menu pops up with a list of all the shifts, when the user selects one the properties of that cell and the control must change.
my ContextMenu already gets populated, im just having trouble to figure out which entry in the context menu was clicked on. Which event do i use for it?
any ideas?
thanx
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.passion != Programming)
|
|
|
|
|
Harvey Saayman wrote: Im trying to use it on a WPF control,
plase put it on WPF Forum. you will get better answer there !!
cheers,
Abhijit
|
|
|
|
|
its not a WPF issue...
i was only trying to give as much info as possible
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.passion != Programming)
|
|
|
|
|
It depends on how you're adding them. I've never tried it in WPF so I'm not sure.
In winforms, there are several ways but probably the most WPF like is to use the ContextMenu's ItemClicked event and use the properties of e to determine which item it was.
Hope it helps - if not, post your code that you use to create the menu.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Expect everything to be hard and then enjoy the things that come easy. (code-frog)
|
|
|
|
|
i cant find any events that give me the info i need as args. i dont seem to have ItemClicked either. Im using System.Windows.Controls.ContextMenu
in the code behind file, i got this so far...
ContextMenu myContextMenu;
private void Border_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
{
foreach (CellContent cell in Cells)
{
if (((Border)sender).Name == cell.CellBorder.Name)
{
myContextMenu = new ContextMenu();
myContextMenu.Items.Add("Day Off");
myContextMenu.Items.Add("-");
ShiftCtxDataContext shiftCtx = new ShiftCtxDataContext(sqlConnString);
var queryResult = (from myShifts in shiftCtx.Shifts
select myShifts.SHF_Name_VC30);
foreach (var item in queryResult)
{
myContextMenu.Items.Add(item.ToString());
}
myContextMenu.IsOpen = true;
}
}
}
any ideas?
Thanx
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.passion != Programming)
|
|
|
|
|
By adding a MenuItem instance rather than just a string you can do it this way
using System;
using System.Windows;
using System.Windows.Controls;
namespace WpfApplication1
{
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
System.Windows.Controls.ContextMenu cm = new ContextMenu();
MenuItem item = new MenuItem();
item.Header = "test";
item.Click += new RoutedEventHandler(item_Click);
cm.Items.Add(item);
this.ContextMenu = cm;
}
void item_Click(object sender, RoutedEventArgs e)
{
MenuItem item = (MenuItem)sender;
Console.WriteLine(item.Header);
}
}
}
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Expect everything to be hard and then enjoy the things that come easy. (code-frog)
|
|
|
|
|
Thanx dave,
ill have a look and let you know how it goes
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.passion != Programming)
|
|
|
|
|
I have a challenge to you all!
I have found a strange (and really annoying!!) behavior when trying to databind a combobox to a property witch is pointing to an interface.
I have the following interface and class:
IPerson.cs:
public interface IPerson
{
string Name { get; set; }
}
Person.cs:
public class Person : IPerson
{
public Person(string name)
{
Name = name;
}
public string Name { get; set; }
public override string ToString()
{
return Name;
}
}
Then I have a form witch contains one ComboBox (comboBox1) and one TextBox (textBox1). The Form1.cs looks like this:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
this.CurrentPerson = new Person("Person 1");
comboBox1.Items.Add(this.CurrentPerson);
comboBox1.Items.Add(new Person("Person 2"));
comboBox1.Items.Add(new Person("Person 3"));
comboBox1.Items.Add(new Person("Person 4"));
comboBox1.DataBindings.Add("SelectedItem", this, "CurrentPerson");
textBox1.DataBindings.Add("Text", CurrentPerson, "Name");
}
public IPerson CurrentPerson { get; set; }
}
Now to the strange part. If you run the application, change the combobox to "Person 2", and focus the textbox so that the databinding should be triggered, you will see that the combobox is reset to "Person 1"! Why isn't the CurrentPerson changed to "Person 2" instead?
If you let CurrentPerson be a Person, not an IPerson, everything works just fine.
And one more thing... If you add a SelectedIndexChanged event to the combobox, and let it do the databinding, you will find that it is impossible to change the selected item!
Code:
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
Console.WriteLine("Before: Combo:" + comboBox1.SelectedItem.ToString() +
", Current Person: " + CurrentPerson.ToString());
comboBox1.DataBindings[0].WriteValue();
Console.WriteLine("After: Combo:" + comboBox1.SelectedItem.ToString() +
", Current Person: " + CurrentPerson.ToString());
}
If you try to change the selected item from "Person 1" to "Person 3", you get this output:
Before: Combo: Person 3, Current Person: Person 1<br />
Before: Combo: Person 1, Current Person: Person 1<br />
After: Combo: Person 1, Current Person: Person 1<br />
After: Combo: Person 1, Current Person: Person 1<br />
Expected would be:
Before: Combo: Person 3, Current Person: Person 1<br />
After: Combo: Person 3, Current Person: Person 3
Anyone have any clue what I can do to make this work? (Besides doing the binding manually, of cource...)
Thanks in advance!
|
|
|
|
|
I must admit I haven't tried this, but from what I see the textbox is always bound to the object refered to by CurrentPerson at the time of binding. Are you sure that the text values in the dropdown aren't changing as a result of the text in the textbox being pushed back into the new CurrentPerson?
I'm largely language agnostic
After a while they all bug me
|
|
|
|
|
Thanks for answering!
Yes, I am sure that is not the case. The textbox is just there so I have something else to give focus to. The only reason this is databound, is for testing purpose. (That databinding actually works as it should.) My original case was without the textbox.
It seems that the problem occures when the databinding object tries to set
CurrentPerson = (IPerson)comboBox1.selectedItem;
(or whatever syntax the databinding use.) If I implement this line of code when selected item is changed, it all works just fine.
Any other ideas? I am really stuck here
|
|
|
|
|
Problem solved! (At least workaround found...)
If you are interested in the solution, take a look at http://www.devexpress.com/Support/Center/p/Q182427.aspx
|
|
|
|
|
Hi
i use this code to iterate through each procedure in current database :
foreach (Microsoft.SqlServer.Management.Smo.StoredProcedure sp in server.Databases[database].StoredProcedures)
{
if(!sp.IsSystemObject)
sps.Add(sp.Name);
}
but when i add if(!sp.IsSystemObject) statement, my app hangs and crash. why this problem occurs and how to solve it?
thanks
|
|
|
|
|
Try with else instead of !
if(sp.IsSystemObject) // this line
{
}
else
{
sps.Add(sp.Name);
}
pls let me know the result
Thanks
Raja.S
|
|
|
|
|
Thanks Raja
i test your code, but my app has still crash.
|
|
|
|
|
is that showing the exception or just closing the application if possible can you give me the stack trace ?
Thanks
Raja.S
|
|
|
|
|
not any exception, just crash, here is my source code to explore what is my method:
private void GetDatabaseSps(TreeView tree, TreeNode spsNode, string sqlServerInctance)
{
List<string> sps = new List<string>();
string database = spsNode.Parent.Text;
Microsoft.SqlServer.Management.Smo.Server server = new Microsoft.SqlServer.Management.Smo.Server(sqlServerInctance);
foreach (Microsoft.SqlServer.Management.Smo.StoredProcedure sp in server.Databases[database].StoredProcedures)
{
if (sp.IsSystemObject)
{
}
else
{
sps.Add(sp.Name);
}
}
spsNode.Nodes.Clear();
foreach (string str in sps)
{
TreeNode spNode = new TreeNode(str);
spsNode.Nodes.Add(spNode);
}
}
|
|
|
|
|
Can you tell me ,is this happening with SQL 2005 with SP2 and also visual studio 2003 or 2005 ?
Thanks
Raja.S
|
|
|
|
|
hai all ,
we used below method for get the image data from database,it is working fine in desktop computers ,but it is not working in laptops.it is showing below error only in laptops.
Error Message:
out of memory:at System.image.fromfile(string filename,boolean useembeddedcolormanagement) at System.Drawing.image.fromfile(String Filename)
Please help me.
public void getimages()
{
bigImgLst_Vendors.Images.Clear();
smallImgLst_Vendors.Images.Clear();
string path;
path = Path.GetDirectoryName(
Assembly.GetExecutingAssembly().GetName().CodeBase);
path = path.Replace("\\bin\\Debug", @"\Transaction\Contacts\Photos");
path = path.Replace("file:\\", "");
string imageDirectoryPath = path;
string[] files = null;
if (Directory.Exists(imageDirectoryPath))
files = Directory.GetFiles(imageDirectoryPath);
if (files != null)
if (files.Length > 0)
for (int i = 0; i <= files.Length - 2; i++)
if (File.Exists(files[i]))
{
//foreach (ListViewItem vcontext in lvw_VendorList.Items)
//{
//if(vcontext.Tag == (files[i].Split('\\'))[files[i].Split('\\').Length - 1])
bigImgLst_Vendors.Images.Add((files[i].Split('\\'))[files[i].Split('\\').Length - 1],
Image.FromFile(files[i]));
smallImgLst_Vendors.Images.Add(
(files[i].Split('\\'))[files[i].Split('\\').Length - 1], Image.FromFile(files[i]));
//}
}
int imageIndex = -1;
int NoImageIndex = 0;
NoImageIndex = bigImgLst_Vendors.Images.IndexOfKey("NoImage.png");
lvw_VendorList.LargeImageList = bigImgLst_Vendors;
lvw_VendorList.SmallImageList = smallImgLst_Vendors;
lvw_VendorList.StateImageList = smallImgLst_Vendors;
foreach (ListViewItem vcontext in lvw_VendorList.Items)
{
if (vcontext.Tag != null)
if (vcontext.Tag.ToString().Trim() != "")
imageIndex = bigImgLst_Vendors.Images.IndexOfKey(vcontext.Tag.ToString());
if (imageIndex != -1)
vcontext.ImageIndex = imageIndex;
else
vcontext.ImageIndex = NoImageIndex;
imageIndex = -1;
}
}
|
|
|
|
|
It has nothing to do with Laptop or Desktop.
I also had to write code that generating thumbnails some time ago. .NET throws OutOfMemoryException if it does not recognize the image format.
This happen for example when loading the image file whose format is unreconized/unsupported by .NET. Methods might raise this exception
include Image.FromFile, Bitmap constructor, etc, see their "remark" section. You should debug your app to see if it is the cause.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Correction to my previous post.
I have created a windows application.
There are forms inside the windows form application project. There is a class library project too.
The .sln is in the following path:
C:\Work\Developments\SQLchecks\SQLchecks
The windows forms are inside the windows application project as below:
C:\Work\Developments\SQLchecks\SQLchecks\SQLchecks
There is a class library project called DataAccess which has classes and an xml file called Settings.xml :
C:\Work\Developments\SQLchecks\SQLchecks\DataAccess
Question:
from within a class inside the DataAccess project which is a class library project, how do I refer to the Settings.xml file which is also in the same directory?
Thanks
|
|
|
|