Hi,
I would like to know if C++ provides any API (not third-party) for pattern matching using regular expressions like Java does. If it doesn't, whats the best way to do it ?
Thanks.
Hey Everyone,
I'm an employee at a small company that is going to be launching a version control system soon and I'm trying to consider which software would best serve this company for version control. I wanted to get as many opinions as possible. Right now, I'm experimenting with Trac and Indefero running atop a SVN server.
So my question is, what is the most popular/favorite version control software and why?
??t??!
What is the best way to achieve sscanf like functionality in perl?
I am looking now looking at the sscanf module,
Which is better,
Option-1: Going sscanf way?
Option-2: Regex way? [I am a beginner when it comes to Regex]
i am using half dozen jquery plugins and plus my own jquery scripts and in every script i have this code:
$(document).ready(function()
{ .... }
what is the best way of organizing all the scripts in one centeralized location and instead of having multiple times $(document).ready(function() everywhere in the script.
thoughts?
I'm using Apache Commons Logging and SLF4J with log4j, but I also want to use the log4j.properties in a custom place like conf/log4.properties. Here is the problem:
If i use
PropertyConfigurator.configure("conf/log4j.properties");
then my app is tied to log4j and defets the purpose of having ACL and SLF4J.
What is the best way to configure it withouth the app ever knowing what the logging implementation is?
I am building a dashboard where I am iterating through a list of controls to render, and I need to initiate a general callback both after each control and after they are all completed. I was curious what the best way to handle this is. I can get the control specific callback fired off by placing myUserControlCallback(); in the user control itself. I'm just not sure how to run something like allControlsRendered();.
Any ideas?
My application uses DirectX 9.0c. There are many installers for the end-user run-times, ranging from 400Kb to 100Mb+ and obviously I don't want to bloat my installer file. However, I believe there are potentially legal restrictions which mean I can't just distribute whichever MS installers I might choose.
This is the one I'd ideally like to include, is it the best /correct one?
What's the best way to add foreign keys to my existing tables in Rails with an underlying MySQL database? clearly the solution should be done in a migration, as I want this versioned. Otherwise I'd create the constraints myself.
I can't seem to find one, conducive response to they above. Again, the tables have already been created with previous migrations. I'm just going back now and adding referential integrity wherever it's applicable.
What is the best way to send data and receive a response dependent on that data?
Consider the php file used for the request:
$test = $_POST['test'];
echo json_encode($test);
I have tried unsucessfully to achieve this with:
$.ajax({
type: "POST",
dataType: "json",
data: '{test : worked}',
url: 'ajax/getDude.php',
success: function(response) {
alert(response);
}
});
Hello all,
I need to apply IP restrictions to a site in IIS v6.0 using a range of IPs.
So for example i only want the below RANGE of IPs to be able to access the site:
From 123.111.22.3 -- 123.111.66.234
Has anyone got any idea on how this can best be achieved?
Hope this all make sense and all help is massively appreciated.
Thanks,
Elliott
I have a scenario where a user is emailing another user in an HTML based web app.
For the To: field, the user may select one of a pre-defined list of emails OR enter their own ignoring the pre-defined options.
What would be the best way of doing this from a UI point of view? I've looked at editable select boxes using jQuery but none seem to let you enter your own option.
Is there some other UI mechanism that would work here?
Working on the data access / model layer in this little MVC2 project and trying to think things out to future projects.
I have a database with some basic tables and I have classes in the model layer that represent them. I obviously need something to connect the two. The easiest is to provide some sort of 'provider' that can run operations on the database and return objects.
But this is for a website that would potentially be used "a lot" (I know, very general) so I want to cache results from the data layer and keep the cache updated as new data is generated.
This question deals with how best to approach this problem of dual DALS. One that returns cached data when possible and goes to the data layer when there is a cache miss. But more importantly, how to integrate the core provider (thing that goes into database) with the caching layer so that it too can rely on cached objects rather than creating new ones.
Right now I have the following interfaces:
IDataProvider is used to reach the database. It doesn't concern itself with the meaning of the objects it produces, but simply the way to produce them.
interface IDataProvider{
// Select, Update, Create, et cetera access
IEnumerable<Entry> GetEntries();
Entry GetEntryById(int id);
}
IDataManager is a layer that sits on top of the IDataProvider layer and manages the cache
interface IDataManager : IDataProvider{
void ClearCache();
}
Note that in practice the IDataManager implementation will have useful helper functions to add objects to their related cache stores. (In the future I may define other functions on the interface)
I guess what I am looking for is the best way to approach a loop back from the IDataProvider implementations so that they can access the cache. Or a different approach entirely may be in order? I am not very interested in 3rd party products at the moment as I am interested in the design of these things much more than this specific implementation.
Edit: I realize the title may be a bit misleading. I apologize for that... not sure what to call this question.
Let's say:
I want to query colA, colB and colC in my table.
I want to see DISTINCT values but I don't want colA to be a criteria for distinction.
Omitting colA isn't an option.
What's the best way to structure that query?
I have application 1 and application 2. App2 needs to verify that App1 is installed, and if it is it needs to access a property from the App1 Settings.
What would be the best way to go about this?
Say I've written a simple app that draws circles in browser. Now I'd like to let people save their pictures. How would I store the data on the server? Which format would be the best option? Should I simply store the relevant html? What would be the case when I would want to make a custom format that is stored on the server and parsed back to html canvas when loaded?
I'd like to do something like this:
def results = Item.findAll("from Item c, Tag b, ItemTag a where c = a.item and b = a.tag and (b.tag like :q or c.uri like :q) " + ob,[q:q])
def items = (Item) results[0..1][0]
but I get
Cannot cast object '[Ljava.lang.Object;@1e224a5' with class '[Ljava.lang.Object;' to class 'org.maflt.ibidem.Item'
I can get what I need with this, but it doesn't seem like it's the best solution:
def items = [] as Set
def cnt = results.size()
for (i=0;i<cnt-1;i++) { items << results[i][0] }
items = items as List
I would like to check whether a variable is either an array or a single value in JavaScript.
I have found a possible solution...
if (variable.constructor == Array)...
Is this the best way this can be done?
Hello,
Can anyone tell me what is the best e-commerce solution between these two products.
Has anyone has made a study and compare their own functionnalities ?
thank you for your answer.
Regards.
If I have a fairly crud-based area of my app, do I really have to create separate "Create" and "Edit" views? The HTML will be practically the same. I want an "Edit" and "Create" action to both render a "Show.aspx" view, but certainly Resharper 5 is complaining about there being no "Show" action.
What's the best practice?
My table looks like this with duplicates in col1
col1, col2, col3, col4
1, 1, 0, a
1, 2, 1, a
1, 3, 1, a
2, 4, 1, b
3, 5, 0, c
I want to select distinct col1 with max (col3) and min(col2);
so result set will be:
col1, col2, col3, col4
1, 2, 1, a
2, 4, 1, b
3, 5, 0, c
I have a solution but looking for best ideas?
In an Android app, I am using one static instance of org.apache.http.impl.client.DefaultHttpClient and sharing that instance in all activities and services of the app, so that this client may be used to log in once to a remote server and all subsequent user requests to that remote server will remain authenticated.
Every activity or Service that makes a GET or POST to this remote server calls the same method : MyUtilityClass.gettHttpClient()
Do I need to worry about synchronization of this httpclient? If so, what is the best way to handle this?
I'm a JavaScript programmer and new to PHP and MySQL (want to get into server-side coding). Because I'm trying to learn PHP by building a simple online game (more specifically, correspondence chess), I'm starting by implementing a simple user accounts system. Of course, user registration comes first.
What are the best practices for:
How I should handle the (likely) possibility that when a user tries to register, the username he has chosen is already in use, particularly when it comes to function return values?($result === true is rather ugly, and I'm not sure whether checking the MySQL error code is the best way to do it either)
How to cleanly handle varying page titles?($gPageTitle = '...'; require_once 'bgsheader.php'; is also rather ugly)
Anything else I'm doing wrong? In some ways, PHP is rather different from JavaScript...
Here is a (rather large) excerpt of the code I have written so far. Note that this is a work in progress and is missing security checks that I will add as my next step.
function addUser( $username, $password ) {
global $gDB, $gPasswordSalt;
$stmt = $gDB->prepare( 'INSERT INTO user(user_name, user_password, user_registration) VALUES(?, ?, NOW())' );
$stmt || trigger_error( 'Failed to prepare statement: ' . htmlspecialchars( $gDB->error ) );
$hashedPassword = hash_hmac( 'sha256', $password, $gPasswordSalt, true );
$stmt->bind_param( 'ss', $username, $hashedPassword );
if( $stmt->execute() ) {
return true;
} elseif( $stmt->errno == 1062) {
return 'exists';
} else {
trigger_error( 'Failed to execute statement: ' . htmlspecialchars( $stmt->error ) );
}
}
$username = $_REQUEST['username'];
$password = $_REQUEST['password'];
$result = addUser( $username, $password );
if( $result === true ) {
$gPageTitle = 'Registration successful';
require_once 'bgsheader.php';
echo '<p>You have successfully registered as ' . htmlspecialchars( $username ) . ' on this site.</p>';
} elseif( $result == 'exists' ) {
$gPageTitle = 'Username already taken';
require_once 'bgsheader.php';
echo '<p>Someone is already using the username you have chosen. Please try using another one instead.';
} else {
trigger_error('This should never happen');
}
require_once 'bgsfooter.php';
What would be the best way to create a JS chat client with GWT? The bit that I'm having trouble with is the persistence and transfer of the messages. Should I store the messages in a DB and check the db for new messages? Is there a much better way to do this?