gusano79 247 Posting Shark

I assume that I shouldn't have to RE-LEARN WCF for each version of Visual Studio.

I agree... it shouldn't be that different. And it hasn't been, in my experience.

What it seems is that the code for VS 2005 would not work in VS 2008. I'm wondering why?

So are we. What does "not work" mean? Does your code fail to build, or just behave badly? Can you provide specific error messages?

gusano79 247 Posting Shark

It's hard to provide specific advice without knowing what the client's true needs actually are, but here's a start:

If we do a plugin in our WP app its service can accessible to other systems through web service.

I can found that putting a file in WP installation can call the plugin function

If you need to provide a Web service, write it using a Web service framework. Wordpress is a blogging/content management platform, not a general-purpose application platform; it's not an appropriate vehicle for a Web service.

If you need to write a Wordpress plugin that uses this service, do just that. Don't try to combine them; that's asking for trouble. Write the service separately, and write the plugin to connect to the service just like any other service client.

need to tackle the database related connectivity etc

That's certainly true of the service... do you have specific questions about data access?

gusano79 247 Posting Shark

Just turn the number into a String, pump that into a StringBuilder, and call reverse() on it.

Why the round trip? Seems more efficient to just use the StringBuilder to build it in the first place.

gusano79 247 Posting Shark

The command object doesn't know what connection to use. You should use the MySqlCommand constructor that takes a MySqlConnection parameter.

gusano79 247 Posting Shark

use power fuction
now use this

A little overcomplicated; twice as many divisions. Your original loop is a more traditional way to get digits, I think.

partition a number into its figures recursively

A good illustration of recursion and how it uses the call stack, but I wouldn't accept this in "real" code.

this program prints the splited integers in revers order

My suggestion: Don't print the digits immediately. Instead, use a StringBuilder to collect the digits as you determine what they are. Two ways you can get the right order:

  1. Append the digits, then reverse the StringBuilder afterward.
  2. Insert the characters at the beginning of the StringBuilder (index 0).

Either way, then call the StringBuilder's toString method to get something you can print.

gusano79 247 Posting Shark

Can you post the error messages and the relevant code?

gusano79 247 Posting Shark

From MSDN on HttpRequest.Files:

Gets the collection of files uploaded by the client, in multipart MIME format.

If the client has uploaded no files, the number of files uploaded is zero.

I'm not sure why this is a problem.

gusano79 247 Posting Shark

Challenge accepted.

:)

"Figure\\s(\\d+)(\\s|$)", "<a href=\"#fig$1\">Figure $1</a>"

I prefer verbatim strings for this, meaning I don't have to type \\, which always looks super weird to me in regexes as they're already symbol soup to begin with. Of course, that also means doubling up double quote characters (quadruple quotes?), but for some reason I find that easier on my eyes.

Also, Figure\\s**+** seems a little more robust; it allows us to catch things like this:

Figure  3

(two spaces)

For some reason the idea above (match with regex / replace with loop) always comes first to my mind

My gut says the loop will not perform as well, mainly because of the multiple string operations... but I don't know what exactly Regex.Replace does under the hood. I expect it's at least somewhat optimized, but it also seems like it could be a bit more involved.

It would be interesting to run each one through a profiler a few thousand times to see what happens.

gusano79 247 Posting Shark

probably not the best solution

If you know how to use backreferences, Regex.Replace can do this as a one-liner.

I'm just waiting for OP to chime in to see where to start the explanation.

gusano79 247 Posting Shark

Allows you to use parameterized queries ... a lot better than what was suggested

Does sp_executesql allow you to parameterize column names? I thought it was just another way to do parameterized queries.

A properly better response would be to redesign one's table structure so you don't have to dynamically find the right column. Perhaps with a separate Category table and a corresponding column in DailyBudget.

gusano79 247 Posting Shark

If you're looking for a short bit of code that will replace all of the "Figure n" text with matching links, Regex.Replace is your friend.

Do you have much experience with regular exressions?

gusano79 247 Posting Shark

Your client doesn't need a system that has a particular design; your client needs a system that solves some problem of theirs. Your role as a software engineer is to determine the design, which may be layered if you think it's appropriate.

So... if you think you need those three specific layers and WordPress doesn't have all of them, then WordPress isn't an appropriate solution.

Does your client have a system need that requires a service layer, or are they just asking for one directly?

gusano79 247 Posting Shark

You can't use parameters for column names like that. If you really want something that can adapt to different columns, you'll need to format it yourself beforehand.

Something like this:

String.Format("UPDATE DailyBudget SET {0} = @amount ...", "Foods");

Of course, be aware that this is dynamic SQL.

gusano79 247 Posting Shark

all you have to do is make an openfiledialog and when it .closes, say textbox1.text = opnfldlg.filename

That's part of it, but it's not the main issue...

gusano79 247 Posting Shark

See this article on SO. A couple of options there.

gusano79 247 Posting Shark

As far as I know, the .NET Framework library gives you OpenFileDialog for files and FolderBrowserDialog for folders, and that's all you get.

For non-.NET applications (like WinRAR), I don't know if there's a standard Win32 combination dialog like you're looking for or if it's a custom dialog.

gusano79 247 Posting Shark

Something like this:

SELECT
    t2.ID,
    t2.Firstname,
    day1.value AS seq1value,
    day2.value AS seq2value
FROM Table2 t2
LEFT JOIN Table1 day1
    ON day1.ID = t2.ID
    AND day1.sequence = 1
LEFT JOIN Table1 day2
    ON day2.ID = t2.ID
    AND day2.sequence = 2
gusano79 247 Posting Shark

That Cartesian product looks suspicious... you shouldn't have to group results for a query like this.

I'd left join on your subqueries instead.

gusano79 247 Posting Shark

Are you calling g2_flush for your device?

ETA: Oops, didn't see your latest post. Glad it's working!

gusano79 247 Posting Shark

Hm. It's looking for g2res.dll. I haven't done this myself, but I think C::B knows what to do with .RC files. Try making a new DLL project with the files in g2res.dsp and see if that builds.

gusano79 247 Posting Shark

Regarding X11, it was actually a simple X11 function, g2_open_X11

Yep, that's specific to the X window system. For Windows machines, try g2_open_win32.

gusano79 247 Posting Shark

g2.dll is missing

Ah, sorry, forgot. If you built g2 as a static library, C::B will name the output "libg2.a" unless you changed it. You have to link to that file directly.

I think it wants "g2" to be a DLL if you leave off the extension.

is X11 a different library from g2?

It's the GUI system for many *nix-type OSes. Windows doesn't care.

And there are some functions he is not recognizing

Are these X11 API calls? Or something else?

looking at my old code (the one I used back in Linux)

You may have to rewrite parts of your old code to work on a Windows machine.

If you want to use a Linux-like environment, you might also look into Cygwin.

gusano79 247 Posting Shark

Oh. And you'll also need to link gd in your project.

gusano79 247 Posting Shark

Awesome. Just add the g2 library you built to the linker settings of your project like you did for gd. Then include "g2.h" and knock yourself out :)

gusano79 247 Posting Shark

tried everything said above and I get alot of undefined referenced functions

That's expected :)

Make a note of the reference names; they usually refer to functions in a library the compiler hasn't been told about.

In this case, I know there are some Windows GDI functions that g2 uses. To fix these errors, go to your project's build options, and in the linker settings section, add "gdi32" to the link libraries list. No path needed.

GD support would be much appreciated for my project development.

Do you already have GD on your system? If not, go download a binary.

I think that's where any other undefined references will be found. You'll have to add the GD library in the linker settings like we did for GDI32, but it isn't a system library, so you'll have to browse for it and keep the path information.

the difference between a static or a dynamic library

Static libraries (*.lib or *.a) contain code that is copied into your program when it is built.

Dynamic libraries (*.dll or *.so) are kept separate, and may be shared between different programs.

Further reading:

http://en.wikipedia.org/wiki/Static_library
http://en.wikipedia.org/wiki/Dynamic_loading

gusano79 247 Posting Shark

Have you tried setting a breakpoint and stepping through to see if your code is even running?

gusano79 247 Posting Shark

Let's see if we can just build it with C::B; that seems simplest to me.

  1. Create a new project. Use the empty project template.
  2. Go to project properties, build targets tab.
  3. Change type to static or dynamic library (do for both Debug and Release)
  4. Open g2.dsp in a text editor
  5. Go to the end, where there are a bunch of lines starting with "SOURCE="
  6. Add all of these files to your C::B project
  7. Try to build the project; it won't work.

Fixing the errors partly depends on what you need from g2:

  • Do you want a static or dynamic library?
  • Do you want GD support (PNG and JPEG)?
gusano79 247 Posting Shark

Ah, on the Linux machines you just get the package and configure/build from source. Not so simple for Windows.

It looks like the source package includes some old Visual Studio files, so the easiest thing would be to build the 'g2' and 'g2dll' projects... if you can. I think they're VS6 projects, so if you happen to have VS6, do that.

Otherwise, I think cooking up a Code::Blocks project based on the VS6 ones shouldn't be too hard.

Are you using the MinGW/GCC that comes with some C::B distributions?

gusano79 247 Posting Shark

What does "nothing happened" mean? I assume you at least ran the code you posted. It looks like it should retrieve PDF content and save it to a file, but it doesn't open the file for viewing. Was the file created?

gusano79 247 Posting Shark

I can successfuly insert data but when I close the app the data is not save

What code do you have that you think will save data for you?

Is this a WinForms application? If so, you might want to look at the FormClosing event.

gusano79 247 Posting Shark

The first thing I'd do is set a breakpoint at the first line you posted, and step through the code as it runs. Have you tried this? It should give us a better idea of what's actually happening.

gusano79 247 Posting Shark

Some questions:

Do you mean this g2? What does "properly installed" mean to you? Do you want to compile it yourself, or just have the library available to use? What operating system are you using?

gusano79 247 Posting Shark

What does "not coming out" mean? What gets shown for averagegrade?

averagegrade = (exam1 + exam2+ exam3 + final) / 4;

All of exam1, exam2, exam3, final, and 4 are integer values... so the compiler does integer division. For floating point arithmetic, at least one of the operands needs to be a floating point value... try this:

averagegrade = (exam1 + exam2+ exam3 + final) / 4.0;
gusano79 247 Posting Shark

To start with, you'll need a good idea of what a solution to the scheduling problem might look like. Do you have more requirements than "develop a smart scheduling system" for this project?

Once you know the basic "shape" of a solution, the important things to determine are

  1. how to evaluate the effectiveness of a given solution (i.e., fitness function), and

  2. how to encode a scheduling solution into "DNA" (i.e., genetic representation).

It's essential to get these two things right (or close enough) for a genetic algorithm to work well.

gusano79 247 Posting Shark

This is also problematic from performance and maintenance perspectives. In a real-world database, you don't want to have special tables per user. Instead, consider a separate Users table that your user data table refers to. Your query ends up looking more like this:

SELECT [Code] FROM [UserData] ud WHERE ud.UserID = ####

Of course, you'll have to look up the UserID when they log in; I wouldn't recommend using the user name as the search criterion (for performance reasons).

Also, consider using parameterized queries instead of building the query string yourself. This addresses the SQL injection issue, and may also improve performance if the backing database caches execution plans.

gusano79 247 Posting Shark

I'm not 100% sure, but I have a theory. Are you pressing ENTER to finish entering the price? It seems like nextDouble isn't consuming an ENTER-press, so the following call to nextLine sees it, and assumes you entered nothing for the category. Try using nextLine to get the price and convert it to a double separately... if that works, then my theory is correct.

gusano79 247 Posting Shark

You might want a CASE statement.

gusano79 247 Posting Shark

If I remember correctly, the session end event doesn't have an HTTP context because it's not initiated by a request; it happens on the server when it decides the session is over, either timed out or abandoned.

gusano79 247 Posting Shark

What is the error message in the InvalidCastException?

It looks like the problem is you're not deserializing to your serializable object; formatter doesn't know how to make a list. I think you'll have to deserialize to your Server class directly, and create the list yourself.

gusano79 247 Posting Shark

SQL Server Compact Edition is a file-based database; just copy it.

More reading at Maintaining Databases (SQL Server Compact).

gusano79 247 Posting Shark

Please elaborate on "can't access the filepath"--are you getting an exception? What does the error message say?

gusano79 247 Posting Shark

You're only importing com.atlassian.jira.user.util.UserManager and com.atlassian.jira.user.util.UserUtil... where do you expect the compiler to find User?

com.atlassian.jira.user.ApplicationUser is in a nearby namespace, and there is an actual User class at com.atlassian.jira.pageobjects.global.User; is either of those what you're looking for?

gusano79 247 Posting Shark

Please elaborate on "prompts me an error"--I presume this was an unhandled exception... post the type of exception and the actual text of the message.

gusano79 247 Posting Shark

Aha... sounds more like dealing with parametric equations. Am I close? Like for the circle, you have: x = r cos t and y = r sin t, but you'd compose those with some mutation functions that modify the shape?

Just trying to visualize what that "triangle function" would actually be...

gusano79 247 Posting Shark

So... no control points and using primitive objects... I'm still not sure exactly what you're getting at. Does constructive solid geometry come close to what you're trying to describe?

gusano79 247 Posting Shark

Are you talking about 3D models? Do you know about NURBS?

gusano79 247 Posting Shark

To answer your question, we need to know:

  1. What is the table definition for Users?
  2. What values are in UserNameTextBox.Text and PasswordTextBox.Text?

It would also help (you just as much as us) to look at the final SQL query string in cmd.CommandText.

gusano79 247 Posting Shark

I have Not Studied about Pooling in ADO.NET and So I don't Know about the Concept of Pooling

Then maybe you should do some research.

gusano79 247 Posting Shark

If you're not using any wireless connections, you can do a simple physical demonstration: "Nothing is connected to anything outside the room."

Even more (somewhat over-) simplified explanation: it's a mini-Internet that only you guys are on.

Good luck :]

gusano79 247 Posting Shark

I'm not sure what "create a system" is supposed to mean. It could be just about anything... do you have a more specific description of what you're supposed to do?