|
I don't use dataadapters or datatables, for me they are legacy. But, how is the command of the dataadapter built?
If you pass a custom SQL to the data-adapter (I really don't know if this is the case), that could be the cause, not the code block you showed here, as here the data adapter already exists.
|
|
|
|
|
All the sudden, the compiler is complaining everywhere I've used the * symbol to multiply "The * or -> operator must be applied to a pointer". I don't even have unsafe code enabled so whats going on?
|
|
|
|
|
Omnicoder wrote: All the sudden, the compiler is complaining everywhere I've used the * symbol to multiply "The * or -> operator must be applied to a pointer".
Your expression is wrong; possibly you are trying to multiply a non-numeric value, or an object that does not have an operator* overload. Maybe if you showed a few lines of code to demonstrate the problem we can give a more definitive answer.
|
|
|
|
|
Even simple things like this break it.
int num1 = 0;
int num2 = 7;
return (num1 * num2);
|
|
|
|
|
How about creating a new very simple project with just the above three lines in one function. I am sure it will work. Somewhere in your program * messed up something.
|
|
|
|
|
Assuming that this is an entire project then I guess something is corrupt in your compiler or your system include files, but it's impossible to say what.
|
|
|
|
|
Omnicoder wrote: whats going on?
You probably have a better chance of figuring that out, unless you would have the extravagance of showing the relevant code.
An extremely wild guess: somehow you lost an operand or inserted a '*' and now have two consecutive operators (as in a+*b, or a=*c)
|
|
|
|
|
I posted an example in my reply to the other answerer.
|
|
|
|
|
if your observations are correct, your IDE must be ill. Try closing and reopening it. If need be, try a reboot too. If that doesn't help, give us specifics: which OS, which IDE, and a small but actual code snippet.
|
|
|
|
|
It seems to be local only to one project, so it must be a setting somewhere...
|
|
|
|
|
I don't know any setting that would cause that.
I suggest you create a new project, move your source files (mainly the *.cs; and not the csproj and other specials) into it, try to build. If that works, delete the files (csproj and specials) you did not copy.
|
|
|
|
|
Hi,
I need help to create a colon delimited arbitrary length subfolder-ranging string based on a value. That probably makes little sense, so to demonstrate:
Value: 194356
I was hoping for a function that could take in some arbitrary 'template' definition like this:
##0000 - ##9999:####00 - ####99
and the above Value
and return something like this:
190000 - 199999:194300 - 194399
Likewise, if the 'template' were defined as:
###000 - ###999 ,
the following would be returned
194000 - 194999
and an even more finely detailed 'template':
#00000 - #99999:##0000 - ##9999:###000 - ###999:####00 - ####99:#####0 - #####9
would return:
100000 - 199999:190000 - 199999:194000 - 194999:194300 - 194399:194350 - 194350.
It also needs to work for different Value lengths, eg:
Value: 5455
'Template':
##00 - ##99
returns
5400 - 5499
The value, and the ranges, always have the same number of digits. I could easily hardcode this definition, but for reasons explained below, I don't want to do that.
Purpose (for any other ideas on how to do what I need to do):
Our Peoplesoft system generates PDF report files into a shared UNC folder. These have the filename: 000#######_<vendorname>.pdf where the 6 hashes represent a 6-digit numeric Vendor ID. I have to upload these files into our OpenText Livelink DM system. The definitions for the upload process (source path, destination, etc.) come from a custom XML file. The need for the sub folders arises from the fact that Peoplesoft generates 100's of reports per week - and shoving them into a single folder in Livelink is not acceptable to the users. If they could drill down by range, they would be happy.
Peoplesoft actually generates different types of report files in different places (Purchase orders, RFPs, etc). Some of these need more fine-tuned filing into subfolders, some do not - hence the need for a generic subfolder creating function.
I appreciate any help with this. If any more information is needed, I should be pretty speedy with the responses.
Adam
|
|
|
|
|
Not too tricky... Just break it into a few steps, assuming a standard format:
1) Split the template by the colon, and process each part individually
2) In case you want to vary the arrangement a little, use a RegEx to break down the string, finding occurrences of "#+[0-9]*"
3) For each of those patterns, find the number of digits (Assuming it'll always be a suffix-type thing), and divide the number by that power of 10 and truncate it. For example, if it was ##9 (1 digit), you'd divide by 10^1 and chop off the fractional component.
4) Replace the ## part with the resulting number
Technically you don't have to do any real calculations or test ranges, so this is just pattern matching and string replacement.
|
|
|
|
|
 Here's a little Extension Method to do that. It uses a Regular Expression to find the templates, formats the value, and performs replacements.
I assumed you wanted to SPACE-pad the value, but you could change it.
public static class Junk
{
private static readonly System.Text.RegularExpressions.Regex reg ;
private static readonly System.Collections.Generic.Dictionary<string,string> dic ;
static Junk
(
)
{
reg = new System.Text.RegularExpressions.Regex
(
"(?'Template'(?'Pattern'#+)(?:(?'Fill'0+)|(?'Fill'9+)){0,1})"
) ;
dic = new System.Collections.Generic.Dictionary<string,string>() ;
return ;
}
public static string
ApplyTemplate
(
this int Value
,
string Template
)
{
lock ( dic )
{
foreach
(
System.Text.RegularExpressions.Match mat
in
reg.Matches ( Template )
)
{
string tem = mat.Groups [ "Template" ].Value ;
if ( !dic.ContainsKey ( tem ) )
{
string pat = mat.Groups [ "Pattern" ].Value ;
string fil = mat.Groups [ "Fill" ].Value ;
string temp = Value.ToString().PadLeft ( pat.Length + fil.Length ) ;
temp = temp.Substring ( 0 , temp.Length - fil.Length ) + fil ;
dic [ tem ] = temp ;
}
}
foreach
(
System.Collections.Generic.KeyValuePair<string,string> repl
in
dic
)
{
Template = Template.Replace ( repl.Key , repl.Value ) ;
}
dic.Clear() ;
}
return ( Template ) ;
}
}
|
|
|
|
|
Hi All
I am struggling to make a regular expresssion for the password policy.
There are only two requiremnts for the password policy
1. Password should of length atleast 6
2. password must contain atleast two characters at any position.
Match cases(for which regex should pass) are
1. rt5465465
2. 6556h76f
3. 76d12j
4. s45)$f
Cases for which regex should fail are
1. w565765
2. 872310
3. 4r@%&9
4. gghj
The regex whixh I have made so far are in the below code
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Text.RegularExpressions;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
//Regex regex = new Regex("(.*[a-zA-Z].*[a-zA-Z])");
// Regex regex = new Regex("(?(^(?=.+[a-zA-Z$#%^&*()!@~+]){6,}))(?(.*[a-zA-Z].*[a-zA-Z]))(.{6,})");
Regex regex = new Regex("(^[.]*${6,})");
//Regex regex = new Regex("([a-zA-Z0-9]{6,})");
//Regex regex = new Regex("(?(?=[.]{6,})(.*[a-zA-Z].*[a-zA-Z])([Z][9][4][M][P]))");
// Regex regex = new Regex("(?(^(?=.+[a-zA-Z$#%^&*()!@~+]){6,}))(.*[a-zA-Z].*[a-zA-Z])");
// Regex regex = new Regex("(?(?=[0-9]{5,5}[a-z])([6])([1]{5,5}))");
// Regex regex = new Regex("(?(?=[0-9]{5,5}[a-z])()([1]{5,5}))");
//Regex regex = new Regex("(?(?=[a-zA-Z0-9]{6,})()(([1])([1])([p])))");
string s = textBox1.Text;
if (regex.IsMatch(s))
{
MessageBox.Show("pass");
}
else
{
MessageBox.Show("fail");
}
}
}
}
Please help
Thanks
Regards
Sandeep
|
|
|
|
|
Hi,
I wouldn't know with Regex; this is what I would do:
public bool IsValidPassword(string s) {
if (s==null || s.Length<6) return false;
int nLetters=0;
foreach(char c in s) if (Char.IsLetter(c)) nLetters++;
return nLetters>=2;
}
And someone is bound to come up with some more modern approach, probably using LINQ.
BTW: I don't think your criteria are alright; I would also require at least 2 non-letters.
|
|
|
|
|
I need RegEx for this.
Actually there is a web part (which is implemented using usercontrol) whose compiled dll is in GAC
The designer code is in file. In web part username and paasword textbox is there
There is also a login button on which the event which is in compiled assembliy in GAC get fired
I cannot write code.I know its easy using code
I am putting a regular expression validator in the designers code.So only through Regex things can be done
Please help
Thanks
Regards
THE SK
|
|
|
|
|
THE SK wrote: 2. password must contain at least two characters at any position.
Only Chuck Norris' passwords can do this.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
I are Troll
|
|
|
|
|
Hello everyone. I have been struggling with learning how to program. I live in Alaska and there are not many classes I am able to attend. I would love to find Instructor led classes in my area (Anchorage) the other alternative is Online Classes. I have been reading books and Watching Videos from VTC. I have learned some but I want to be the best I can. Any help on how I can really learn C#, .NET, PHP, XML, SQL, would be great Help. Thanks
Shannon
|
|
|
|
|
If you can't get classes, then:
1) Read books, and do the exercises.
2) Try to find someone else in your area interested in the same thing.
And above all else:
3) Practice. Try it. Try it again. Do it some more. The very best way to learn is to try it yourself. Also, when you have a little confidence, try answering some of the questions here. You don't need to post your answer, but it can help to focus your mind on a problem!
Enjoy - it's a load of fun, too!
All those who believe in psycho kinesis, raise my hand.
|
|
|
|
|
Come up with something you want to do on your computer, and write a program to do it. Google is your friend.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
John Simmons / outlaw programmer wrote: Google is your friend
It's not mine. Ever since I caught it having it away with the toaster, it's banned from my door.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
you're jealous of your toaster? what got into you today?
|
|
|
|
|
John Simmons / outlaw programmer wrote: Google
Who?
|
|
|
|