I found this resource when looking to commonly format user's phone numbers.... http://www.eyesis.ca/projects/formatphone.html
I was wondering if someone else might have a better solution.
Hi,
I have a string that is
$str = "testingSUB1";
How can I strip out SUB* from the string? I assume using preg_replace but I'm not good with matching what I want with regex.
Does anyone know how I can do this?
Thank you
I have a winform application that fires a Stored Procedure which elaborates several records (around 500k). In order to inform the user about how many record have been processed, I would need a SP which returns a value every n records. For example, every 1000 row processed (most are INSERT).
Otherwise I would be able only to inform when ALL record are processed. Any hints how to solve this?
I thought it could be useful to use a trigger or some scheduled task, but I cannot figure out how to implement it.
I am trying to find a reference for approximately how many CPU cycles various operations require.
I don't need exact numbers (as this is going to vary between CPUs) but I'd like something relatively credible that gives ballpark figures that I could cite in discussion with friends.
As an example, we all know that floating point division takes more CPU cycles than say doing a bitshift.
I'd guess that the difference is that the division is around 100 cycles, where as a shift is 1 but I'm looking for something to cite to back that up.
Can anyone recommend such a resource?
I have the following Model:
Entities:
Product (Contains basic data for
products: price, etc)
Attribute (Contains data for all possible optional attributes)
ProductAttribute (Contains data for optional attributes of a product, eg.
Color, Model, Size). ProductAttribute
is essentially a many to many
relationship with payload (ProductId,
AttributeID, Value)
And this piece of code:
private static void ListAttributes(Product p)
{
p.ProductAttributes.Load();
foreach (var att in p.ProductAttributes)
{
att.Attribute.load();
Console.WriteLine("\tAttribute Name:{0} - Value {1}",
att.Attribute.Name,
att.AttributeValue);
}
}
This piece of code will fire a query for each time the att.Attribute.Load() method is called in the foreach loop, only so i can get display the name of the attribute.
I would like to fetch the Attribute.Name together with the query that fetches all attribute values, i.e. join ProductAttribute and Attribute.
Is there any way to achieve this within my method?
I have a Biztalk project that imports an incoming CSV file and dumps it to a database table. The import works fine, but I only need to keep about 200-300 records from a file with upwards of a million rows. My orchestration discards these rows, but the problem is that the flat file I'm importing is still 250MB, and when converted to XML using a regular flat file pipeline, it takes hours to process and sometimes causes the server to run out memory.
Is there something I can do to have the Custom Pipeline itself discard rows I don't care about? The very first item in each CSV row is one of a few strings, and I only want to keep rows that start with a certain string.
Thanks for any help you're able to provide.
My question is a follow-up to the issue posted here
regarding the Intellisense performance issue when building a large solution in VS2008 that has many partial static classes.
Since Microsoft does not seem to be addressing the issue for VS2008, I would like to know if there are other ways around the problem? Waiting for VS2010 is not an option at this time. The proposed solution in the previous post is not practical as some of the partial classes may be regenerated and this would be a maintenance headache.
Hi,
I have over 2000 HTML files that are now in Wordpress blog. I have the URL Map of Old_file.html and new wordpress URL.
I want 301 redirect but don't want to add 2000 lines to htaccess. Can you please suggest how to accomplish this using PHP so that when there is a request for old url, the php script should lookup into the database and redirect(301) to the new URL ?
Thanks.
I am looking for how to style a label in a UITableView cell, so that it shows how many children/messages are in the next view controller.
This is used in Apple's Mail app, to show how many messages are in the inbox or account.
I am sure that this is a UILabel, but what font, color and how to make the oval around it?
can any body help me out this problem,
I have jquery grid, i am trying to display 20k records or users on the grid?
what i am doing is first using stored procrdure i am getting all 20k records, initially each page 100 records i am shoiwng in the jquery grid...
on the top of the jquery grid i have GetAll button,,, if i click this button i need to see all 20k records on the grid in a single page..
is there any way we can handle this?
thanks
Ignore spaces, punctuation and anything else that is not a letter. Ignore the case of the incoming letters (so e.g. 'A' and 'a' should be counted together). The results of analysing this string should be added to any analysis performed by previous calls to this method.
Hi all
I have a text file like below
2 1 2
5 10 13 11 12 14
2 0 1
2 99 2
200 2
1 5
5 1 2 3 4 5
1 0
0 0
I want to read file line by line, and read the umbers from each line. I know how to use the stream to read a fixed field line, but what about the non-fixed line?
Best Regards,
When using the beamer documentclass, it looks like the third level of nested input is ignored:
\documentclass{beamer}
\input{body}
body.tex:
\begin{document}
\input{file1}
\input{file2}
\end{document}
file2.tex:
\input{file21}
The content of file21.tex is ignored with documentclass beamer, but correctly inserted if I use a documentclass article, for example.
Has anyone seen something like this?
I have many events on a day, and it works as expected but now looking at the month view, my calendar grid is much taller that expected. I'd like to hide some of these events from the month view, like a summary with a visual que that there are more on this day than can be shown.
I can use eventRender and return false, but i would like to know how many events are on a given day, so i can limit the rendering to about 4, then perhaps i would add an event that says " more ... "
So the question may be : how to count the events on a given date ?
or is this more like a feature request to expose a max counter for month view ?
thanks
I am working on an enterprise application where I can have several links present in table or none depending on the data.
The links appear in the table and have following code behind them
<td class="Row"><span id='s_3_2_14_0' ><a href='JavaScript:SWETargetGotoURL("/eservice_enu/start.swe?SWECmd=GotoView&SWEView=Active+PO+Serial+View&SWEPostnApplet=Purchase+Order+List+Applet&SWEPostnRowId=1-KPBLOZ","_self")'>2001103009</a></span></td>
I need to find all the A tags present in the page inside SPAN tag
having following text
SWEView=Active+PO+Serial+View&SWEPostnApplet=Purchase+Order+List+Applet
I tried the following expression but it returns 0
$('a[href*="SWEView=Active+PO+Serial+View&SWEPostnApplet=Purchase+Order+List+Applet"').length;
I'm using this code:
s = line.match( /ABCD(\d{4})/ ).values_at( 1 )[0]
To extract numbers from strings like:
ABCD1234
ABCD1235
ABCD1236
etc.
It works, but I wonder what other alternative I have to to this in Ruby?
I would like to create a color generator based on random numbers, which might differ just slightly, but I need colors to be easily recognizable from each other. I was thinking about generation then in a rgb format which would be probably easiest. I'm afraid simply multiplying given arguments wouldn't do very well. What algorithm do you suggest using? Also, second generated color should not be the same as previous one, but I don't want to store them - nor multiplying with (micro)time would do well since the scripts' parts are usually faster.
What is the upper limit of records for MySQL database table. I'm wondering about autoincrement field. What would happen if I add milions of records? How to handle this kind of situations?
Thx!
I'm trying to initialize an int array with everything set at -1.
I tried the following, but it doesn't work. It only sets the first value at -1.
int directory[100] = {-1};
Why doesn't it work right?
In c++ 0x10 is the way to represent a hex value.
if I leave off the 0x then it's dec. Is there a way to define a binary?
Not that I can't derive 0x0003 is 11, but it would be cool if I could use
0b0011. It would just make the code a little more obvious.
Problem: We have x checkboxes and we want to check y of them evenly.
Example 1: select 50 checkboxes of 100 total.
[-]
[x]
[-]
[x]
...
Example 2: select 33 checkboxes of 100 total.
[-]
[-]
[x]
[-]
[-]
[x]
...
Example 3: select 66 checkboxes of 100 total:
[-]
[x]
[x]
[-]
[x]
[x]
...
But we're having trouble to come up with a formula to check them in code, especially once you go 11/111 or something similar. Anyone has an idea?
I'm working on a large ERP project which has database model with about 2100 tables. With "only" 500 tables mapped with Hibernate, application deployed on the web server takes about 3GB of working memory.
Is there any way to reduce Hibernate's metamodel memory footprint when using that many tables in one persistence unit? Or should I just give up on ORMs and go with plain old JDBC (or even jOOQ)?
Right now I'm using Hibernate 4.1.8, Spring 3.1.3, JBoss AS 7.1 and working with MSSQL database.
Edit:
JavaMelody memory histogram output - with 2000 generated test tables that are a bit smaller in scope from the original db model (hence 'only' 1.3GB of spent memory)
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 523800 bytes) in /Library/WebServer/Documents/XMLDataStore.class.php on line 981
The curious thing about this error is not the memory leak, which would be easy enough to troubleshoot. Rather, it is the fact that XMLDataStore.class.php is only 850 lines long, which I have verified in multiple text editors.
This is with the PHP 5.3 bundled with Snow Leopard. I'm not using an opcode cache. Here is my php.ini:
allow_url_fopen = Off
error_reporting = -1
display_errors = 1
display_startup_errors = 1
date.timezone = 'America/Los_Angeles'
output_buffering = Off
realpath_cache_size = 0k
XMLDataStore.class.php has recently been refactored and it used to be longer than 981 lines. It's almost as if PHP has cached a 2-week-old version and is reading that. I'm positive that the current version at /Library/WebServer/Documents/XMLDataStore.class.php is only 850 lines long, though.