I am looking for simple and easy to use tools through which I can get project's visual picture of folder/file tree stucture , its classes, functions and objects, relations between classes and files.
I am pretty sure these classes are not thread safe.
But, is it safe to use different objects from these classes in different threads?
Do they have any global dependencies with each other like static data or anything to watch out for?
Take a look at this example, and notice the outputs indicated.
<?php
class Mommy
{
protected static $_data = "Mommy Data";
public static function init( $data )
{
static::$_data = $data;
}
public static function showData()
{
echo static::$_data . "<br>";
}
}
class Brother extends Mommy
{
}
class Sister extends Mommy
{
}
Brother::init( "Brother Data" );
Sister::init( "Sister Data" );
Brother::showData(); // Outputs: Sister Data
Sister::showData(); // Outputs: Sister Data
?>
My understanding was that using the static keyword would refer to the child class, but apparently it magically applies to the parent class whenever it is missing from the child class. (This is kind of a dangerous behavior for PHP, more on that explained below.)
I have the following two things in mind for why I want to do this:
I don't want the redundancy of defining all of the properties in all of the child classes.
I want properties to be defined as defaults in the parent class and I want the child class definition to be able to override these properties wherever needed. The child class needs to exclude properties whenever the defaults are intended, which is why I don't define the properties in the child classes in the above example.
However, if we are wanting to override a property at runtime (via the init method), it will override it for the parent class! From that point forward, child classes initialized earlier (as in the case of Brother) unexpectedly change on you.
Apparently this is a result of child classes not having their own copy of the static property whenever it isn't explicitly defined inside of the child class--but instead of throwing an error it switches behavior of static to access the parent. Therefore, is there some way that the parent class could dynamically create a property that belongs to the child class without it appearing inside of the child class definition? That way the child class could have its own copy of the static property and the static keyword can refer to it properly, and it can be written to take into account parent property defaults.
Or is there some other solution, good, bad, or ugly?
The Cassandra API supports batch mutations:
batch_mutate(keyspace, mutation_map,
consistency_level): Executes the
specified mutations on the keyspace.
mutation_map is a map; the
outer map maps the key to the inner
map, which maps the column family to
the Mutation; can be read as: map. To be more specific,
the outer map key is a row key, the
inner map key is the column family
name. A Mutation specifies either
columns to insert or columns to
delete. See Mutation and Deletion
above for more details.
Are all mutations that are executed in a batch executed atomically? So if one of the mutations fails, do the others fail too?
Are there any ways to get count of current unfinished tasks at Google Appengine development server? I need it for making my integration test.
I found a way to get this when running it local (just in mem), as described at appengine docs.
But when i'm running it as a standalone server, from maven, this doesn't work. Just because library appengine-testing conflicts with Appengine SDK classes, and i can't use those classes together, when running sdk dev server.
What's the difference between these two queries? I've been resistant to jumping on the ANSI-syntax bandwagon because I have not been able to unravel various syntactical ambiguities.
Is 1) returning the product of the join and only then filtering out those joined records which have weight = 500? And is 2) filtering out those prior to the join?
Is 2 bad syntax? Why might I use that?
1:
SELECT SOMETHING
FROM FOO
INNER JOIN BAR
ON FOO.NAME = BAR.NAME
WHERE BAR.WEIGHT < 500
2:
SELECT SOMETHING
FROM FOO
INNER JOIN BAR
ON FOO.NAME = BAR.NAME AND BAR.WEIGHT < 500
Hi everybody,
In an application we are developpment, we are accessing Active Directory users and groups using the .Net DirectoryEntry and DirectorySearcher classes. Managing the test groups and users during development is getting tedious.
I am wondering if there was an easy way to setup a simple local AD in which we could easily create / delete users and assign them or remove them from groups as we want with the DirectoryEntry / DirectorySearcher classes?
Thanks.
Hello
I have this query:
SELECT *
FROM SAMPLE SAMPLE
INNER JOIN TEST TEST ON SAMPLE.SAMPLE_NUMBER = TEST.SAMPLE_NUMBER
INNER JOIN RESULT RESULT ON TEST.TEST_NUMBER = RESULT . TEST_NUMBER
WHERE SAMPLED_DATE BETWEEN '2010-03-17 09:00' AND '2010-03-17 12:00'
the biggest table here is RESULT, contains 11.1M records. The left 2 tables about 1M.
this query works slowly (more than 10 minutes) and returns about 800 records. executing plan shows clustered index scan over all 11M records.
RESULT.TEST_NUMBER is a clustered primary key.
if I change 2010-03-17 09:00 to 2010-03-17 10:00 - i get about 40 records. it executes for 300ms. and plan shows clustered index seek
if i replace * in SELECT clause to RESULT.TEST_NUMBER (covered with index) - then all become fast in first case too. this points to hdd io issues, but doesn't clarifies changing plan.
so, any ideas?
Apple, for memory management issues, recommend defining outlets on properties, not in the attribute declaration. But, as far as I know, declaring properties exposes the class to external classes, so this could be dangerous.
On UIViewController we have the main view definition and the logic, so MVC is slightly cheated in this cases.
What is the beteer approach, Apples's recommendation for memory-management or armored classes?
I have two tables in sqlite:
CREATE TABLE fruit ('fid' integer, 'name' text);
CREATE TABLE basket ('fid1' integer, 'fid2' integer, 'c1' integer, 'c2' integer);
basket is supposed to have count c1 of fruit fid1 and c2 of fruit fid2
I created a view fruitbasket;
create view fruitbasket as select * from basket inner join fruit a on a.fid=basket.fid1 inner join fruit b on b.fid=basket.fid2;
it works (almost) as expected.
When I type
pragma table_info(fruitbasket);
I get the following output
0|fid1|integer|0||0
1|fid2|integer|0||0
2|c1|integer|0||0
3|c2|integer|0||0
4|fid|integer|0||0
5|name|text|0||0
6|fid:1|integer|0||0
7|name:1|text|0||0
The problem is that I cannot seem to SELECT name:1. How can I do it other than going back and re-aliasing the columns?
I'm designing a simple expander control.
I've derived from UserControl, drawn inner controls, built, run; all ok.
Since an inner Control is a Panel, I'd like to use it as container at design time. Indeed I've used the attributes:
[Designer(typeof(ExpanderControlDesigner))]
[Designer("System.Windows.Forms.Design.ParentControlDesigner, System.Design", typeof(IDesigner))]
Great I say. But it isn't...
The result is that I can use it as container at design time but:
The added controls go back the inner controls already embedded in the user control
Even if I push to top a control added at design time, at runtime it is back again on controls embedded to the user control
I cannot restrict the container area at design time into a Panel area
What am I missing? Here is the code for completeness... why this snippet of code is not working?
[Designer(typeof(ExpanderControlDesigner))]
[Designer("System.Windows.Forms.Design.ParentControlDesigner, System.Design", typeof(IDesigner))]
public partial class ExpanderControl : UserControl
{
public ExpanderControl()
{
InitializeComponent();
....
[System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name = "FullTrust")]
internal class ExpanderControlDesigner : ControlDesigner
{
private ExpanderControl MyControl;
public override void Initialize(IComponent component)
{
base.Initialize(component);
MyControl = (ExpanderControl)component;
// Hook up events
ISelectionService s = (ISelectionService)GetService(typeof(ISelectionService));
IComponentChangeService c = (IComponentChangeService)GetService(typeof(IComponentChangeService));
s.SelectionChanged += new EventHandler(OnSelectionChanged);
c.ComponentRemoving += new ComponentEventHandler(OnComponentRemoving);
}
private void OnSelectionChanged(object sender, System.EventArgs e)
{
}
private void OnComponentRemoving(object sender, ComponentEventArgs e)
{
}
protected override void Dispose(bool disposing)
{
ISelectionService s = (ISelectionService)GetService(typeof(ISelectionService));
IComponentChangeService c = (IComponentChangeService)GetService(typeof(IComponentChangeService));
// Unhook events
s.SelectionChanged -= new EventHandler(OnSelectionChanged);
c.ComponentRemoving -= new ComponentEventHandler(OnComponentRemoving);
base.Dispose(disposing);
}
public override System.ComponentModel.Design.DesignerVerbCollection Verbs
{
get
{
DesignerVerbCollection v = new DesignerVerbCollection();
v.Add(new DesignerVerb("&asd", new EventHandler(null)));
return v;
}
}
}
I've found many resources (Interaction, designed, limited area), but nothing was usefull for being operative...
I have two DBs. The 1st db has CallsRecords table and 2nd db has Contacts table, both are on SQL Server 2005.
Below is the sample of two tables.
Contact table has 1,50,000 records
CallsRecords has 75,000 records
Indexes on CallsRecords:
CallFrom
CallTo
PickUP
Indexes on Contacts:
PhoneNumber
I am using this query to find matches but it take more than 7 minutes.
SELECT *
FROM CallsRecords r INNER JOIN Contact c ON r.CallFrom = c.PhoneNumber
OR r.CallTo = c.PhoneNumber OR r.PickUp = c.PhoneNumber
In Estimated execution plan inner join cost 95%
Any help to optimize it.
Hi everybody,
for a web service, depending on a XML file, there are a couple af classes in C# generated.
Depending on these classes, there is at compile time then the WSDL file generated.
Is there a possibility at runtime to simply replace the XML file and to have the WSDL file generated on the fly?
Best regards,
Valer
Assume we have the following Swing application:
final JFrame frame = new JFrame();
final JPanel outer = new JPanel();
frame.add(outer);
JComponent inner = new SomeSpecialComponent();
outer.add(inner);
So in this example we simply have an outer panel in the frame and a special component in the panel. This special component must do something when it is hidden and shown. But the problem is that setVisible() is called on the outer panel and not on the special component. So I can't override the setVisible method in the special component and I also can't use a component listener on it. I could register the listener on the parent component but what if the outer panel is also in another panel and this outer outer panel is hidden?
Is there an easier solution than recursively adding componentlisteners to all parent components to detect a visibility change in SomeSpecialComponent?
I'm looking for a way to serialize Java objects into XML for use by a RESTful web service. I don't have an XSD.
I have looked at the following:
JAXB - fairly heavy weight with annotations required on classes and also an ObjectFactory class and/or a jaxb.index file
Simple - requires annotations but no other config classes/files. Unfortunately it can't serialize Sets.
XStream - no annotations etc. required, but doesn't support generics
Does anyone else have any suggestions?
Hi Experts,
Is it possible to change order of records/groups in a result-set from a query using Group By?
=I have a query:
SELECT Category,
Subcategory,
ProductName,
CreatedDate,
Sales
From TableCategory tc INNER JOIN
TableSubCategory ts ON tc.col1 = ts.col2 INNER JOIN
TableProductName tp ON ts.col2 = tp.col3
Group By Category,
SubCategory,
ProductName,
CreatedDate,
Sales
= Now, I am creating a ssrs report where Category is Primary row group, then SubCategory is its child row group. Then ProductName is a Primary Column Group.
It works perfect, But it shows the ProductNames in alphabatic order. I want it to show the ProductNames in custom order(defined by me).Like,
ProductNo5 in 3rd column,
ProductNo8 in 4th column,
ProductNo1 in 5th column ... and so on!
Hi
How can I prevent inheritance of some methods or properties in derived classes?!
public class BaseClass : Collection
{
//Some operations...
//Should not let derived classes inherit 'Add' method.
}
public class DerivedClass : BaseClass
{
public void DoSomething(int Item)
{
this.Add(Item); // Error: No such method should exist...
}
}
In order for a school project i need to create the following situation within one mysql query.
The situation is as such, that a child's tags and a parent's tags need to be combined into one, and compared to a site's tags, depending on a few extra simple equals to lines.
For this to happen I only see the option that the result of a subquery is combined with a sub query within that query, as such:
SELECT tag.*, (SELECT group_concat(t1.id, ',', (SELECT
group_concat(tag.id)
FROM
adcampaign
INNER JOIN adcampaign_tag ON adcampaign.id = adcampaign_tag.adcampaign_id
INNER JOIN tag ON adcampaign_tag.tag_id = tag.id
WHERE
adcampaign.id = 1))
FROM
ad, ad_tag, tag AS t1
WHERE
ad.id = ad_tag.ad_id AND
ad_tag.tag_id = t1.id AND
ad.adcampaign_id = 1 AND
ad.agecategory_id = 1 AND
ad.adsize_id = 1 AND
ad.adtype_id = 1) as tags
FROM tag WHERE tag.id IN tags
But the IN comparison only returns the first result because now the tags aren't a list but a concanated string.
Anyone got any suggestion on this? I really need a way to combine it into one array
I'm running into an odd issue in Objective-C when I have two classes using initializers of the same name, but differently-typed arguments. For example, let's say I create classes A and B:
A.h:
#import <Cocoa/Cocoa.h>
@interface A : NSObject {
}
- (id)initWithNum:(float)theNum;
@end
A.m:
#import "A.h"
@implementation A
- (id)initWithNum:(float)theNum
{
self = [super init];
if (self != nil) {
NSLog(@"A: %f", theNum);
}
return self;
}
@end
B.h:
#import <Cocoa/Cocoa.h>
@interface B : NSObject {
}
- (id)initWithNum:(int)theNum;
@end
B.m:
#import "B.h"
@implementation B
- (id)initWithNum:(int)theNum
{
self = [super init];
if (self != nil) {
NSLog(@"B: %d", theNum);
}
return self;
}
@end
main.m:
#import <Foundation/Foundation.h>
#import "A.h"
#import "B.h"
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
A *a = [[A alloc] initWithNum:20.0f];
B *b = [[B alloc] initWithNum:10];
[a release];
[b release];
[pool drain];
return 0;
}
When I run this, I get the following output:
2010-04-26 20:44:06.820 FnTest[14617:a0f] A: 20.000000
2010-04-26 20:44:06.823 FnTest[14617:a0f] B: 1
If I reverse the order of the imports so it imports B.h first, I get:
2010-04-26 20:45:03.034 FnTest[14635:a0f] A: 0.000000
2010-04-26 20:45:03.038 FnTest[14635:a0f] B: 10
For some reason, it seems like it's using the data type defined in whichever @interface gets included first for both classes. I did some stepping through the debugger and found that the isa pointer for both a and b objects ends up the same. I also found out that if I no longer make the alloc and init calls inline, both initializations seem to work properly, e.g.:
A *a = [A alloc];
[a initWithNum:20.0f];
If I use this convention when I create both a and b, I get the right output and the isa pointers seem to be different for each object.
Am I doing something wrong? I would have thought multiple classes could have the same initializer names, but perhaps that is not the case.
I am writing a new multi-tenant WCF RIA application. I plan to have a shared database with separate SQL Server schema for each tenant. I would like to use NHibernate for object-ralational mapping.
Configuration of SQL Server schema in mapping classes doesn't help because it is static and would need one set of mapping classes for each tenant.
Is it possible to dynamically configure ISession which SQL Server schema should be used for mapping objects to tables?
I have a simple, uncorrelated subquery that performs very poorly on SQL Server. I'm not very experienced at reading execution plans, but it looks like the inner query is being executed once for every row in the outer query, even though the results are the same each time. What can I do to tell SQL Server to execute the inner query only once?
The query looks like this:
select *
from Record record0_
where record0_.RecordTypeFK='c2a0ffa5-d23b-11db-9ea3-000e7f30d6a2'
and (
record0_.EntityFK in (
select record1_.EntityFK
from Record record1_
join RecordTextValue textvalues2_ on record1_.PK=textvalues2_.RecordFK
and textvalues2_.FieldFK = '0d323c22-0ec2-11e0-a148-0018f3dde540'
and (textvalues2_.Value like 'O%' escape '~')
)
)
I'm teaching some .Net classes and want to give the students some good books to read during and after the class. Some will prefer VB and other will like C# so the books need to give examples in both languages.
I need one book each for these classes:
Intro to .Net (Windows apps and ASP.NET together)
Intermediate/advanced Windows apps
Intermediate/advanced Web apps
WPF/Silverlight/XAML
WCF
WF
LINQ
Can anyone recommend a book for each category with examples in both C# and VB?
$arrayIter = new ArrayIterator( array(1, 2) );
$iterIter = new IteratorIterator($arrayIter);
var_dump($iterIter->valid()); //false
var_dump($arrayIter->valid()); //true
If I first call $iterIter-rewind(), then $iterIter-valid() is true. I'm curious why it requires that rewind() be called. I imagine there's good reason for it, but I would have expected it to simply start iteration at whatever state it's inner iterator is in, and leave it as an option to rewind before beginning iteration.
calling next() also seems to put it in a "valid" state(although it advances to the next position, suggesting it was previously at the first position).
$arrayIter = new ArrayIterator(array(1,2));
$iterIter = new IteratorIterator($arrayIter);
$iterIter->next();
var_dump($iterIter->valid());
Again, I'm curious why I need to call rewind(), despite the inner iterator being in a valid state.
I have a tuple of tuples (Name, val 1, val 2, Class)
tuple = (("Jackson",10,12,"A"),
("Ryan",10,20,"A"),
("Michael",10,12,"B"),
("Andrew",10,20,"B"),
("McKensie",10,12,"C"),
("Alex",10,20,"D"))
I need to return all combinations using itertools combinations that do not repeat classes. How can I return combinations that dont repeat classes. For example, the first returned statement would be: tuple0, tuple2, tuple4, tuple5 and so on.
Hi,
I've seen so much C# code in my time as a developer that attempt to help the GC along by setting variables to null or calling Dispose() on classes (DataSet for example) within thier own classes Dispose() method that
I've been wondering if there's any need to implement it in a managed environment.
Is this code a waste of time in its design pattern?
class MyClass : IDisposable {
#region IDisposable Members
public void Dispose() {
otherVariable = null;
if (dataSet != null)
dataSet.Dispose();
}
#endregion
}