Anyone has experience measuring glibc regexp functions?
Are there any generic tests I need to run to make such a measurements (in addition to testing the exact patterns I intend to search)?
Thanks.
Hi all
As we know for UDP receive, we use Socket.ReceiveFrom or UdpClient.receive
Socket.ReceiveFrom accept a byte array from you to put the udp data in.
UdpClient.receive returns directly a byte array where the data is
My question is that How to set the buffer size inside Socket. I think the OS maintains its own buffer for receive UDP data, right? for e.g., if a udp packet is sent to my machine, the OS will put it to a buffer and wait us to Socket.ReceiveFrom or UdpClient.receive, right?
How can I change the size of that internal buffer?
I have tried Socket.ReceiveBuffSize, it has no effect at all for UDP, and it clearly said that it is for TCP window. Also I have done a lot of experiments which proves Socket.ReceiveBufferSize is NOT for UDP.
Can anyone share some insights for UDP internal buffer???
Thanks
Hi,
I'm taking some information from some variables I have already defined outside this function to create a html svg text box.
Here is the function which is causing me trouble:
RenderTextBox:function()
{
alert('this.x: ' + this.x);
alert('this.y: ' + this.y);
this.textBox = paper.text(this.x, this.y, this.htmlTextBox);
}
The alerts works prefectly, and prompt me with the values expected. However, the final line which is supposed to create the text box puts them nowhere to be seen. Does anybody know why?
If I replace 'this.x, this.y..' with numerical values in the final line of the function, the text box is placed correctly. It's only when I use the 'this.x' and 'this.y' that I have issues.
I have the following code in a subroutine that produces an incompatible types in initialization error on the varVal library in the subroutine evaluateExpression:
NSDictionary *varVal;
for (int i=0; i<varCount; i++) {
[varVal setObject:[(i+1)*2 stringValue] forKey:[i stringValue]];
}
double result =[[self brain] evaluateExpression:[[self brain] expression]
usingVariableValues:varVal];
My subroutine declaration in the brain.h file is:
+(double)evaluateExpression:(id)anExpression
usingVariableValues:(NSDictionary *)variables;
I'd appreciate any help.
Hi,
I am aware of this question already existing, but it has given me no luck.
I have an application which loads a physicial XML document via the following method:
jQuery.ajax( {
type: "GET",
url: fileName,
dataType: "xml",
success: function(data) {
etc...
I parse the XML and convert it into a string which is saved into a variable so that it can easily be stored in a database. How can I now convert the data in this variable back into an XML object so that it can be parsed as such?
I need to fetch only first record (because I need last date) of resultset, at the moment I have this resultset from this sql tring:
SELECT BCACC,FLDAT
FROM ANAGEFLF
ORDER BY FLDAT DESC
and I see this record:
A.M.T. AUTOTRASPORTI SRL 20080220
A.M.T. AUTOTRASPORTI SRL 20080123
A.M.T. AUTOTRASPORTI SRL 20070731
APOFRUIT ITALIA 20080414
APOFRUIT ITALIA 20080205
APOFRUIT ITALIA 20071210
APOFRUIT ITALIA 20070917
APOFRUIT ITALIA 20070907
now I need to take only one record (first) for every BCACC, I would take this resultset:
A.M.T. AUTOTRASPORTI SRL 20080220
APOFRUIT ITALIA 20080414
I've just try group it for BCACC but I receive an sql error, I'm workin on DB2 ibmI
Is it possible to use NServiceBus to publish and consume messages in the same application, specifically a web application?
In the future we will almost certainly need to maintain a separate long running service to process messages generated by this application, and this is why we are hoping to use NServiceBus from the start, but right now it would be nice to just start up the consumer and the publisher when the web application starts. This will make testing and deployment far easier for us.
I presume I will need to reference the NServiceBus.Host.exe and start up the process in the global.asax, but need help on what exactly I need to call to do this.
This query fails when I add the line shown...
:BEGIN FAIL:
I have this so far
Select Companyid, count(*) as cnt
from mytable
where State is not null
and cnt = 1 <------------------------- FAIL
group by CompanyID
:END FAIL:
Any way to do this?
Here's a long winded background if it'll help....
I have a single table query.
here's a sample of the table:
CompanyID, State
1,OH
1,IL
1,NY
2,IL
3,NY
3,OH
4,NY
5,CA
5,WA
I want a query that'll return something like this:
2,IL
4,NY
I have this so far
Select Companyid, count(*) as cnt
from mytable
where State is not null
group by CompanyID
This gives me a count of the number of records for each company.
IE:
1,3
2,1
3,2
4,1
5,2
Now I want to filter the above list to just the two records with one result.
I tried adding another where clause, but it failed:
BEGIN FAIL:
I have this so far
Select Companyid, count(*) as cnt
from mytable
where State is not null
and cnt = 1 <-------------------- FAIL
group by CompanyID
END FAIL:
I scripted the tables in my dev database using SQL 2008 - generate scripts option (Datbase-right click-Tasks-Generate Scripts) and ran it on the staging database, but the script throws the below error for each table
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near '('. Msg 319,
Level 15, State 1, Line 15 Incorrect
syntax near the keyword 'with'. If
this statement is a common table
expression, an xmlnamespaces clause or
a change tracking context clause, the
previous statement must be terminated
with a semicolon.
Below is the script for one of my table
ALTER TABLE [dbo].[Customer](
[CustomerID] [int] IDENTITY(1,1) NOT NULL,
[FirstName] [nvarchar](500) NULL,
[LastName] [nvarchar](500) NULL,
[DateOfBirth] [datetime] NULL,
[EmailID] [nvarchar](200) NULL,
[ContactForOffers] [bit] NULL,
CONSTRAINT [PK_Customer] PRIMARY KEY CLUSTERED
(
[CustomerID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
Any help will be much appreciated.
I´m using Visual Studio 2008, C#
DataGridView: can you add an unbound column to a Data Bound grid?
It seems pretty simple, just select the properties ("DataGridView Tasks box") for the data bound DataGridView, and select Add unbound column.
However, when in runtime there will be a System.FormatException - which I can understand, as I don´t know how to "initialize" the cells in the new unbound columns.
I was planning initializing it programmatically via CellFormatting event - but so far I´m failing.
Any tips? Just want to get it up and running in SOME way...
I need to implement a web API for a project I'm working on in this period. I read there are many standard protocols to do it: XML-RPC, SOAP, REST. Apparently, the XML-RPC one is the easiest one to implement and use from what I saw, but I didn't find anything about using it to implement an API. Instead I found many tutorial about creating a REST API in PHP, for example. Is there any counter-indication for using XML-RPC to implement a public web API?
Also, more generally speaking, I could (sort of) define a custom protocol for my API, to keep things simpler (i.e. accepting only GET request containing the parameters I need): would this be so bad? Is using a standard protocol a must-do?
Hello
I'm trying to build an app with ASP.NET MVC 1.0. I already have installed MVC 1.0 but after running the application It trows an exception:
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS1705: Assembly 'MVC_CustomControls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' uses 'System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version than referenced assembly 'System.Web.Routing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
Any help is greatly appreciated.
Hello, I've been trying to put a UIWebView into my app, which is tableview based. When the user selects a row, I want the new xib to load, but this one with a UIWebView on it. From all of the tutorials I've seen, you can only put a UIWebView on the MainView.xib. Can someone please tell me how to put a FUNCTIONING UIWebView somewhere other than the main view? Thanks in advance!!
var groups = from p in dc.Pool
join pm in dc.PoolMembers on p.ID equals pm.PoolID
group p by p.Group into grp
select new { grp.ID };
This isn't working. Basically I want to do the grouping, and then select certain columns, but when I do select new { grp. } I get no intellisense, so I'm obviously doing something wrong.
Any ideas?
Hello!
I'm learning OCaml and although I have years of experience with imperative programming languages (C, C++, Java) I'm getting some problems with delimiters between declarations or expressions in OCaml syntax.
Basically I understood that I have to use ; to concatenate expressions and the value returned by the sequence will be the one of last expression used, so for example if I have
exp1; exp2; exp3
it will be considered as an expression that returns the value of exp3. Starting from this I could use
let t = something in exp1; exp2; exp3
and it should be ok, right?
When am I supposed to use the double semicol ;;? What does it exactly mean?
Are there other delimiters that I must use to avoid syntax errors?
I'll give you an example:
let rec satisfy dtmc state pformula =
match (state, pformula) with
(state, `Next sformula) ->
let s = satisfy_each dtmc sformula
and adder a state =
let p = 0.;
for i = 0 to dtmc.matrix.rows do
p <- p +. get dtmc.matrix i state.index
done;
a +. p
in
List.fold_left adder 0. s
| _ -> []
It gives me syntax error on | but I don't get why.. what am I missing? This is a problem that occurs often and I have to try many different solutions until it suddently works :/
A side question: declaring with let instead that let .. in will define a var binding that lasts whenever after it has been defined?
What I basically ask is: what are the delimiters I have to use and when I have to use them. In addition are there differences I should consider while using the interpreter ocaml instead that the compiler ocamlc?
Thanks in advance!
Anyone know how to get a random set of lines from a text file?
I want to get a set of 3 lines with
<br>
on the front of each and display them through html.
example:
set 1
<br>Hi
<br>what's your name
<br>goodbye
set 2
<br>stack
<br>overflow
<br>hi there
set 3,4,5....
Choose one random set and display it.
The sets of lines would be stored in a text file.
Thanks a lot!
I already set USE_L10N = True in settings.py
But in following view:
from django.contrib.humanize.templatetags.humanize import intcomma
dev view_name(request):
output = intcomma(123456)
Output is always "123,456" for all locales.
I have multiple email addresses linked to my gmail account.
I am signed up to some email groups that send emails out with
To: [email protected]
I can't remember which email address I used to sign up for this group. How do I find out which email address this was addressed to?
Hi, I am curious, do new compilers use some extra features built into new CPUs such as MMX SSE,3DNow! and so? I mean, in original 8086 there was even no FPU, so compiler that old cannot even use it, but new compilers can, since FPU is part of every new CPU. So, does new compilers use new features of CPU? Or, it should be more right to ask, does new C/C++ standart library functions use new features? Thanks for answer.
I'm trying to hide all panels on a page, when a button click occurs.
This is on a web content form, within a master page.
The contentplageholder is named: MainContent
So I have:
foreach (Control c in Page.Form.FindControl("MainContent").Controls) {
if (c is Panel) {
c.Visible = false;
}
}
This never find any panels. The panels are within an Update Panel, and I tried
foreach(Control c in updatePanel.Controls) { }
and this didn't work either. I also tried :
foreach(Control c in Page.Controls) { }
and that didn't work either.
Any idea what I'm missing here?
My program use UdpClient to try to receive 27 responses from 27 hosts. The size of the response is 10KB. My broadband incoming bandwidth is 150KB/s.
The 27 responses are sent from the hosts almost at the same time and for every 10 secs.
However, I can only receive 8 - 17 responses each time. The number of responses that I can receive is quite dynamic but within the range.
Can anyone tell me why? why can't I receive all?
I understand UDP is not reliable. but I tried receiving 5 - 10 responses at the same time, it worked. I guess the network links are not so bad.
The code is very simple. ON the 27 hosts, I just use UdpClient to send 10KB to my machine.
On my machine, I have one UdpClient receive datagrams. Each time I get a data, I create a thread to handle it (basically handling it means just print out "I received 10KB", but it runs in a thread).
listener = new UDPListener(Port);
listener.Start();
while (true) {
try {
UDPContext context = listener.Accept();
ThreadPool.QueueUserWorkItem(new WaitCallback(HandleMessage), context);
} catch (Exception) { }
}
If I reduce the size of the response down to 3KB, the case gets much better that roughly 25 responses can be received.
Any more idea? UDP buffer problems???
Currently I have a function which loops to create multiple HTML objects. Each time an object is created, I want to add an onClick function listener to that object so that I can trigger a function when each one is clicked.
What's the best way to do this?
Here's the code which creates my objects:
RenderMultipleChoice:function()
{
this.c = paper.rect(this.x, this.y, this.shapeWidth, this.shapeHeight);
}
Ive got some nested objects that I am trying to generate reports for. A BackupClient contains BackupVersions and BackupVersions contain BackupFiles. I passed in the list of BackupClients - and the report displays the client name, etc.... but to display the versions - It says I have to have a Binding Source for BackupVersions. If I pull all of the versions out of the clients and put them in a different BindingSource, then my data is no longer together - how is the report viewer going to list the versions for client X - if I just have a binding source with ALL clients versions in it?
Hi,
I have a 'for' loop which extracts data from an XML document and adds it into some JavaScript objects, each time the loop executes I want it to run a certain function depending on the value of the attribute 'typ' which is being retrieved from the xml.
Currently, the data from the XML is successfully being parsed, which is proven by the first 'alert' you can see which produces the correct value.
However, neither of the 'alert' lines in the 'if' statement lower down are being executed and as a result I cannot test the 'ctyp3' function which is supposed to be called.
Where have I gone wrong?
for (j=0; j<arrayIds.length; j++)
{
$(xml).find("C[ID='" + arrayIds[j] + "']").each(function(){
// pass values
questions[j] = {
typ: $(this).attr('typ'),
width: $(this).find("I").attr('wid'),
height: $(this).find("I").attr('hei'),
x: $(this).find("I").attr('x'),
y: $(this).find("I").attr('x'),
baC: $(this).find("I").attr('baC'),
boC: $(this).find("I").attr('boC'),
boW: $(this).find("I").attr('boW')
}
alert($(this).attr('typ'));
if ($(this).attr('typ') == '3')
{
ctyp3(x,y,width,height,baC);
alert('pass');
} else {
// Add here
alert('fail');
}
});
}
Obviously there is no public GUID.TryParse() in .NET CLR 2.0.
So, I was looking into regular expressions [aka googling around to find one] and each time I found one there was a heated argument in the comments section about RegEx A doesn't work, use RegEx B. Then someone would write Regex C yadda yadda
So anyway, What I decided to do was this, but I feel bad about it.
public static bool IsGuid (string possibleGuid) {
try {
Guid gid = new Guid(possibleGuid);
return true;
} catch (Exception ex) {
return false;
}
}
Obviously I don't really like this since it's been drilled into me since day one to avoid throwing exceptions if you can defensibly code around it.
Does anyonek now why there is no public Guid.TryParse() in the .NET Framework?
Does anyone have a real Regular Expression that will work for all GUIDs?