instruction stringlengths 0 30k ⌀ |
|---|
Sorry, for spamming this question, but I just really feel like posting **The Real Answer**.
If you want your BATCH script to *parse* and *compare* the dates in filenames, then you can use something like this:
@echo off
rem Enter the ending of the filenames.
rem Basically, you must specify everything that comes after the date.
set fn_end=filename.txt
rem Do not touch anything bellow this line.
set max_month=00
set max_day=00
for /F %%i in ('dir /B *%fn_end%') do call :check "%%i"
call :open %max_month% %max_day%
exit /B 0
:check
set name=%~1
set date=%name:~0,4%
set month=%date:~0,2%
set day=%date:~2,2%
if /I %month% GTR %max_month% (
set max_month=%month%
set max_day=%day%
) else if /I %month% EQU %max_month% (
set max_month=%month%
if /I %day% GTR %max_day% (
set max_day=%day%
)
)
exit /B 0
:open
set date=%~1
set month=%~2
set name=%date%%month%%fn_end%
start "dummy" "%name%"
exit /B 0
|
The first thing I do with any editor is try to figure out it's Regex oddities. I use it all the time. Nothing really crazy, but it's handy when you've got to copy/paste stuff between different types of text - SQL <-> PHP is the one I do most often - and you don't want to fart around making the same change 500 times. |
I may not be right, but I think Id is a tastier dish.
thing.id
because if you are going to write any reflective stuff that deals with your objects and needs primary key, its way easier to know it everywhere, then trying to determine it with a formula.
As for the other, thats total preference and I don't see any real implications other than time wasted typing the other characters, and its .net so no one actually types namespaces anyway. |
How to check if element in groovy array/hash/collection/list? |
|arrays|list|groovy|grails| |
How do I figure out if an array contains an element?
I thought there might be something like [1,2,3].includes(1) which would evaluate as 'true' |
Couple feature additions:
* Automatically insert page breaks after methods/classes
* Keep long lines readable (nearly all current implementations are broken)
|
Cruise Control.net (ccnet) does everything you are looking for. Its pretty easy to use, just make sure if you are going to run it as a service, you give it an account and don't make it run as network service, that way you can give it rights on intranet boxes and have it do xcopy deploys.
It has all kinds of email modes, on failure, on all, on fix after failure, and many many more. |
TypeLoadException on System.Xml.Linq.XDocument when running T4 template on build server |
These are relatively cheap mechanisms for possibly solving the problem:
1. Keep an eye on my [heap corruption question][1] - I'm updating with the answers as they shake out. The first was balancing new[] and delete[], but you're already doing that.
2. Give valgrind more of a go; it's an excellent tool, and I only wish it was available under Windows. I only slows your program down by about half, which is pretty good compared to the Windows equivalents.
3. Think about using the [Google Performance Tools][2] as a replacement malloc/new.
4. Have you cleaned out all your object files and started over? Perhaps your make file is... "suboptimal"
5. You're not assert()ing enough in your code. How do I know that without having seen it? Like flossing, no-one assert()s enough in their code. Add in a validation function for your objects and call that on method start and method end.
6. Are you compiling -wall? If not, do so.
7. Find yourself a lint tool like PC-Lint.
8. Check you're NULLing out pointers after deleteing them. Nobody likes a dangling pointer. Same gig with declared but unallocated pointers.
9. Stop using arrays. Use a vector instead.
[1]: http://stackoverflow.com/questions/1069/heap-corruption-under-win32-how-to-locate
[2]: http://code.google.com/p/google-perftools/ |
These are relatively cheap mechanisms for possibly solving the problem:
1. Keep an eye on my [heap corruption question][1] - I'm updating with the answers as they shake out. The first was balancing new[] and delete[], but you're already doing that.
2. Give valgrind more of a go; it's an excellent tool, and I only wish it was available under Windows. I only slows your program down by about half, which is pretty good compared to the Windows equivalents.
3. Think about using the [Google Performance Tools][2] as a replacement malloc/new.
4. Have you cleaned out all your object files and started over? Perhaps your make file is... "suboptimal"
5. You're not assert()ing enough in your code. How do I know that without having seen it? Like flossing, no-one assert()s enough in their code. Add in a validation function for your objects and call that on method start and method end.
6. Are you compiling -wall? If not, do so.
7. Find yourself a lint tool like PC-Lint.
8. Check you're NULLing out pointers after deleteing them. Nobody likes a dangling pointer. Same gig with declared but unallocated pointers.
9. Stop using arrays. Use a vector instead.
10. Don't use raw pointers. Use a smart pointer. Don't use auto_ptr! That thing is... surprising; its semantics are very odd. Instead, choose one of the boost smart pointers, or something out of Loki.
[1]: http://stackoverflow.com/questions/1069/heap-corruption-under-win32-how-to-locate
[2]: http://code.google.com/p/google-perftools/ |
These are relatively cheap mechanisms for possibly solving the problem:
1. Keep an eye on my [heap corruption question][1] - I'm updating with the answers as they shake out. The first was balancing new[] and delete[], but you're already doing that.
2. Give [valgrind][2] more of a go; it's an excellent tool, and I only wish it was available under Windows. I only slows your program down by about half, which is pretty good compared to the Windows equivalents.
3. Think about using the [Google Performance Tools][3] as a replacement malloc/new.
4. Have you cleaned out all your object files and started over? Perhaps your make file is... "suboptimal"
5. You're not assert()ing enough in your code. How do I know that without having seen it? Like flossing, no-one assert()s enough in their code. Add in a validation function for your objects and call that on method start and method end.
6. Are you [compiling -wall][4]? If not, do so.
7. Find yourself a lint tool like [PC-Lint][5].
8. Check you're NULLing out pointers after deleteing them. Nobody likes a dangling pointer. Same gig with declared but unallocated pointers.
9. Stop using arrays. Use a [vector][6] instead.
10. Don't use raw pointers. Use a [smart pointer][7]. Don't use auto_ptr! That thing is... surprising; its semantics are very odd. Instead, choose one of the [Boost smart pointers][8], or something out of [the Loki library][9].
[1]: http://stackoverflow.com/questions/1069/heap-corruption-under-win32-how-to-locate
[2]: http://valgrind.org/
[3]: http://code.google.com/p/google-perftools/
[4]: http://gcc.gnu.org/onlinedocs/gcc-4.3.0/cpp/Invocation.html#Invocation
[5]: http://www.gimpel.com/
[6]: http://en.wikipedia.org/wiki/Vector_(STL)
[7]: http://en.wikipedia.org/wiki/Smart_pointer
[8]: http://www.boost.org/doc/libs/1_35_0/libs/smart_ptr/smart_ptr.htm
[9]: http://en.wikipedia.org/wiki/Loki_(C%2B%2B) |
|versioning|subversion|photoshop| |
|svn|versioning|photoshop| |
Frankly, I can't find a single reason to use MySQL rather than MSSQL. The issue before used to be cost but SQL Server 2005 Express is free and there are lots of web hosting companies which offer full hosting with sql server for less than $5.00 a month.
MSSQL is easier to use and has many features which do not exist in MySQL. |
If you're going to insist on doing this with a regular expression, you'd probably be better off with:
( (0?1|0?3| <...> |10|11|12) / (0?1| <...> |30|31) |
0?2 / (0?1| <...> |28|29) )
/ (19|20)[0-9]{2}
This *might* make it possible to read and understand. |
If you're going to insist on doing this with a regular expression, I'd recommend something like:
( (0?1|0?3| <...> |10|11|12) / (0?1| <...> |30|31) |
0?2 / (0?1| <...> |28|29) )
/ (19|20)[0-9]{2}
This *might* make it possible to read and understand. |
Google Finance - Get Quotes search box - Column Alignment |
|ajax| |
How does Google manage to properly align the second column (i.e. the ticker name) in the "Get Quotes" search box suggestion dropdown in http://finance.google.com?
e.g. if you enter "iii" - the second column is perfectly aligned.
It does not use a fixed-width font - so just adding the correct numbers of spaces to the "ticker" will not work.
How do they do that? |
|javascript|html|css|ajax| |
@Blorgbeard
Good response, the MSDN documentation on "WITH ENCRYPTION" seems to agree with your point, now calling it "obfuscated" rather then encrypted.
I've met a few developers who were completely unaware of this point however. Hopefully this question/response will inform others too. |
What would it take to make OpenID mainstream? |
|security|openid|user-interfaces| |
OpenID is a great idea in principle, but the UI and the explanation as to why it is good are currently not tailored for general use -- what do you think it would take to make OpenID work for the general public? Can this be solved with technology, or is the problem so intrinsically hard that we are stuck with difficult explanations/multi-step registration procedures, numerous accounts, or poor security? |
|security|openid|user-interfaces| |
This is probably overkill for such a simple task, but if you plan to do more than that, then it's saner to start from these tools (mechanize, BeautifulSoup) because they are much easier to use than the alternatives (urllib to get content and regexen or some other parser to parse html)
Links:
[BeautifulSoup][1]
[mechanize][2]
#!/usr/bin/env python
#coding:utf-8
from BeautifulSoup import BeautifulSoup
from mechanize import Browser
br = Browser()
res = br.open("https://www.google.com/")
data = res.get_data()
soup = BeautifulSoup(data)
title = soup.find('title')
print title.renderContents()
[1]: http://crummy.com/software/BeautifulSoup
[2]: http://wwwsearch.sourceforge.net/mechanize/ |
Try [![alt text][1]](http://www.sparxsystems.com.au/products/ea/index.html)
But, It is NOT free
It has amazing features.. Check the [screenshots](http://www.sparxsystems.com.au/products/ea/screenshots.html) here.
And they have [![alt text][2]](http://www.sparxsystems.com.au/products/mdg/int/vs/index.html) and [![alt text][3]](http://www.sparxsystems.com.au/products/mdg/int/eclipse/index.html)tooo..
[1]: http://www.sparxsystems.com.au/images/products/logos/EA.png
[2]: http://www.sparxsystems.com.au/images/products/logos/MDGIntVS-268x73.png
[3]: http://www.sparxsystems.com.au/images/products/logos/MDGIntEclipse-223x73.png |
NHibernate vs LINQ |
|linq|nhibernate| |
As someone wo hasn't used either technology on real-world projects I wonder if anyone knows how these two complement each other and how much their functionalities overlap? |
|linq|nhibernate|orm| |
NHibernate vs LINQ to SQL |
|linq|orm|nhibernate| |
|linq|nhibernate|orm| |
As someone who hasn't used either technology on real-world projects I wonder if anyone knows how these two complement each other and how much their functionalities overlap? |
I guess like a lot of things: it depends. I usually do both. Some content stay fixed width to look good or if it can't benefit form more space. other stuff is set to 100% if it seems like it'd be usefull. |
I guess like a lot of things: it depends. I usually do both. Some content stays fixed width to look good or if it can't benefit form more space. other stuff is set to 100% if it seems like it'd be usefull. |
c/c++ source code visualization? |
|hacking| |
Basically I want tools which generate function call graph, dependency graph etc. |
|hacking|c|c++|tools| |
|c++|c|hacking|visualisation| |
A variation is where you use a direct hierarchical representation (ie. parent link in node), but also store a path value.
ie. for a directory tree consisting of the following:
C:\
Temp
Windows
System32
You would have the following nodes
Key Name Parent Path
1 C: *1*
2 Temp 1 *1*2*
3 Windows 1 *1*3*
4 System32 3 *1*3*4*
Path is indexed, and will allow you to quickly do a query that picks up a node and all its children, without having to manipulate ranges.
ie. to find C:\Temp and all its children:
WHERE Path LIKE '*1*2*%'
This representation is the only place I can think of where storing *id's* in a string like this is ok. |
These are relatively cheap mechanisms for possibly solving the problem:
1. Keep an eye on my [heap corruption question][1] - I'm updating with the answers as they shake out. The first was balancing new[] and delete[], but you're already doing that.
2. Give [valgrind][2] more of a go; it's an excellent tool, and I only wish it was available under Windows. I only slows your program down by about half, which is pretty good compared to the Windows equivalents.
3. Think about using the [Google Performance Tools][3] as a replacement malloc/new.
4. Have you cleaned out all your object files and started over? Perhaps your make file is... "suboptimal"
5. You're not assert()ing enough in your code. How do I know that without having seen it? Like flossing, no-one assert()s enough in their code. Add in a validation function for your objects and call that on method start and method end.
6. Are you [compiling -wall][4]? If not, do so.
7. Find yourself a lint tool like [PC-Lint][5]. A small app like yours might fit in the [PC-lint demo][6] page, meaning no purchase for you!
8. Check you're NULLing out pointers after deleteing them. Nobody likes a dangling pointer. Same gig with declared but unallocated pointers.
9. Stop using arrays. Use a [vector][7] instead.
10. Don't use raw pointers. Use a [smart pointer][8]. Don't use auto_ptr! That thing is... surprising; its semantics are very odd. Instead, choose one of the [Boost smart pointers][9], or something out of [the Loki library][10].
[1]: http://stackoverflow.com/questions/1069/heap-corruption-under-win32-how-to-locate
[2]: http://valgrind.org/
[3]: http://code.google.com/p/google-perftools/
[4]: http://gcc.gnu.org/onlinedocs/gcc-4.3.0/cpp/Invocation.html#Invocation
[5]: http://www.gimpel.com/
[6]: http://gimpel-online.com/cgi-bin/genPage.py?srcFile=diy.cpp&cgiScript=analyseCode.py&title=Blank+Slate+(C%2B%2B)+&intro=An+empty+page+in+which+to+write+your+own+C%2B%2B+code.&compilerOption=co-gcc.lnt+co-gnu3.lnt&includeOption={{quotedIncludeOption}}
[7]: http://en.wikipedia.org/wiki/Vector_(STL)
[8]: http://en.wikipedia.org/wiki/Smart_pointer
[9]: http://www.boost.org/doc/libs/1_35_0/libs/smart_ptr/smart_ptr.htm
[10]: http://en.wikipedia.org/wiki/Loki_(C%2B%2B) |
I like [MicroAngelo][1].
[1]: http://www.microangelo.us/ |
As someone else said, 'what platform'. On Windows I've used 'blat', which is a freebie command line SMTP mailer to do this, along with a post-commit and another batch file.
The post commit looks like this: (Just calls another batch file)
call d:\subversion\repos\rts\hooks\mail %1 %2
And mail.bat looked like this:
copy d:\subversion\repos\RTS\hooks\Commitmsg.txt %temp%\commit.txt
copy d:\subversion\repos\RTS\hooks\subjbase.txt %temp%\subject.txt
svnlook info -r %2 %1 >> %temp%\commit.txt
echo Revision %2 >> %temp%\commit.txt
svnlook changed -r %2 %1 >> %temp%\commit.txt
svnlook author -r %2 %1 >> %temp%\subject.txt
c:\utils\blat %temp%\commit.txt -t <me@my.email.com> -sf %temp%\subject.txt -server ServerName -f "SVN Admin <svn@my.email.com>" -noh2
The biggest gotcha in writing SVN hooks is that you might have basically NO environment set-up - no exe path, no temp path, etc. Though maybe that's improved in more recent SVN builds. |
Is this something that needs to be done often and automatically, or is this just a one time thing for your app? If the latter is correct, MyViewPad will work. |
PHP Object Oriented or not? |
|php|web-applications|object-oriented-design| |
I have a start of a webapp that I wrote without using the Object Oriented features of PHP.
I don't really know if it is worth it to go back and rewrite the parts I have finished. Is object oriented PHP worth rewriting all or part of a decent working app? |
|php|oop|web-applications| |
Something special about Safari for Windows and AJAX? |
|ajax| |
Some common pitfalls I should keep in mind? |
|javascript|windows|ajax|browser|safari| |
The SQL Server Books Online's [page on the subject](http://msdn.microsoft.com/en-us/library/ms131089.aspx) lists these benefits:
* **A better programming model.** The .NET Framework languages are in many respects richer than Transact-SQL, offering constructs and capabilities previously not available to SQL Server developers. Developers may also leverage the power of the .NET Framework Library, which provides an extensive set of classes that can be used to quickly and efficiently solve programming problems.
* **Improved safety and security.** Managed code runs in a common language run-time environment, hosted by the Database Engine. SQL Server leverages this to provide a safer and more secure alternative to the extended stored procedures available in earlier versions of SQL Server.
* **Ability to define data types and aggregate functions.** User defined types and user defined aggregates are two new managed database objects which expand the storage and querying capabilities of SQL Server.
* **Streamlined development through a standardized environment.** Database development is integrated into future releases of the Microsoft Visual Studio .NET development environment. Developers use the same tools for developing and debugging database objects and scripts as they use to write middle-tier or client-tier .NET Framework components and services.
* **Potential for improved performance and scalability.** In many situations, the .NET Framework language compilation and execution models deliver improved performance over Transact-SQL.
|
Are CLR stored procedures preferred over TSQL stored procedures in SQL 2005+ ? |
|.net|sql-server|t-sql| |
My current view is no, prefer Transact SQL stored procedures because they are a lighter weight and (possibly) higher performing option, while CLR procedures allow developers to get up to all sorts of mischief.
However recently I have needed to debug some very poorly written TSQL stored procs (yet again). As usual I found many of the problems due to the original developer developer having no real TSQL experience, they were ASP.NET / C# focused.
So, using CLR procedures would firstly provide a much more familiar toolset to this type of developer, and secondly, the debugging and testing facilities are more powerful (ie Visual Studio instead of SQL Management Studio).
I'd be very interested in hearing your experience as it's obviously not a simple choice.
|
Using stored procedures and/or parameterized queries will go a long way in protecting you from sql injection. Also do *NOT* have your web app access the database as sa or dbo - set a up a standard user account and set the permissions.
AS for XSS (cross site scripting) ASP.NET has some built in protections. The best thing is to filter input using validation controls and Regex.
|
Once you _do_ find some good guide, here's something to remember: Django is a bit special with its terminology. It uses "MTV" for Model, Template and View (and can mention also a URL Dispatcher somewhere along the way), whereas a more standard set of terms is "MVC" for Model, View and Controller.
Model is the same in both meanings - a model of a data entity, often linked to a database table, if the framework implements Object/Relational Mapping (which Django does).
But the two remaining terms might be confusing; where Django talks about Views, the 'rest of the world' talks about Controllers. The basic idea is that this is where the presentation logic is done. Calculations are calculated, arrays are sorted, data is retrieved, etc. I'd say that Django's URL dispatcher is also a part of the conventional Controller concept.
Django's Templates are comparable to Views elsewhere - here you have your presentation, nothing else. Where Django forces you to a very small set of logical commands, other frameworks often just recommend you not to do anything than present HTML, with some presentation logical elements (like loops, branches, etc), but don't stop you from doing other stuff.
So, to recap:
* **Model:** Data objects
* **Controller (View in Django):** Data process
* **View (Template in Django):** Presentation
Oh, btw: For a Django-specific guide, consider reading [The Django Book](http://djangobook.com/) |
[MySQL++][1]
[1]: http://tangentsoft.net/mysql++/ |
@Ryan Eastabrook:
In my (admittedly limited) experience with SSIS, it is quite good at rapidly getting something up and running, but frusteratingly limited in getting something that "feels" like the most elegant, efficient solution to a programmer.
Since the Excel Source Editor seems to take only files as input, you need to give it a file or reimplement its functionality in code that can take a blob. I understand that this is unsatisfying, but in the end, this is a time saving tool. |
Git is superior to subversion, but it's a little bit out on the bleeding edge.
I'd say, if you're just getting started, jump on the edge; setup a free account @ http://github.com
They have educational material on site for setting up & using git. |
- What do friendly bots see (eg: Google); check using [Google Webmaster Tools][1];
- What form controls aren't validated that lead to a database or system API call; I use the Firefox [Web Developer Toolbar][2] to fiddle with the forms;
[OWASP][3] has a few good [security guides][4] as well.
[1]: http://www.google.com/webmasters/tools/
[2]: http://chrispederick.com/work/web-developer/
[3]: http://en.wikipedia.org/wiki/OWASP
[4]: http://www.owasp.org/index.php/OWASP_Guide_Project |
- What do friendly bots see (eg: Google); check using [Google Webmaster Tools][1];
[1]: http://www.google.com/webmasters/tools/ |
I have found the application [IcoFx](http://icofx.ro/) useful, you can import pretty much any image type to use for icon creation, including PNG's. |
I stumbled upon Icon Sushi a little while back and love it. It hasn't been updated in about a year, but it still works great, even in Vista. Plus it is free.
http://www.towofu.net/soft/e-aicon.php |
I also use Gif Movie Gear to create `.ico` files.
This online [Favicon Generator][1] tool also seems to work fine.
[1]: http://tools.dynamicdrive.com/favicon/ |
Is this an exception that your code would actually handle if you weren't running in the debugger? |
The META-INF.services stuff is known by its class name in the API: [ServiceLoader][1]. A Google search for [ServiceLoader][2] yields some information.
I am not really familiar with it, but sometimes it's all about knowing the right search keywords.
[1]: http://java.sun.com/javase/6/docs/api/java/util/ServiceLoader.html
[2]: http://www.google.ca/search?hl=en&q=ServiceLoader |
I agree with Mike, though I'm a Vim die-hard. I've been using GEdit quite frequently lately when I'm doing lightweight Ruby scripting. The standard editor (plus Ruby code snippets) is extremely usable and polished, and can provide a nice reprieve from full-strength, always-on programming editors. |
It's now defunct but [phpdbi][1] is possibly worth a look. If you're willing to let go of some of your caveats (the framework one), I've found that [Doctrine][2] is a pretty neat way of accessing DBs in PHP. Worth investigating anyway.
[1]: http://phpdbi.sourceforge.net/web/
[2]: http://www.phpdoctrine.org/ |
Do you really need per-commit back-ups? There are almost certainly better ways of safe-guarding against failures than going down that route. For example, given that most failures are disk failures, move to a RAID array and/or NAS/SAN storage will provide you with better general protection and, if configured correctly, better performance. At that point, off-site back-ups becomes a matter of using the tools available. See the [Repository maintenance section][1] of the svn manual for details.
If you truly do need per-commit back-ups then, yeah, post-commit scripts are the way to go.
[1]: http://svnbook.red-bean.com/en/1.1/ch05s03.html |
Sounds like what you are looking for is basically federated (synced) servers...
I asked the same question recently...and while I didn't find the exact solution I was looking for it came close.
See here: [http://stackoverflow.com/questions/1790/federated-synced-subversion-servers][1]
[1]: http://stackoverflow.com/questions/1790/federated-synced-subversion-servers |
Resolving Session Fixation in JBoss |
|java|security|jboss| |
I need to prevent [Session Fixation][1], a particular type of session hijacking, in a Java web application running in JBoss. However, it appears that the standard idiom [doesn't work in JBoss][2]. Can this be worked around?
[1]: http://www.owasp.org/index.php/Session_Fixation
[2]: http://www.owasp.org/index.php/Session_Fixation_in_Java |
|.net|t4|texttransform|typeloadexception| |
I'm having a problem running a T4 template using TextTransform.exe on my build server. On my dev machine the template works perfectly. The error message is as follows.
error : Running transformation: System.TypeLoadException: Could not instantiate type 'System.Xml.Linq.XDocument'
The build server has the windows 2008 SDK on it, my machine has VS 2008. I thought mayve it couldn't find System.Data.Xml so I ensure the dll was present in the same directory, but no luck. Any ideas?
|
I've used [cc.net][1] with nant and msbuild with great success, would highly recommend it.
[1]: http://confluence.public.thoughtworks.org/display/CCNET/Welcome+to+CruiseControl.NET |
@Brian Chiasson
Unfortunately, it's not an option to create all classes of GIS data because classes are created dynamically in the application. Every GIS data of the same type should be a class, but my user has the possibility to get new set of data and put it in the database. I can't know in front which classes my user will have in the application. Therefore, the in-front per-class mapping model doesn't work because tomorrow there will be another new database table, and a need to create new class with new mapping.
@all
There might be a possibility to write my own custom query in the XML config file of my GisObject class, then in the data access class fetching that query using the
string qs = getSession().getNamedQuery(queryName);
and use the string replace to inject database name (by replacing some placeholder string) which i will pass as a parameter.
qs = qs.replace(":tablename:", tableName);
How do you feel about that solution? I know it might be a security risk in an uncontrolled environment where the table name would be fetched as the user input, but in this case, i have a meta table containing right and valid table names for the GIS data classes which i will read before calling the query for fetching data for the specific class of GIS objects. |
Gulzar and Ryan Lanciaux make good points in mentioning CodeSmith and ORM. Either of those might reduce or eliminate your current burden when it comes to generating dynamic SQL. Your current approach of using parameterized SQL is wise, simply because it protects well against SQL injection attacks.
Without an actual code sample to comment on, it's difficult to provide an informed alternative to the loops and switch statements you're currently using. But since you mention that you're setting a CommandText property, I would recommend the use of string.Format in your implementation (if you aren't already using it). I think it may make your code easier to restructure, and therefore improve readability and understanding. |
I think you are going to have some problems with the granularity. See similar questions [GetLocalTime() API time resolution][1] and Is [gettimeofday() guaranteed to be of microsecond resolution?][2]
Also, you may want to take a look at the [Windows Resource Kits Tools][3] which include timeit.exe (similar to `time` on unix/linux) to give you elapsed and process times.
[1]: http://stackoverflow.com/questions/49668/getlocaltime-api-time-resolution
[2]: http://stackoverflow.com/questions/88/is-gettimeofday-guaranteed-to-be-of-microsecond-resolution
[3]: http://www.microsoft.com/downloads/details.aspx?familyid=9d467a69-57ff-4ae7-96ee-b18c4790cffd&displaylang=en |
This is probably overkill for such a simple task, but if you plan to do more than that, then it's saner to start from these tools (mechanize, BeautifulSoup) because they are much easier to use than the alternatives (urllib to get content and regexen or some other parser to parse html)
Links:
[BeautifulSoup][1]
[mechanize][2]
#!/usr/bin/env python
#coding:utf-8
from BeautifulSoup import BeautifulSoup
from mechanize import Browser
#This retrieves the webpage content
br = Browser()
res = br.open("https://www.google.com/")
data = res.get_data()
#This parses the content
soup = BeautifulSoup(data)
title = soup.find('title')
#This outputs the content :)
print title.renderContents()
[1]: http://crummy.com/software/BeautifulSoup
[2]: http://wwwsearch.sourceforge.net/mechanize/ |
For my company, I use svn+ssh and key-based authentication. You can do this with both windows clients and linux clients. This is real easy to use once you get your keys straight as you use an ssh key to login rather than typing a password.
Here's an article on setting up svn+ssh with notes on security. If you understand all of this stuff and follow these steps, you'll be off to a good start.
[http://svn.haxx.se/dev/archive-2004-03/0253.shtml][1]
This article describes a number of ways to further secure your ssh logins for the svn accounts.
[http://svn.collab.net/repos/svn/trunk/notes/ssh-tricks][2]
I recommend creating accounts specifically for svn access with no other access to that server. Daily builds can have their own special accounts and their own ssh keys. I don't like for my automated tools to run with the login of a human user (so I know which tool is broken).
If you don't understand all of the security tricks, searching google can get you some help. If you have trouble, set one up without the security tricks first. That makes it a bit simpler to troubleshoot.
Good luck, and enjoy having the benefits of source control!
[1]: http://svn.haxx.se/dev/archive-2004-03/0253.shtml
[2]: http://svn.collab.net/repos/svn/trunk/notes/ssh-tricks |
For my company, I use svn+ssh and key-based authentication. You can do this with both windows clients and linux clients. This is real easy to use once you get your keys straight as you use an ssh key to login rather than typing a password.
Here's an article on setting up svn+ssh with notes on security. If you understand all of this stuff and follow these steps, you'll be off to a good start.
[http://svn.haxx.se/dev/archive-2004-03/0253.shtml][1]
This article describes a number of ways to further secure your ssh logins for the svn accounts.
[http://svn.collab.net/repos/svn/trunk/notes/ssh-tricks][2]
I recommend creating accounts specifically for svn access with no other access to that server. My guess is that you would use a daily build or automated script to update your stored procs in the db. Daily builds can have their own special accounts and their own ssh keys. I don't like for my automated tools to run with the same login as a human user (so I know which tool is broken).
If you don't understand all of the security tricks, searching google can get you some help. If you have trouble, set one up without the security tricks first. That makes it a bit simpler to troubleshoot.
Good luck, and enjoy having the benefits of source control!
[1]: http://svn.haxx.se/dev/archive-2004-03/0253.shtml
[2]: http://svn.collab.net/repos/svn/trunk/notes/ssh-tricks |
|.net|sql-server|t-sql|sqlclr| |
WCF, ASP.NET Membership Provider and Authentication Service |
|wcf|web-service|.net| |
I have written a Silverlight 2 application communicating with a WCF service (BasicHttpBinding). The site hosting the Silverlight content is protected using a ASP.NET Membership Provider. I can access the current user using HttpContext.Current.User.Identity.Name from my WCF service, and I have turned on AspNetCompatibilityRequirementsMode.
I now want to write a Windows application using the exact same web service. To handle authentication I have enabled the [Authentication service][1], and can call "login" to authenticate my user... Okey, all good... But how the heck do I get that authentication cookie set on my other service client?!
Both services are hosted on the same domain
- MyDataService.svc <- the one dealing with my data
- AuthenticationService.svc <- the one the windows app has to call to authenticate.
I don't want to create a new service for the windows client, or use another binding...
[1]: http://msdn.microsoft.com/en-us/library/bb386582.aspx |
|.net|web-services|wcf| |
I have written a Silverlight 2 application communicating with a WCF service (BasicHttpBinding). The site hosting the Silverlight content is protected using a ASP.NET Membership Provider. I can access the current user using HttpContext.Current.User.Identity.Name from my WCF service, and I have turned on AspNetCompatibilityRequirementsMode.
I now want to write a Windows application using the exact same web service. To handle authentication I have enabled the [Authentication service][1], and can call "login" to authenticate my user... Okey, all good... But how the heck do I get that authentication cookie set on my other service client?!
Both services are hosted on the same domain
- MyDataService.svc <- the one dealing with my data
- AuthenticationService.svc <- the one the windows app has to call to authenticate.
I don't want to create a new service for the windows client, or use another binding...
The Client Application Services is another alternative, but all the examples is limited to show how to get the user, roles and his profile... But once we're authenticated using the Client Application Services there should be a way to get that authentication cookie attached to my service clients when calling back to the same server.
[1]: http://msdn.microsoft.com/en-us/library/bb386582.aspx |
I have written a Silverlight 2 application communicating with a WCF service (BasicHttpBinding). The site hosting the Silverlight content is protected using a ASP.NET Membership Provider. I can access the current user using HttpContext.Current.User.Identity.Name from my WCF service, and I have turned on AspNetCompatibilityRequirementsMode.
I now want to write a Windows application using the exact same web service. To handle authentication I have enabled the [Authentication service][1], and can call "login" to authenticate my user... Okey, all good... But how the heck do I get that authentication cookie set on my other service client?!
Both services are hosted on the same domain
- MyDataService.svc <- the one dealing with my data
- AuthenticationService.svc <- the one the windows app has to call to authenticate.
I don't want to create a new service for the windows client, or use another binding...
The Client Application Services is another alternative, but all the examples is limited to show how to get the user, roles and his profile... But once we're authenticated using the Client Application Services there should be a way to get that authentication cookie attached to my service clients when calling back to the same server.
According to input from colleagues the solution is adding a wsHttpBinding end-point, but I'm hoping I can get around that...
[1]: http://msdn.microsoft.com/en-us/library/bb386582.aspx |
Unless you want to do something a little complex, using the generic views are the way to go. They are far more powerful than their name implies, and if you are just displaying model data generic views will do the job. |
[This defect][1] (found [here][2]) points the way to the solution. The Tomcat instance that runs in JBoss is configured with emptySessionPath="true", rather than "false", which is the default. This can be modified in `.../deploy/jboss-web.deployer/server.xml`; both the HTTP and AJP connectors have this option.
The feature itself is used to eliminate the context path (eg. "foo" in http://example.com/foo) from being included in the JSESSIONID cookie. Setting it to false will break applications that rely on cross-application authentication, which includes stuff built using some portal frameworks. It didn't negatively affect the application in question, however.
[1]: https://jira.jboss.org/jira/browse/JBAS-4436
[2]: http://forum.springframework.org/showthread.php?t=54688 |
@Dan,
> Do I not need msdtc enabled for
> transactions to work?
Only distributed transactions - Those that involve more than a single connection. Make doubly sure you are only opening a single connection within the transaction and it won't escalate - Performance will be much better too. |
You could consider [log4net][1]. It is a robust logging framework that exists in a single DLL. It is also done in a "non demanding" type mode so that if a critical process is going on, it won't log until resources are freed up a bit more.
You could easily setup a bunch of INFO level loggers and track all the user interaction you needed, and it wouldn't take a bug crash to send the file to yourself. You could also then log all your ERROR and FATAL code to seperate file that could easily be mailed to you for processing.
[1]: http://logging.apache.org/log4net |
I may have misunderstood your question but....
The 'grey bar telling you what type of control it is' only shows up if you are looking at the page in 'design view' in your IDE (are you using Visual Studio?).
Once you run the page this label is not visible.
It is very common for pages that have dynamic/server-side content to 'not look right' when you are looking at them in 'design view'.
Little things like the label/grey bar you are talking about are just there to help you work on the page when it is not populated with the dynamic content.
As a result of this, I find that 99.9% of the time I use 'source view' in my IDE because as your page content becomes more dynamic, the 'design view' becomes more useless. |