Tuesday, April 10, 2012

mapping string values with corresponding formats

I have to process many strings( thousands ) which are in either of the two formats as below:



============= Examples of Str=============
123|S|122.14,
S,344,122.146



==============================================
The format of these strings are



A|B|C



B,A,C



I want them as A=123 B=S C=122.14



and A=344, B=S, C=122.146 ( where A , B , C correspond to column names and can be loaded into sql server db )



How do I do this.



I can use split to get the substrings as values. How do I map these values with formats and load them?



Please help. Thanks





Is this possible to get total number of rows count with offset limit

Hey Guyz Is this possible to get total number of rows count with offset limit



Scenario



SELECT * FROM users limit 0,5; 


This Query contain 300 records but the issue is if i call this query with offset the result will be show only 5 record and i don't want to write a Query in twice time. one for paging limit and other for total no of record count...




I don't want this




SELECT * FROM users limit 0,5; // paging 
SELECT count(*) FROM users; // count


i have to merge this Queries or helps are definitely appreciated





Splash screen not coming

I am writing an application starting with Silverlight+XNA Template in Windows phone.
I have an image named "Splashscreenimage.jpg" in my project root folder. But the splash screen is not coming. What may be the reason?





Upgrade spring-flex from 1.0.3 to 1.5.2 causes NullPointerException

I have been trying to upgrade spring-flex 1.0.3 to 1.5.2 in order to check new features, i.e. Hibernate lazy fetching support in BlazeDS 4. I downloaded all necessary packages, changed dependencies in Maven for Spring (to 3.0.7), Hibernate (to 3.6.9) and Spring flex core (to 1.5.2). When I try to build and deploy application, I got NullPointerException which indicates cause in my domain class (at the end of stack trace):



SEVERE: Exception sending context initialized event to listener instance of class     org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name '_messageBrokerDefaultHandlerMapping': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '_messageBroker': Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanInitializationException: MessageBroker initialization failed; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3972)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:637)
at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:563)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:498)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:519)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '_messageBroker': Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanInitializationException: MessageBroker initialization failed; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.AbstractBeanFactory.isSingleton(AbstractBeanFactory.java:396)
at org.springframework.context.support.AbstractApplicationContext.isSingleton(AbstractApplicationContext.java:1095)
at org.springframework.web.servlet.handler.AbstractUrlHandlerMapping.registerHandler(AbstractUrlHandlerMapping.java:294)
at org.springframework.web.servlet.handler.SimpleUrlHandlerMapping.registerHandlers(SimpleUrlHandlerMapping.java:129)
at org.springframework.web.servlet.handler.SimpleUrlHandlerMapping.initApplicationContext(SimpleUrlHandlerMapping.java:103)
at org.springframework.context.support.ApplicationObjectSupport.initApplicationContext(ApplicationObjectSupport.java:119)
at org.springframework.web.context.support.WebApplicationObjectSupport.initApplicationContext(WebApplicationObjectSupport.java:72)
at org.springframework.context.support.ApplicationObjectSupport.setApplicationContext(ApplicationObjectSupport.java:73)
at org.springframework.context.support.ApplicationContextAwareProcessor.invokeAwareInterfaces(ApplicationContextAwareProcessor.java:106)
at org.springframework.context.support.ApplicationContextAwareProcessor.postProcessBeforeInitialization(ApplicationContextAwareProcessor.java:85)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:394)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1413)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
... 35 more
Caused by: org.springframework.beans.factory.BeanInitializationException: MessageBroker initialization failed; nested exception is java.lang.NullPointerException
at org.springframework.flex.core.MessageBrokerFactoryBean.afterPropertiesSet(MessageBrokerFactoryBean.java:203)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
... 54 more
Caused by: java.lang.NullPointerException
at com.educationathome.domain.Device.toString(Device.java:182)
at java.lang.String.valueOf(String.java:2826)
at java.lang.StringBuilder.append(StringBuilder.java:115)
at org.springframework.flex.core.io.PropertyProxyUtils.getBeanPropertyNames(PropertyProxyUtils.java:71)
at org.springframework.flex.core.io.PropertyProxyUtils.findPropertyNames(PropertyProxyUtils.java:80)
at org.springframework.flex.core.io.SpringPropertyProxy.proxyFor(SpringPropertyProxy.java:85)
at org.springframework.flex.core.io.AbstractAmfConversionServiceConfigProcessor.registerAmfProxies(AbstractAmfConversionServiceConfigProcessor.java:115)
at org.springframework.flex.core.io.AbstractAmfConversionServiceConfigProcessor.processAfterStartup(AbstractAmfConversionServiceConfigProcessor.java:73)
at org.springframework.flex.core.MessageBrokerFactoryBean.processAfterStart(MessageBrokerFactoryBean.java:315)
at org.springframework.flex.core.MessageBrokerFactoryBean.afterPropertiesSet(MessageBrokerFactoryBean.java:177)
... 56 more


I appreciate any supportive replies.





Getting custom HTTP request headers in web.py?

I know that, with web.ctx.env, I can get a lot of information that comes from the headers -- but only the standard headers. Is it possible to obtain all HTTP request headers from within a GET or POST method in web.py?





How to remove extra space between textfield in JasperReports?

I have created three text field in Header. I have put parameter in all textField elements. When I'm not calling one of three parameter of three textField elements. It will show 2 textField elements. The problem now is there are space between the text fields.



How to remove the space?



This is my code:



<textField isBlankWhenNull="true">
<reportElement x="0" y="18" width="555" height="35" isRemoveLineWhenBlank="true"/>
<textElement textAlignment="Center">
<font size="12"/>
</textElement>
<textFieldExpression><![CDATA[$P{daterangefrom} && $P{daterangeto} ? "From ( " + $P{daterangefrom} + " - " + $P{daterangeto} + ")"
: $P{weeks} && $P{monthy} && $P{yrs} ? "For week " + $P{weeks} +" "+ $P{monthy} +" "+ $P{yrs}
: $P{monthy} && $P{yrs} ? "For monthly " +$P{monthy} +" "+ $P{yrs}
: $P{quarter} && $P{yrs} ? "For Quarter " + $P{quarter} +" "+$P{yrs}
: $P{yrs} ? "For " + $P{yrs}
: null]]>
</textFieldExpression>
</textField>


This is mine result:



enter image description here





What is the difference between sequence diagram and communication diagram?

Could anyone explain me what is the difference between sequence diagram and communication diagram?
Thanks in advanced !





Prolog: Reverse list of lists

i have problem with my prolog code. I need reverse all atomic elements of list.



Example: [1,2,[3,4]] -> [[4,3],2,1]



My solution:



myReverse([], []).
myReverse([H|T], X) :- myReverse(T, RT), myAppend(RT, H, X).


But it only give me: [[3,4],2,1]
I think, i need use is_list function and recursive call list if it's not atomic... but my prograss is stucked... can u guys know how to write it?





Delay when refreshing UITableView custom cell

I have a UITableView with a custom cell which i fill (with array infoservices) after parsing the xml data.



- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";

ApplicationCell *cell = (ApplicationCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
[self.cellNib instantiateWithOwner:self options:nil];
cell = tmpCell;
self.tmpCell = nil;
}

infoService *e = [self.infoservices objectAtIndex:indexPath.row];

cell.name = [e infoName];

NSString *infodetails = [e infoDetails];

if ( infodetails == nil ) {
cell.details = @"Loading...";
[self startInfoDownload:e forIndexPath:indexPath];

NSLog(@"Loading...");
} else {
cell.details = infodetails;
NSLog(@"Show info detail: %@", infodetails );
}
return cell;
}


- (void)infoDidFinishLoading:(NSIndexPath *)indexPath
{
infoDownloader *infoserv = [imageDownloadsInProgress objectForKey:indexPath];
if (infoserv != nil)
{

[infoservices replaceObjectAtIndex:[indexPath row] withObject:infoserv.appRecord];

NSIndexPath *a = [NSIndexPath indexPathForRow:indexPath.row inSection:0]; // I wanted to update this cell specifically
ApplicationCell *cell = (ApplicationCell *)[self.tableView cellForRowAtIndexPath:a];
cell.details = [[infoservices objectAtIndex:[indexPath row]] infoDetails];

NSLog(@"Updating=%@", [[infoservices objectAtIndex:[indexPath row]] infoDetails]);
}
}


For each cell i'm using NSURLConnection sendAsynchronousRequest to retrieve and parse xml data from object infoDownloader with



- (void)startDownload


for each individual cell.



After data has been successfully parsed delegate method from infoDownloader is called



- (void)infoDidFinishLoading:(NSIndexPath *)indexPath


The problem is that, while the



- (void)infoDidFinishLoading:(NSIndexPath *)indexPath 


gets called after parsing each cell and i can see the



NSLog(@"Updating=%@", [[infoservices objectAtIndex:[indexPath row]] infoDetails]);


in the debugger with the correct details, the cell does not get refreshed immediately but after 6 or 7 seconds. Also cellForRowAtIndexPath does not get called from



- (void)infoDidFinishLoading:(NSIndexPath *)indexPath 


for some reason because there is not debug output after the infoDidFinishLoading. Also i don't understand how the cell.details gets actually refreshed since cellForRowAtIndexPath isn't called again.



I've tried to setup this function using Apple's LazyTableImages loading example, which i have used successful, but i don't know what's going wrong.





Assign/append a value of a variable to then load its corresponding content from JSON array

I'm a novice working on an online gallery; the gallery will have categories (a,b,c,d) and 10 thumbnails each which will dynamically load content (text info + a set of larger images) from a JSON array...



The idea is:




  1. I'm attempting to assign/append a variable from a (click) function: (displayProjectA)...

    / there will be one for each of the four thumbnail categories/


  2. and filter it through one function... changing the value of the variable to then identify which section/category of content to load from the array (fillProject).




Here's what I'm having trouble with:



So far, I've tried passing a local variable (var a=x) through a few functions as well as setting one global variable (window['a']=x).. and changing/appending their value based on whatever category is being clicked, yet neither have worked... (fillProject)



Any help or a suggestion for better solution would be greatly appreciated. Thanks



function displayProjectA(){

$('#categorya').on('click', 'li', function(){
var index = $(this).find('img').attr('src').split('/')[3].replace(/\.[^/.]+$/, "") - 1;
var cat = $(this).find('img').attr('src').split('/')[2];

$('#ajaxContainer').load('project.php' + ' .openedProject', function(response){
resizeProject(index, cat);
});
});
}



/* example of html markup for thumbnail: img src="projects/thumbs/categorya/1.jpg" */




function resizeProject(index, cat){

var container = $('#projectContainer');
var phContainer = $('#phContainer');
var ajaxContainer = $('#ajaxContainer');
var projectList = $('#projectList');
var ww = $(window).width();
var hh = $(window).height();
var contentLength;
var contentWidth;
var contentHeight = container.height() + 28;
var realHeight = 850;
var projectsWidth = 0;

ajaxContainer.height(hh);
$('.openedProject').height(hh);


fillProject(0, index, cat, function(dims){
$('#ajaxContainer').attr('data-project', index);


$.each(dims, function(key, image){
projectsWidth += (image.width/image.height * 600) + 2;
});

contentLength = container.find('article li').length;
contentWidth = 13 + projectsWidth + 400;
container.width(contentWidth);
container.parent('.viewport').css('padding-top');

projectList.animate({'left':-ww}, 500, function(){
$('body').css('overflow','hidden');
$('body').width($(window).width()).height(hh);
$('#projectBackgroundContainer').width($(window).width()).height(hh);
$(this).hide();

fillNav(index);

ajaxContainer.height(container.height() * 2).css('top',-container.height());
ajaxContainer.show().animate({'top':0}, 800,function(){
$('#scrollContent').tinyscrollbar({
axis:'x',
sizethumb:'auto'
});
$('#projectBackground').fadeTo(500,1).animate({'top':0}, 500);
});
});
});
}


I'd like to be able to handle each of the four displayProject*X* functions:



function fillProject(index, num, cat, callback){  

var project = $('#ajaxContainer').find('.openedProject:eq('+index+')');
var i = 0;
var images = new Array();

$('#ajaxContainer').attr('data-project',num);
alert(cat); //test to see the value of the variable


project.find('aside .name').html(cat[num].title); //not working when trying to use variable
project.find('aside .type').html(categorya[num].type); //working when not
project.find('aside .number').html(categorya[num].more.number); //working when not
project.find('aside .category').html(categorya[num].more.category); //working when not
project.find('#projectBackground').attr('src','projects/background/'+categorya[num].more.media.background); //working when not

$.each(categorya[num].more.media.images, function(key, image){ //working when not
if (key == 0){
project.find('article ul').html('');
}
project.find('article ul').append('<li data-type="'+image.type+'"><img src="projects/main/'+image.url+'" alt="" style="height:600px;"/></li>');
images[i] = 'projects/main/'+image.url;
i++;
});
}


JSON array:



var categorya = [
{
title:'project 1',
picture:'1.jpg',
more:{
number:'1',
media:{
background:'bg_mainImg-a.jpg',
images:[
{type:'image',url:'mainImg-a1.jpg'},
{type:'image',url:'mainImg-a2.jpg'},
{type:'image',url:'mainImg-a3.jpg'},
{type:'image',url:'mainImg-a4.jpg'}
]
}
}
},
...
]




Cometitors to Share point

Sharepoint portal is a famous one for centralized document/content management system of Microsoft. Is it have any competitor portal that provides all functionalities as equal as Sharepoint. I heared that Oracle corp. also provides the document/content management system. What is the name of that portal of Oracle corp. Is it any other to competite with sharepoint.





How to get Value from DropDownList inside a ListView?

I have a DropDownList inside in ListView..
I wanted to get a data when command clicked.
this is my code..



protected void ListView2_ItemCommand(object sender, ListViewCommandEventArgs e){

string shipmethod = ((DropDownList)e.Item.FindControl("ShippingComapnyDDL")).SelectedValue;

}


but it always return null value..
I've googling about 3 hours, and try many function..
but still cant solve this bug..



please help me guys,





How do i link third party libraries in a makefile on ubuntu (g++)

I am trying to link the cpptest library for unittesting to my project and have no idea how to link third party libraries in my Makefile. Coud you give me a sample code or a good tutorial? i haven't found any good ones





How to check current tag element in javascript?

I've a GridView with three rows like this



<tr>
<th>SlNo</th>
</tr>
<tr>
<td>1</td>
</tr>
<tr>
<td>2</td>
</tr>


I've the following code to traverse through the rows



var GridViewRow=GridView.getElementsByTagName('tr')


Here the row length is 3.



I travese through the GridViewRow using for loop .Here how will i get the tag name of the current element ie (th or td).



If the tagname is "TH" it should return and if it is "TD" it should take the value of TD.





Javascript (with dijit.form.NumberTextBox) variable / 'NaN' behaving weirdly

I have a couple of dijit.form.NumberTextBox, Which return javascript Number values if valid data is in the textboxes, otherwise NaN. I get this strange behavior. When I checked in firebug (both the textboxes are blank):



>>> hours
NaN
>>> minutes
NaN
>>> minutes == NaN
false
>>> hours == NaN
false
>>> hours == minutes
false


Why is it behaving so?





SQLAlchemy - select for update example

I'm looking for a complete example of using select for update in SQLAlchemy, but haven't found one googling. I need to lock a single row and update a column, the following code doesn't work (blocks forever):



s = table.select(table.c.user=="test",for_update=True)
# Do update or not depending on the row
u = table.update().where(table.c.user=="test")
u.execute(email="foo")


Do I need a commit? How do I do that? As far as I know you need to:
begin transaction
select ... for update
update
commit





Runtime error when using startActivity()

I am trying to use the following method to switch to a different application:



private void switchAcitivty() {
Intent intent = new Intent();
intent.setClass(this, TeleJokeActivity.class);
startActivity(intent);
}


But I am getting the following errors:



04-10 03:05:51.901: E/AndroidRuntime(831): FATAL EXCEPTION: main
04-10 03:05:51.901: E/AndroidRuntime(831): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.telejoke.mo/com.telejoke.mo.TeleJokeActivity}: java.lang.NullPointerException
04-10 03:05:51.901: E/AndroidRuntime(831): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
04-10 03:05:51.901: E/AndroidRuntime(831): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
04-10 03:05:51.901: E/AndroidRuntime(831): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
04-10 03:05:51.901: E/AndroidRuntime(831): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
04-10 03:05:51.901: E/AndroidRuntime(831): at android.os.Handler.dispatchMessage(Handler.java:99)
04-10 03:05:51.901: E/AndroidRuntime(831): at android.os.Looper.loop(Looper.java:123)
04-10 03:05:51.901: E/AndroidRuntime(831): at android.app.ActivityThread.main(ActivityThread.java:4627)
04-10 03:05:51.901: E/AndroidRuntime(831): at java.lang.reflect.Method.invokeNative(Native Method)
04-10 03:05:51.901: E/AndroidRuntime(831): at java.lang.reflect.Method.invoke(Method.java:521)
04-10 03:05:51.901: E/AndroidRuntime(831): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-10 03:05:51.901: E/AndroidRuntime(831): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-10 03:05:51.901: E/AndroidRuntime(831): at dalvik.system.NativeStart.main(Native Method)
04-10 03:05:51.901: E/AndroidRuntime(831): Caused by: java.lang.NullPointerException
04-10 03:05:51.901: E/AndroidRuntime(831): at android.app.Activity.findViewById(Activity.java:1637)
04-10 03:05:51.901: E/AndroidRuntime(831): at com.telejoke.mo.TeleJokeActivity.<init>(TeleJokeActivity.java:11)
04-10 03:05:51.901: E/AndroidRuntime(831): at java.lang.Class.newInstanceImpl(Native Method)
04-10 03:05:51.901: E/AndroidRuntime(831): at java.lang.Class.newInstance(Class.java:1429)
04-10 03:05:51.901: E/AndroidRuntime(831): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
04-10 03:05:51.901: E/AndroidRuntime(831): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
04-10 03:05:51.901: E/AndroidRuntime(831): ... 11 more


Not sure why I am getting NullPointerException.





Is Result variable defined from first line in a function?

I need a clarification of this case.



According my tests the Result variable is defined to:
Boolean=False, Integer=0, String='', Object=nil etc from the first line.
But I have never seen an official reference for this.
It also make sense as this gives the hint.



[DCC Warning] Unit1.pas(35): H2077 Value assigned to 'TForm1.Test' never used



function TForm1.Test: Boolean;
begin
Result := False;
// Some arbitrary code here

Result := True;
end;


But what happens if I comment out the first line and there is an exception somewhere before last line? Is Result = False ?



If Result is undefined this means that I always have to start every function by defining Result in case of exception later. And this make no sense for me.





WPF ListView slection changed doesn't removing an old item

I have a strange behavior with my WPF ListView Control.

ListViews ItemSource is Observable collection.the ItemSource is updated periodically.

When I'm selecting one of the item and then selecting other item and no item updated, everything is OK.

But when I'm selecting an item witch is updated while I'm standing on, then selecting other item, now I have two items selected instead of one.

When I'm looking with the debugger, I see the event args of SelectionChanged event. I see that added item is OK but no removed item.

Anyone knows what's the problem?

Thanks!





What's the effect of "int a(); " in C++?

What's the effect of int a(); in C++?



Is it equivalent to int a or int a(0)?



And how about char c() and double d()?
Thanks.