Thursday, 5 September 2013

Chrome couldn't destroy the session when it close

Chrome couldn't destroy the session when it close

//1st page
session_start();
$_SESSION['a']=1;
//2nd page
session_start();
echo $_SESSION['a'];
I couldn't destroy session when chrome close the browser, i have tried add
session_set_cookie_params(0); or session_cache_expire(1);
those are not working, I read lots post, just cant find the solution.

No Activity found to handle intent errors

No Activity found to handle intent errors

I am stumped, I get No Activity to handle intent, I have checked the
manifest etc. Can someone have a quick look at this and see what I am
doing wrong here.
This is my java class
'import com.one2.indoor.R;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageButton;
public class Menu extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ImageButton tut1 = (ImageButton) findViewById(R.id.activitymain);
tut1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
startActivity (new Intent("com.indoor.ActivityMain"));
}
});
}'
This is my ActivityMain class
'import com.one2.indoor.R;
import android.app.Activity;
import android.os.Bundle;
public class ActivityMain extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.tutorial);
}
@Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
}
}'
and finally my manifest
'<activity
android:name="com.indoor.Main"
android:label="@string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.indoor.Menu"
android:label="@string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="com.indoor.MENU" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="com.indoor.ActivityMain"
android:label="@string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="com.indoor.ACTIVITYMAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.indoor.ActivityMain" />
</activity>
</application>
</manifest>
I just cant see it, why I'm getting the error. Any help be much appreciated

ASP.NET MVC 4 Getting the Control and Action used to call

ASP.NET MVC 4 Getting the Control and Action used to call

In MVC 4
In a Partial View _MyView.cshtml I need to get the Controller name and the
Action used to create the parent calling view.
So if /Equity/Sell was the Controller/Action used to call the view which
rendered the partial view _MyView.cshtml , then in _MyView.cshtml I need
to be able to get "/Equity/Sell"
I don't see an object that can do that though.

How to check idle time

How to check idle time

I am have created a method for the KeyUp event for a TextBlock, which
filters contacts. All this works fine.
Now, instead of filtering on every KeyUp event, I want to check if the
user is idle for 1-1.5 secs. before triggering the filter method.
I am absolutely new to C#, so I do not even know how to approach this
problem. How can I achieve this?

Javascript redirect and wrong special chars encoding

Javascript redirect and wrong special chars encoding

I have this code to perform searches in my site:
var encoded = encodeURIComponent($("#searchBar").val());
location.href = sitePath + "/search/keyword/" + encoded;
Because i'm italian I use a lot chars like à è ù, but when I put them in
search3w they're not correctly encoded.
If i try to console log encoded var it will print correctly encoded chars
for URLs, but when the script does the effective redirect to te page i
have things like http://www.mysite.it/search/à and chars are not well
received.

PrettyFaces or rewrite breaks up CSS and images in JSF sites

PrettyFaces or rewrite breaks up CSS and images in JSF sites

It seems that in my jsf project PrettyFaces breaks up link to CSS file and
images when page navigation goes to deeper directory levels.
I am working with templates. The CSS is defined in the template in the
head part of the website:
<link href="resources/css/stylesheet.css" rel="stylesheet" type="text/css" />
For sites like ../home/direc the CSS doesn't work anymore. I have solved
this by adding the CCS link twice:
<link href="resources/css/stylesheet.css" rel="stylesheet" type="text/css" />
<link href="../resources/css/stylesheet.css" rel="stylesheet"
type="text/css" />
For my image I don't see a solution. It's in the menu, so for the pages
where the navigation goes not to deeper directory levels the image is
displayed correctly for others not.
Can anyone help me to solve this problem?

Formatting preview of DateTime-column in XamDataGrid when editor is XamComboEditor

Formatting preview of DateTime-column in XamDataGrid when editor is
XamComboEditor

I have an Infragistics XamDataGrid with a field that is bound to a
DateTime. Since the user only can choose from a predefined set of dates, I
use a XamComboEditor to edit the field. I want to specify formatting for
the dates and I have successfully been able to do so for the drop down.
However, I'm not able to set the date format of the "preview" of the field
(i.e. when the field is not in edit mode).
How do I set the date format of the "preview"?
The XAML for the field:
<igWPF:Field Name="ReferenceDate" Label="Reference date">
<igWPF:Field.Settings>
<igWPF:FieldSettings EditorType="{x:Type igWPF:XamComboEditor}">
<igWPF:FieldSettings.EditorStyle>
<Style TargetType="{x:Type igWPF:XamComboEditor}">
<Setter Property="ComboBoxStyle">
<Setter.Value>
<Style TargetType="ComboBox">
<Setter Property="ItemTemplate">
<Setter.Value>
<DataTemplate>
<!-- Works just fine, but only
in edit-mode -->
<TextBlock Text="{Binding
Converter={StaticResource
dateTimeConverter}}" />
</DataTemplate>
</Setter.Value>
</Setter>
<Setter Property="SelectedItem"
Value="{Binding DataItem.ReferenceDate}"
/>
</Style>
</Setter.Value>
</Setter>
<Setter Property="ItemsSource" Value="{Binding
DataItem.AvailableReferenceDates}"/>
<Setter Property="DropDownResizeMode" Value="None"/>
<Setter Property="IsReadOnly" Value="{Binding
DataItem.HasVariance, Converter={StaticResource
invertBooleanConverter}}" />
<!-- Does not seem to work -->
<Setter Property="Format" Value="{x:Static
ValueConverters:DateTimeLongFormatConverter.DateFormat}"
/>
</Style>
</igWPF:FieldSettings.EditorStyle>
</igWPF:FieldSettings>
</igWPF:Field.Settings>
</igWPF:Field>