How can i strip <h1>including this content</h1>
I know you can use strip tags to remove the tags, but i want everything in between gone as well.
Any help would be appreciated.
We have a complex architecture with much logic in unmanaged code that needs database access.
Currently this is via ODBC drivers and MFC classes and we're considering the issues of migrating our abstraction layer to use ADO or ADO.Net. In the latter case we'd have to be pushing database logic back up into the .Net layer. I'm trying to decide if the pain of invoking the database via .Net callbacks is offset by the improvements in ADO.Net.
The Wikipedia comparison was interesting although I'm not sure I believe all the points in the comparison table (eg: does ADO.Net always use XML to pass data?).
A 2005 comparison shows ADO.Net performing dramatically faster.
Microsoft's guide to ADO.Net for ADO programmers suggests we will gain much from going to ADO.Net especially the way that data is available in native (.Net) types rather than solely through OLEAutomation's Variant.
I'm hoping this is a simple goof I did on my end ...
I have a table in my database set up like so:
column name: widget_guid
data type: uniqueidentifier
allow nulls: false
default value: newid()
identity: false
row guid: true
When records are created (via LINQ to SQL) that the values in this field are formatted as a GUID but contain all 0's
My assumption was that when a new record was created, that a guid would be autogenerated for that column, much like an auto-incrementing row id. Is this not true? Any help would be greatly appreciated.
Thanks.
Hey guys,
I'm working on some legacy code for a client, involving Microsoft Content Management System (MCMS).
Currently, everything is local, the code, MCMS, SQLServer, and IIS (5.x).
I copied the project folder, and then opened the new copied solution in VS2005, and let it do it's conversion thing.
But now nothing works. I've nnotice there have been some changes to IIS profile. What are the extent of these changes...??
Also, my VS2003 fails to recognize the Web Project??
Anyone have any idea what's going on?
cheers!
I am developing a C# WinForms app on my XP dev machine with Visual C# Express 2008.
I set the form to have a size of my liking with Width and Height on the designer and all looks good. I also set these dimensions to the MaximumSize property.
Deploying the app to another XP machine, and the app looks like it does on my dev.
However, in testing the app on a Win7 machine, the form has both horizontal and vertical scrollbars applied. I assume that this is due to the changed non-client size of the form, as determined by Win7. I can resize the window, but I would like it to be displayed correctly to begin with.
So, my question is: What is the best way to correctly maintain a form size client area across OS'es?
Thanks all.
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?
using namespace std;
int addition (int a, int b)
{
return (a+b);
}
int subtraction (int a, int b)
{
return (a-b);
}
int operation (int x, int y, int (*functocall)(int,int))
{
int g;
g = (*functocall)(x,y);
return(g);
}
int main()
{
int m,n;
int (*minus)(int,int) = subtraction;
m = operation (7,5,addition);
n = operation (20,m,minus);
cout << n;
return 0;
}
Can anybody explain this line for me
int (*minus)(int,int) = subtraction;
Thanks a lot!
Hello!
I'm trying to delete some files with unicode characters in them with batch script (it's a requirement). So I run cmd and execute:
> chcp 65001
Effectively setting codepage to UTF-8. And it works:
D:\temp\1>dir
Volume in drive D has no label.
Volume Serial Number is 8C33-61BF
Directory of D:\temp\1
02.02.2010 09:31 <DIR> .
02.02.2010 09:31 <DIR> ..
02.02.2010 09:32 508 1.txt
02.02.2010 09:28 12 delete.bat
02.02.2010 09:20 95 delete.cmd
02.02.2010 09:13 <DIR> Rún
02.02.2010 09:13 <DIR> ????? ???????
3 File(s) 615 bytes
4 Dir(s) 11 576 438 784 bytes free
D:\temp\1>rmdir Rún
D:\temp\1>dir
Volume in drive D has no label.
Volume Serial Number is 8C33-61BF
Directory of D:\temp\1
02.02.2010 09:56 <DIR> .
02.02.2010 09:56 <DIR> ..
02.02.2010 09:32 508 1.txt
02.02.2010 09:28 12 delete.bat
02.02.2010 09:20 95 delete.cmd
02.02.2010 09:13 <DIR> ????? ???????
3 File(s) 615 bytes
3 Dir(s) 11 576 438 784 bytes free
Then I put the same rmdir commands in batch script and save it in UTF-8 encoding. But when I run nothing happens, literally nothing: not even echo works from batch script in this case. Even saving script in OEM encoding does not help.
So it seems that when I change codepage to UTF-8 in console, scripts just stop working. Does somebody know how to fix that?
I'm trying to debug an iPhone app I'm working on, and the idea of adding fifty NSLog statements to the various source files gives me the willies.
What I'd like to do is write a pair of statements, say
NSString *methodName = [self methodName];
NSLog(@"%@", methodName);
that I can just paste into each method I need to. Is there a way to do this? Is there some Objective-C construct for asking a method for its name? Or am I gonna have to do this the hard way?
I am looking at this piece of code. This constructor delegates to the native method "System.arraycopy"
Is it Thread safe? And by that I mean can it ever throw a ConcurrentModificationException?
public Collection<Object> getConnections(Collection<Object> someCollection) {
return new ArrayList<Object>(someCollection);
}
Does it make any difference if the collection being copied is ThreadSafe eg a CopyOnWriteArrayList?
public Collection<Object> getConnections(CopyOnWriteArrayList<Object> someCollection) {
return new ArrayList<Object>(someCollection);
}
I have a User class in my web app that represents a user currently logged in.
Every time a user vists a page, a User instance is populated based on authentication data supplied in cookies.
A User instance is created even if an anonymous user logs in - and a corresponding new record is created in the User table in the database.
This approach allows me to save some state info for the current user regardless of its type.
The problem however with this approach is the Google bot, and other non-human web organisms crawling my pages. Every time a bot starts to walk around the site, thousands of useless records will be created in the database, each of them only to be used for a single page.
Question: what is the best trade off? How to support anonymous users, save their state, and don't get too much overhead because of cookieless bots?
I run into this frequently enough that I thought I'd see what others had to say about it.
Using the StyleCop conventions, I find that I often have a property name that is hard to make different than the class name it is accessing. For example:
public class ProjectManager
{
// Stuff here
}
public class OtherClass
{
private ProjectManager ProjectManager { get; set; }
}
It compiles and runs, but seems like it would be an easy way to confuse things, even with the use of "this".
I'm trying to setup Glassfish embedded with a WAR project that implements a REST API and then some static Javascript content that calls it. I got the WAR to deploy and the REST API is available with a context root of "/Users".
How can I use Glassfish to serve static content with a context root of "/". So for example, if the user requests http://myserver.com/Users/some-REST-call it routes to the WAR application and http://myserver.com/somefile.js serves a static file from some directory?
Here's my Main class file so far:
public class Main{
public static void main(String[] args) throws Exception {
String port = System.getenv("PORT");
port = port != null ? port : "8080";
GlassFishProperties gfProps = new GlassFishProperties();
gfProps.setPort("http-listener", Integer.parseInt(port));
GlassFish glassfish = GlassFishRuntime.bootstrap().newGlassFish(gfProps);
glassfish.start();
Deployer deployer = glassfish.getDeployer();
deployer.deploy(new File("target/Users-Rest.war"));
}
}
Thanks a ton for your help!
i have a form in drupal with jquery based date module. there are multiple fields with date picker enabled. i want to set the value of all of them (they all have class .date-popup-init) to the value of the first field (#edit-field, the 'from' date) when that field is set.
my code so far:
<script type="text/javascript">
var DatePicked = function() {
var firstdate = $("#edit-field");
var updater = firstdate.datepicker("getDate");
$(".date-popup-init").each(function(){
$(this).datepicker("setDate", updater);
});
}
$(function() {
$("#edit-field").datepicker({
onSelect: DatePicked
});
});
</script>
this seems to randomly work; it sets the date of some fields to the value of #edit-field, seemingly different fields each time.
also, the form adds more datepicker-enabled fields via ajax. is there any way to ensure that all these new fields, when they load, pick up the value of #edit-field as well?
disclaimer: last night was my first attempt at javascript of any kind. i have a basic idea now. the above was cobbled through countless google examples.
while (curr_data[1] != (unsigned int)NULL &&
((curr_ptr = (void*)curr_data[1]) || 1))
Two part question.
What will (curr_ptr = (void*)curr_data[1]) evaluate to, logically. TRUE?
Also, I know its rather hack-ish, but is the while statement legal C? I would have to go through great contortions to put the assignment elsewhere in the code, so I'd be really nice if I could leave it there, but if it's so egregious that it makes everyone's eyeballs burst into flames, I'll change it.
Normally I would us
<form target="_blank">
But looking through
http://www.w3schools.com/tags/tag_form.asp
I notice the target attribute is deprecated.
So what is the correct XHTML compliant way to perform such an action?
Is it possible to write a C++ template that changes behavior depending on if a certain member function is defined on a class?
Here's a simple example of what I would want to write:
template<class T>
std::string optionalToString(T* obj)
{
if (FUNCTION_EXISTS(T->toString))
return obj->toString();
else
return "toString not defined";
}
So if class T has "toString" defined then it uses it, otherwise it doesn't. The magical part that I don't know how to do is the "FUNCTION_EXISTS" part.
I have a dataGridView whose dataSource is a dataTable.
My problem is that I want certain columns to be displayed in Hex. I can get that far with using something like this:
foreach (DataGridViewColumn c in grid.Columns)
{
if (DISPLAYED_IN_HEX.Contains(c.Name))
{
c.DefaultCellStyle.Format = "X";
}
}
My issue though is that I want this hex value prepended with 0x so as not to confuse anyone that they are in hexidecimal form. The values in the dataTable are various integral types. I looked into creating a custom IFormatProvider, but I don't think my coding skills are up to that par yet. Any other possible solutions?
i have a struct HLRange with two CGFloat's
struct HOLRange
{
CGFloat min;
CGFloat max;
};
typedef struct HOLRange HOLRange;
but how do i make a function like HLRangeMake(1,2); .. like CGRectMake?
I have a file with one line in it.
I create a branch and add a second line to the same file. Save and commit to the branch.
I switch back to the master. And add a different, second line to the file. Save and commit to the master.
So there's now 3 unique lines in total.
If I now try and merge the branch back to the master, it suffers a merge conflict.
Why cant Git simple merge each line, one after the other?
My attempt at merge behaves something like this:
PS D:\dev\testing\test1> git merge newbranch
Auto-merging hello.txt
CONFLICT (content): Merge conflict in hello.txt
Automatic merge failed; fix conflicts and then commit the result.
PS D:\dev\testing\test1> git diff
diff --cc hello.txt
index 726eeaf,e48d31a..0000000
--- a/hello.txt
+++ b/hello.txt
@@@ -1,2 -1,2 +1,6 @@@
This is the first line.
- New line added by master.
-Added a line in newbranch.
++<<<<<<< HEAD
++New line added by master.
++=======
++Added a line in newbranch.
++>>>>>>> newbranch
Is there a way to make it slot lines in automatically, one after the other?
I've finally gotten a working "alpha" version of my first app installed and (mostly) working on my iPhone 3G. So excited I came into the house and danced a little jig while my wife rolled her eyes at me. Don't care - totally stoked that I figured it out on my own (with lots of help here - thanks again, guys).
I've never really dabbled with or cared about animation; I'm more into utility-type apps. However, I've decided that I'd like to animate my app's opening image / default.png / splash screen similar to the flipside view controller animation - where the image spins from a view on the front to a different view on the back. I've found code for animating between views using the flipside animation, but how would I go about animating from a static *.png image to my navigation-based table view? I'm just not even sure where to start with this one - literally the first time I've ever even searched for anything graphics-related in the documentation.
Any help will be appreciated. As usual, thanks in advance!
I have a very simple application running on appengine that requests a web page every five minutes and parses for a specific piece of data.
Everything works fine except that the response I get back from the external request (using urllib2) doesn't reflect the latest changes to the page. Sometimes it takes a few minutes to get the latest, sometimes over an hour.
Is there a transparent layer of caching that appengine puts in place? Or is there something else I am missing here? I've looked at the caching headers of the requested page and there is no Expires or LastModified's sent.
Update:
Sometimes, it will get the new version of the page for a number of requests and then randomly later get an old out of date version.
I am using EF 4, mapping all CUD operations for my entities using sprocs.
I have two tables, ADDRESS and PERSON. A PERSON can have multiple ADDRESS associated with them.
Here is the code I am running:
Person person = (from p in context.People
where p.PersonUID == 1
select p).FirstOrDefault();
Address address = (from a in context.Addresses
where a.AddressUID == 51
select a).FirstOrDefault();
address.AddressLn2 = "Test";
context.SaveChanges();
The Address being updated is associated with the Person I am retrieveing - although they are not explicitly linked in any way in the code. When the context.SaveChanges() executes not only does the Update sproc for my Address entity get fired (like you would expect), but so does the Update sproc for the Person entity - even though you can see there was no change made to the Person entity.
When I check the EntityState of both objects before the context.SaveChanges() call I see that my Address entity has an EntityState of "Modified" and my Person enity has an EntityState of "Unchanged".
Why is the Update sproc being called for the Person entity? Is there a setting of some sort that I can set to prevent this from happening?
Hello,
I have a relatively large Conceptual Data Model in PowerDesigner.
After generating a Physical Data Model and seeing the DBMS data types, I need to update all of data types(NUMBER/TEXT) for each data item.
I'd like to either do a find/replace within the Conceptual Data Model or somehow map to different data types when creating the Physical Data Model. Ex. Change the auto conversion of Text - Clob, to Text - NVARCHAR(20).
Thanks!
I've got a string representation of a time, like "11:13 AM." This was produced using an NSDateFormatter and the stringFromDate: method.
I'd like to compare this time to the current time, but when I use the dateFromString: method to turn the string back into a date, a year, month and day are added - which I don't want. I just need to know if right now is < or the time stored in the string.
What's going to be the best way to handle that? Thanks in advance for your help.