I have the string
a.b.c.d
I want to count the occurrences of '.' in an idiomatic way, preferably a one-liner.
(Previously I had expressed this constraint as "without a loop", in case you're wondering why everyone's trying to answer without using a loop).
I am binding a BulletedList control in page load to a datasource, what i want to do is to set custom IDs for this BulletedList's ListItems while binding
This custom ID will be in my current case "li_"+ItemId.ToString()
Sample Code i used to fill the bulletedList:
bulletedList.DataSource = MyDataCollection;
bulletedList.DataTextField = "Name";
bulletedList.DataValueField = "Id";
bulletedList.DataBind();
Hello everyone,
I'm interested in building a JBoss service. Because I'm reusing some existing code, the service must be able to talk SSL/TLS and Protocol Buffers.
The documentation I see on the JBoss wiki makes it look like services have their transport and data interpretation handled by JBoss itself. Is it really the case?
How could I implement this requirement?
Regards,
M-A
I have a datagrid control which is bound to a table which containing more than 1000 records. And i want to show only 25 records once a time. I have used paging in datagrid. But each time the next page index is set, query is fired again. This takes lots of time. So what is the easiest way to bound data in this case to improve performance..??
I want to develop a plugin web project for a web project.
In this case i have to build an aspx which needs
to use site.master of the main
web project. Is it possible using site.master from any other webreference?
Hey there you lot, is there a way that I can open a lightbox (in this case iBox) from within an IFRAME and have the actual lightbox open in the Parent page?
sigh I am confusing myself here!
I have a silly use case for eclipse:
At work, they use 2 spaces for a tab character. Indentation looks really squashed and I'm finding it obstructs readability.
Now, I can't set Eclipse to use 4 spaces for a tab as it'll edit any files I change, and obviously don't want to violate the coding standards.
So, can I have a custom view onto my document, with saving maintaining the original spacing?
Cheers
Actually its the mono version of asp.net, XSP.
In my begin request function i check the url and rewrite when necessary. In one case i do
context.RewritePath("~/App_Data/public" + path);
When i try to request images or anything i get a 404 instead of the content. Why?
I would like to track metrics that can be used to improve my team’s software development process, improve time estimates, and detect special case variations that need to be addressed during the project execution.
Please limit each answer to a single metric, describe how to use it, and vote up the good answers.
I want to pass a rest in a netconnection call, something like this:
public function requestData(service : String, ...params) : void
{
nc.call(service, params);
}
this doesn't work since the call is expecting each parameter to be separated by commas, like:
nc.call(service, params[0], params[1], params[2]);
I've read some posts about apply, but I can't find a solution for this specific case.
I have 2 models:
class A(Model):
#Some Fields
objects = ClassAManager()
class B(A):
#Some B-specific fields
I would expect B.objects to give me access to an instance of ClassAManager, but this is not the case....
>>> A.objects
<app.managers.ClassAManager object at 0x103f8f290>
>>> B.objects
<django.db.models.manager.Manager object at 0x103f94790>
Why doesn't B inherit the objects attribute from A?
I store file’s attributes (size, update time…) in database. So the problem is how to manage transaction for database and file.
In jee environment, JTA is just able to manage database transaction.
In case, updating database is successful but file operation fails, should I write file-rollback method for this? Moreover, file operation in EJB container violates EJB spec.
What’s your opinion? Thank!
Hi,
i don't understand this little thing:
Suppose, we have "Person" model
class Person < ActiveRecord::Base
end
Why Person.all works ?
Person.all.each { |p| do_something }
This syntax tells us, that we have Person class-object instanciated somewhere ?
Or is it some convention over configuration case ?
I have being using this actionbarsherlok to give some nice style to my app. My doubt is that i can test ABS: fragment code, but i want to check out ABS: Demos code. Is it possible? i cant find it on .zip or web page, just the .apk
em i missing something?
in case we can not look that code, is there a good repository where they teach the way to implement the new tabs that android want us to use (3.0+++)?
Hi all
What I am trying to achieve might be trivial, however I am loading a PNG mask which does not have a transparent background, but rather a black background, with the shape defined on top in white (the actual mask which needs to be applied). Apparently Flex expects me to provide a mask with a transparent background for it to work, or am I missing something?
If that's the case, could I transform the bitmapData which I am loading so that it treats black color as transparent?
thanks in advance.
Are the "modify" operators like +=, |=, &= etc atomic?
I know ++ is atomic (if you perform x++; in two different threads "simultaneously", you will always end up with x increased by 2, as opposed to x=x+1 with optimization switched off.)
What I wonder is whether variable |= constant, and the likes are thread-safe or do I have to protect them with a mutex?
(...or is it CPU-dependent? In this case, how is it on ARM?)
I've had geben running perfectly on previous versions of Ubuntu. After the upgrade, and installing the latest version of geben (0.26), it only half works. Specifically, when in context mode, local variables are always marked as undefined.
Has anybody successfully gotten geben up and running under Ubuntu 10.04, or is this a bug in geben (I've reported it as one, but thought I'd check here just in case there is a workaround).
geben 0.26
xdebug 2.0.5
emacs 23.1.1
5.3.2-1ubuntu4.1
Thanks!
I'd like to set up an additional log file in symfony, so that some messages (payment processing in my case) would go to a different file from the rest of symfony. Is it possible? Here's my current log configuration from factories.yml:
all:
logger:
param:
level: debug
loggers:
sf_file_debug:
param:
level: notice
file: /var/log/symfony/%SF_ENVIRONMENT%/%SF_APP%.log
What are those pro/subtle techniques that SQL provides and not many know about which also cut code and improve performance?
eg: I have just learned how to use CASE statements inside aggregate functions and it totally changed my approach on things.
Are there others?
When refactoring away some #defines I came across declarations similar to the following in a C++ header file:
static const unsigned int VAL = 42;
const unsigned int ANOTHER_VAL = 37;
The question is, what difference, if any, will the static make? Note that multiple inclusion of the headers isn't possible due to the classic #ifndef HEADER #define HEADER #endif trick (if that matters).
Does the static mean only one copy of VAL is created, in case the header is included by more than one source file?
I use BroadcastReceiver to intercept incoming call on Android phone as below
tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
Bundle bundle = intent.getExtras();
String number = bundle.getString(TelephonyManager.EXTRA_INCOMING_NUMBER);
In the "private number" case, I tested on two devices, it shows the number as -1 on HTC Wildfire and -2 on Galaxy S. I checked the android.telephony.PhoneNumberUtils but it could't help me.
Is there a function or a generic way to detect a private number on Android phone? Thanks
I have a table like this
C1 C2 C3 Code
1 2 3 33
1 2 3 34
2 4 1 14
1 2 3 14
i want to select only those record whose code is appearing only in single row. ie, in this case rows with code 33 and 34.. as they appear only once in this table.
How can i write a query for that
I am writing a client - server system in which I used NON-BLOCKING sockets. My problem is to detect error { while performing send() or write() } that may occur while data transfer. Example lets say, while the data is being transferred the peer crashes. Another case there is some network problem, something like wire unplugged etc.
As of now, I am using a high level ACK, that peer sends after receiving the complete data.
Ripunjay Tripathi
I've a little problem, I don't really understand if I can use addEventListener more than one time on the same object (and same callback function) if this case can I have a problem of overflow, or simple flex is so smart to not add again in the same stack same function
for examples:
var t:CServiceObj = _rModel.userGetBoardJoined();
t.addEventListener(EDataService.DATA_AVAILABLE,onDataOk);
t.addEventListener(EDataService.DATA_AVAILABLE,onDataOk);
t.addEventListener(EDataService.DATA_AVAILABLE,onDataOk);