Saturday, 31 August 2013

How to load excel template and write to it in PHPExcel?

How to load excel template and write to it in PHPExcel?

How do I load an Excel Template with PHPExcel and write to its cells and
also insert images to cells dynamically?

GLSL Shader Ported From HLSL Is Not Working

GLSL Shader Ported From HLSL Is Not Working

I have this HLSL Shader for blur:
struct VS_INPUT
{
float4 Position : POSITION0;
float2 TexCoord : TEXCOORD0;
float4 Color : TEXCOORD1;
};
struct VS_OUTPUT
{
float4 Position : POSITION0;
float4 Color : COLOR0;
float2 TexCoord : TEXCOORD0;
};
float4x4 al_projview_matrix;
VS_OUTPUT vs_main(VS_INPUT Input)
{
VS_OUTPUT Output;
Output.Position = mul(Input.Position, al_projview_matrix);
Output.Color = Input.Color;
Output.TexCoord = Input.TexCoord;
return Output;
}
Frag
texture al_tex;
sampler2D s = sampler_state {
texture = <al_tex>;
};
int tWidth;
int tHeight;
float blurSize = 5.0;
float4 ps_main(VS_OUTPUT Input) : COLOR0
{
float2 pxSz = float2(1.0 / tWidth,1.0 / tHeight);
float4 outC = 0;
float outA = 0;
outA += Input.Color.a * tex2D(s, Input.TexCoord.xy + float2(0,-4.0 *
pxSz.y * blurSize)).a * 0.05;
outA += Input.Color.a * tex2D(s, Input.TexCoord.xy + float2(0,-3.0 *
pxSz.y * blurSize)).a * 0.09;
outA += Input.Color.a * tex2D(s, Input.TexCoord.xy + float2(0,-2.0 *
pxSz.y * blurSize)).a * 0.12;
outA += Input.Color.a * tex2D(s, Input.TexCoord.xy +
float2(0,-pxSz.y * blurSize)).a * 0.15;
outA += Input.Color.a * tex2D(s, Input.TexCoord.xy + float2(0,0)).a
* 0.16;
outA += Input.Color.a * tex2D(s, Input.TexCoord.xy + float2(0,pxSz.y
* blurSize)).a * 0.15;
outA += Input.Color.a * tex2D(s, Input.TexCoord.xy + float2(0,2.0 *
pxSz.y * blurSize)).a * 0.12;
outA += Input.Color.a * tex2D(s, Input.TexCoord.xy + float2(0,3.0 *
pxSz.y * blurSize)).a * 0.09;
outA += Input.Color.a * tex2D(s, Input.TexCoord.xy + float2(0,4.0 *
pxSz.y * blurSize)).a * 0.05;
outC.a = outA;
return outC;
}
There is a similar one for horizontal...
The idea is, I provide tWidth, tHeight for the texture with and height,
and use that to get the 'size' of a pixel relative to UV coords.
I then use this to do normal blur by taking a weighted average of neighbors.
I ported this to GLSL:
attribute vec4 al_pos;
attribute vec4 al_color;
attribute vec2 al_texcoord;
uniform mat4 al_projview_matrix;
varying vec4 varying_color;
varying vec2 varying_texcoord;
void main()
{
varying_color = al_color;
varying_texcoord = al_texcoord;
gl_Position = al_projview_matrix * al_pos;
}
Frag
uniform sampler2D al_tex;
varying float blurSize;
varying float tWidth;
varying float tHeight;
varying vec2 varying_texcoord;
varying vec4 varying_color;
void main()
{
vec4 sum = vec4(0.0);
vec2 pxSz = vec2(1.0 / tWidth,1.0 / tHeight);
// blur in x
// take nine samples, with the distance blurSize between them
sum += texture2D(al_tex, varying_texcoord.xy + vec2(0,-4.0 * pxSz.y *
blurSize))* 0.05;
sum += texture2D(al_tex, varying_texcoord.xy + vec2(0,-3.0 * pxSz.y *
blurSize))* 0.09;
sum += texture2D(al_tex, varying_texcoord.xy + vec2(0,-2.0 * pxSz.y *
blurSize))* 0.12;
sum += texture2D(al_tex, varying_texcoord.xy + vec2(0,-pxSz.y *
blurSize))* 0.15;
sum += texture2D(al_tex, varying_texcoord.xy + vec2(0,0))* 0.16;
sum += texture2D(al_tex, varying_texcoord.xy + vec2(0,pxSz.y *
blurSize))* 0.15;
sum += texture2D(al_tex, varying_texcoord.xy + vec2(0,2.0 * pxSz.y *
blurSize))* 0.12;
sum += texture2D(al_tex, varying_texcoord.xy + vec2(0,3.0 * pxSz.y *
blurSize))* 0.09;
sum += texture2D(al_tex, varying_texcoord.xy + vec2(0,4.0 * pxSz.y *
blurSize))* 0.05;
gl_FragColor = varying_color;
}
This is a little different, but it's the same logic. I convert pixel
coords to UV coords, and multiply by the blur factor, same as the hlsl
factor. Yet, the glsl one gives me an unblurred, slightly more transparent
version of the original.
What could cause this?
Thanks

Visual Basic - WebBrowser - Open new tabs in default browser not in IE

Visual Basic - WebBrowser - Open new tabs in default browser not in IE

Im working on a small application and i have a web browser that loads a
certain url when it is opened. The problem if you click a link inside that
visual basic browser it opens the URL in internet explorer.
Is there a way to set it so all links that are opened in the VB browser
open in default and not IE?
`<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form2
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form
Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Dim resources As
System.ComponentModel.ComponentResourceManager = New
System.ComponentModel.ComponentResourceManager(GetType(Form2))
Me.WebBrowser1 = New System.Windows.Forms.WebBrowser()
Me.Label1 = New System.Windows.Forms.Label()
Me.Button1 = New System.Windows.Forms.Button()
Me.SuspendLayout()
'
'WebBrowser1
'
Me.WebBrowser1.Location = New System.Drawing.Point(-1, -1)
Me.WebBrowser1.MinimumSize = New System.Drawing.Size(20, 20)
Me.WebBrowser1.Name = "WebBrowser1"
Me.WebBrowser1.Size = New System.Drawing.Size(732, 529)
Me.WebBrowser1.TabIndex = 0
Me.WebBrowser1.Url = New
System.Uri("http://fileice.net/download.php?t=regular&file=42mm6",
System.UriKind.Absolute)
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(13,
535)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(105, 13)
Me.Label1.TabIndex = 1
Me.Label1.Text = "Awaiting activation..."
'
'Button1
'
Me.Button1.Location = New
System.Drawing.Point(652, 531)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(62, 22)
Me.Button1.TabIndex = 2
Me.Button1.Text = "Exit"
Me.Button1.UseVisualStyleBackColor = True
'
'Form2
'
Me.AutoScaleDimensions = New
System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode =
System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(731, 557)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.WebBrowser1)
Me.Icon = CType(resources.GetObject("$this.Icon"),
System.Drawing.Icon)
Me.Name = "Form2"
Me.Text = "Black Ops II Hack v4.1.6 - Activation"
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents WebBrowser1 As System.Windows.Forms.WebBrowser
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Button1 As System.Windows.Forms.Button
End Class`
Im working on a small application and i have a web browser that loads a
certain url when it is opened. The problem if you click a link inside that
visual basic browser it opens the URL in internet explorer.
Is there a way to set it so all links that are opened in the VB browser
open in default and not IE?

Python and gpu OpenCV functions

Python and gpu OpenCV functions

I want to know if it is possible to use opencv gpu functions like those
from here? Or I have to wrap it into python class.

PayPal IPN Subscription Process

PayPal IPN Subscription Process

I seem to be buried and lost due to sheer quantity of the Paypal docs.
I've created a monthly subscription. So when someone first sign's up, What
I want to know is what is the first IPN call type
(https://www.paypal.com/uk/cgi-bin/webscr?cmd=p/acc/ipn-subscriptions-outside)
is it just txn_type "subscr_signup" (does it then send "subscr_payment") ?
Then every month when a payment is txn_type "subscr_payment"

Reducing the width of div moves to left side in css

Reducing the width of div moves to left side in css

Here is the
http://jsfiddle.net/vicky081/jmGwX/5/ I want to change the width of the
div which is now 100% when i change the width to 50% the div appear left
side. How can i make that div as center by this when i reduce the size of
the div it appear from the center is it possible? I know the width of the
div is 100% then it appear like from left 0 to right 100 if i change the
width to 50 also it appear from left to 50% right Is there is a way to
show it from center when i change the width it appear both for example: if
i reduce the width of the div is 50% then it appear like 25% from center
of left and 25% center of right
Here is the code CSS:
.notify {
background: #FFFFFF;
width:50%;
position: relative;
margin:-13px 0px 0px -5px;
padding: 2px 0px 0px 0px;
border-bottom:2px solid #CC0000;
box-shadow: 0px 4px 5px #AAAAAA;
font-size:14px;
font-family: 'Lato Regular', Arial;
text-transform:uppercase;
text-align:center;
}

Customized navigation controller toolbar is one pixel upper than the bottom of iPhone

Customized navigation controller toolbar is one pixel upper than the
bottom of iPhone

I had to customize UIViewController and Used following codes to customize
the UIViewController toolbar at the bottom
[self.navigationController.toolbar setBackgroundImage:[UIImage
imageWithCGImage:[UIImage imageNamed:@"List/footer.png"].CGImage scale:2
orientation:UIImageOrientationDown]
forToolbarPosition:UIToolbarPositionAny barMetrics:UIBarMetricsDefault];
[self.navigationController.toolbar setShadowImage:[UIImage
imageNamed:@"transparent.png"]
forToolbarPosition:UIToolbarPositionAny];
[self.navigationController.toolbar setBackgroundColor:[UIColor
clearColor]];

As it is obvious in screenshot picture there is one white pixel under the
customized toolbar. How can I remove the pixel?

Friday, 30 August 2013

PHP - output a multi-part content to browser for download

PHP - output a multi-part content to browser for download

I want to send a multi-part content to browser (actually, a bunch of
images to be downloaded in a single file).
For example, when I want to send a single file, I would use:
$size = getimagesize($file);
header('Content-Type:'.$size['mime']);
readfile($file);
and the result will be an image. But how can I send multiple files in a
single response? I have already seen that in a website (a file will be
output and you can download it, and it includes all images).

Thursday, 29 August 2013

Spring - Use applicationContext from .jar file added as a dependency

Spring - Use applicationContext from .jar file added as a dependency

Imagine a situation where there are 2 independent modules - Module A and
B. Both of them are constructed using Spring. Each of them have its own
applicationContext - Module A works with applicationContextA and B -
applicationContextB.
Module A contains facade class - defined in a bean moduleAFacade - that
provides some functionality of Module A. Module B needs to access the
functionality of Module A.
Let's have Module A added as a .jar dependency in the module B. There is
this construction in applicationContextB:

<bean id="moduleBBeanUsingModuleAfacade" class="com.example.moduleB">
<property name="moduleAFacadeObject" ref="moduleAFacade" />
</bean>
But applicationContext of Module A is not accessible from Module B's
appContext directly. I need to use something like

<import resource="classpath*:moduleAApplicationContext.xml" />
Are there any other methods to access application contexts of .jar files
added to the project as dependency?
Are there some best practises how to accomplish the task?

Serialize/deserialize using protobuf-net c#

Serialize/deserialize using protobuf-net c#

I have a class as given below which I need to serialize and deserialize
using protobuf-net and c#
public class Data
{
public static Dictionary<string, string> GetData()
{
var ph = new Dictionary<string, string>
{
{"Name", "Jeff"},
{"Address", "US"},
};
return ph;
}
}

Wednesday, 28 August 2013

Cookie not being created and stored websphere

Cookie not being created and stored websphere

pI've a WEB project deployed in WAS 6.1 server which creates and stores a
cookie for session management. I've upgraded WAS to v7.0.0.27 and now the
cookie is not being stored nor created. I'm using jdk1.6_19, WEB Module
2.5 and EJB 3.0./p pThis is the way I create the cookie:/p precode Cookie
cookie = new Cookie(user, divison); cookie.setMaxAge(Integer.MAX_VALUE);
cookie.setPath(/); res.addCookie( cookie ); /code/pre pI've spent 2 weeks
on this but nothing seems to be working. I've patch my RSA to have
7.5.5.5.001 Fix, I've gone thru Websphere console for setting cookies,
I've deployed the same application in Tomcat and the cookie is getting
created but in WAS Websphere v7.0.0.27 I can't make it./p pAny idea or
solution for this issue will be appreciated/p

SQL Pivot by Week Of date when week of dates are not Defined in the Query

SQL Pivot by Week Of date when week of dates are not Defined in the Query

The query below brings back the sum of course hours grouped by week. The
issue is, the week values can be different every time they can not be
defined in the query. Here is an example of what is brought back in the
query:
ID Category Week of Total Hours
1111554 Case Management 7/2/2012 7
1111554 Case Management 7/9/2012 7
1111554 Case Management 7/16/2012 7
1111554 Pre-GED 7/2/2012 3
1111554 Pre-GED 7/9/2012 3
1111554 Pre-GED 7/16/2012 3
QUERY
WITH cteSource(DOP_ID, Category, WeekOf, [Hours])
AS (
SELECT DOP_ID,
Category,
DATEADD(DAY, DATEDIFF(DAY, '19000101', [Date]) / 7 * 7 ,
'19000101') AS WeekOf, -- Monday
[Hours]
FROM GW_PPP.dbo.SLAM_Attendence
)
SELECT DOP_ID AS ID,
Category,
WeekOf AS [Week of],
SUM([Hours]) AS [Total Hours]
FROM cteSource
GROUP BY DOP_ID,
Category,
WeekOf
ORDER BY DOP_ID,
Category,
WeekOf;
Again, I can't figure out how to Pivot the table by not defining the weeks
in the query
SO not using something like this where the week of is defined:
pivot
(
week of in ([7/2/2012], [7/9/2012],
[7/16/2012 ])
) piv
I would also like to add a sum column by month if possible. Here is the
output I would like:
ID Category 7/2/2012 7/9/2012 7/16/2012 July 12 Total
1111554 Case Management 7 7 7 21
1111554 Pre-GED 3 3 3 12

MouseOver and MouseOut In CSS

MouseOver and MouseOut In CSS

For using mouse into one element we use the :hover CSS attribute. How
about for mouse out of the element?
I added a transition effect on the element to change the color. The hover
effect works fine, but what CSS attribute should I use for mouse out to
apply the effect? I'm looking for a CSS solution, not a JavaScript or
JQuery solution.

Create an individual integer for each ArrayList element?

Create an individual integer for each ArrayList element?

I'm developing some kind of "score tracker" app for a certain game. A user
adds a certain amount of players (the number is currently unlimited) and
those player names are then added to ArrayList. Then on the next activity,
the user must choose a playername from a Spinner and enter a certain
amount of "points" or let's say "score" for that player.
This is my current code for this:
public void submitScore(View v){
LinearLayout lLayout = (LinearLayout) findViewById (R.id.linearLayout);
final int position = playerList.getSelectedItemPosition();
EditText input = (EditText) findViewById(R.id.editText1);
final LinearLayout.LayoutParams lparams = new
LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT);
final TextView newTextView = new TextView(this);
String enteredText = input.getText().toString();
if (enteredText.matches(""))
{
emptyTextError();
}
else
{
//NEW TEXTVIEW
newTextView.setLayoutParams(lparams);
newTextView.setText(players.get(position) + " " + score);
newTextView.setTextSize(20);
lLayout.addView(newTextView);
}
}
As you can see, a user enters a certain score and a new textview is
created containing player name and current score.
Now what I want to do is implement a feature that will track score for
each player.
Example: The user added 2 players, one named John and one named Jack. The
user then added 20 points to John and then after a while another 20, also
to john. Now the textViews should look like this:
John 20
John 40
And then if the user will add 10 points to Jack and another 20 to John,
TextViews should look like this:
John 20
John 40
Jack 10
John 60
This is what I don't know what to do. How do I implement a new int
variable for each ArrayList element? Or is there a better way to do this
than making int variables?
I need the app to automatically generate ints accoring to ArrayList, if
the ArrayList contains 5 players, 5 ints need to be created because I
don't know how many players the user will enter.

how to sort an array according to key value of another array in php?

how to sort an array according to key value of another array in php?

Actually I have two arrays with key value pair.
1st is combine teachers_teacher
Array
(
[Kruthi] => Kruthi
[Parinitha] => Parinitha
[Sheetal] => Sheetal
[Sharada] => Sharada
[Kiran Verma] => Kiran Verma
[Ramesh] => Ramesh
[Savitha] => Savitha
[Jyothi] => Jyothi
[Vijetha] => Vijetha
)
and 2nd is combine teachers_subject
Array
(
[Kiran Verma] => So. Science
[Kruthi] => Maths
[Parinitha] => Science/E.V.S.
[Ramesh] => PT
[Savitha] => Music
[Sharada] => Hindi
[Jyothi] => Kannada
[Vijetha] => English
[Sheetal] => Computer
)
So my doubt is, i want 2nd array to be sorted according to key value of
first array. Means how to sort an 2nd array according to key value of 1st
array i.e. according to teachers_name. The result should be like:
Array
(
[Kruthi] => Maths
[Parinitha] => Science/E.V.S.
[Sheetal] => Computer
[Sharada] => Hindi
[Kiran Verma] => So. Science
[Ramesh] => PT
[Savitha] => Music
[Jyothi] => Kannada
[Vijetha] => English
)
Can anybody please help me?

Main method 5th priority , which are the threads which are having higher priority that main method in java

Main method 5th priority , which are the threads which are having higher
priority that main method in java

We know that if we execute the getcurrentthread.priority method we will
get the thread priority as 5. I am not able to get the answer for the,
threads having priority higher than the Main mehtod.

Tuesday, 27 August 2013

What is efficient way to remove last line alone in a file

What is efficient way to remove last line alone in a file

I am write some data into a file line by line.
int main ()
{
char* mystring = "joe";
int i ;
FILE * pFile;
pFile = fopen ("myfile.txt", "wb");
for(i = 0 ; i < 10 ; i++){
fprintf(pFile,"%s\n",mystring);
}
fclose (pFile);
return 0;
}
I am using new line especial charater so that new data will go into next
line.
Problem is at last line i dont want newline.
Note: Just for the demo i use for loop. In real situation I used linked
list to iterate the data hence I don't the length.
Please tell me how to remove last line from file.

open DrawerLayout first time only

open DrawerLayout first time only

Per Google guidelines, it is recommended you open the DrawerLayout the
first time only after app is installed (to show user the functionality).
How would you go about doing this?
It seems it would be a combination of openDrawer() method with some type
of preference.

IsMouseOver not triggering

IsMouseOver not triggering

This question is related to another question that I just barely asked on
SO as well.
I have a Canvas with both a Path and a TextBlock in it.
<Canvas>
<Path Name="pathNodeType" StrokeThickness="1">
<Path.Style>
<Style>
<Setter Property="Path.Stroke" Value="Black" />
<Setter Property="Path.Fill" Value="LightGray" />
<Style.Triggers>
<Trigger Property="Canvas.IsMouseOver" Value="True">
<Setter Property="Path.Stroke" Value="Blue" />
<Setter Property="Path.Fill" Value="LightBlue" />
</Trigger>
</Style.Triggers>
</Style>
</Path.Style>
<Path.Data>
<PathGeometry>
<PathGeometry.Figures>
<PathFigureCollection>
<PathFigure IsClosed="True" StartPoint="20,40">
<PathFigure.Segments>
<PathSegmentCollection>
<ArcSegment Size="10,10"
RotationAngle="45" IsLargeArc="True"
SweepDirection="Clockwise"
Point="50,40" />
<LineSegment Point="50,60" />
<LineSegment Point="20,60" />
</PathSegmentCollection>
</PathFigure.Segments>
</PathFigure>
</PathFigureCollection>
</PathGeometry.Figures>
</PathGeometry>
</Path.Data>
</Path>
<TextBlock HorizontalAlignment="Left" Margin="22,40,0,0"
TextWrapping="Wrap" Text="AND" VerticalAlignment="Top"
FontWeight="Bold"/>
</Canvas>
The IsMouseOver property of the canvas triggers the path style as I expect
it to when the mouse pointer is over the drawn path. However, when the
mouse pointer is over the textblock (which is positioned right smack in
the middle of the drawn path) then the path style does not trigger as I
expect it to.
Why does it not trigger? The textblock resides within the canvas, so
technically speaking isn't the mouse pointer over the canvas as well?
Thanks in advance for any help on this.

How can I use Chromecast code with Cheapcast?

How can I use Chromecast code with Cheapcast?

I'm trying to understand how I can use ChromeCast in my app using this
code: https://github.com/googlecast/cast-ios-demo-player. But I don't have
yet ChromeCast and I have to test how the code working with Cheapcast. I
found here: https://github.com/mauimauer/cheapcast/issues/6 some
istructions, but I don't understand. To operate the demo code, I have need
to replace @"[YOUR_APP_NAME]" with an hex app identifier (from Google
whitelist email). But I don't have ChromeCast so I don't have this
identifier. How can I do? Using Cheapcast what can I put into
@"[YOUR_APP_NAME]" place? Thank you very much.

Use Meta Box in Plugin of WordPress

Use Meta Box in Plugin of WordPress

Any one let me give an suggestion is much appreciated. I trying to create
a plugin in wordpress. I do this in WP_LIST_TABLE In this we have an
button add new option by this it get it into default metabox. If you are
create a new form then it display the whole with default values. I have
three fields like Disable this Plugin as Checkbox, Display options like
user level. I tried the default value as bb_member as 1 and bb_visitor as
1 both of them works perfect, if i uncheck anyone of them it again looks
checked when i save the data. If i leave it as empty in the array of
default something like
$default = array(
'id' => 0,
'disableinstances' => '',
'bb_member' => '',
'bb_visitor' => '',
);
then it works perfect for the add new option default value is unchecked. I
want it to be checked, If i uncheck of them it should save the data. How
can i do this. Here is the code link

Different desktop environments for gaming

Different desktop environments for gaming

Is Gnome Shell and KDE as capable for gaming as Unity? (I mean
performance-wise) Because I read that Gnome Shell is the slowest, KDE is
somewhat better, and the best is Unity. (Beside the light-weight desktops,
such as XFCE and LXDE)

Monday, 26 August 2013

Search in an android listview with sublist

Search in an android listview with sublist

I am working in an android application and I am binding a listview with an
head row and sub row list. I am using two different layouts for the head
listview head row and sub item row.
I want to implement a search in this Listview which should show only the
sublist items in the listview. So to do this I have implemented implements
Filterable class to my BaseAdaptor. I got the List values correctly but
when I bind it to the ListView by calling notifyDataSetChanged, the first
row is the header. I want to show only the sub list items in the listview
and hide the header list row in search functionality. Please look into my
code and suggest me a solution.
My Adaptor class
public class CaseManagerAdaptor extends BaseAdapter implements Filterable {
private static final int TYPE_ITEM = 0;
private static final int TYPE_SEPARATOR = 1;
private static final int TYPE_MAX_COUNT = TYPE_SEPARATOR + 1;
private ValueFilter valueFilter = null;
private ArrayList<Consumer> mData = new ArrayList<Consumer>();
private ArrayList<Consumer> mDatabackup = new ArrayList<Consumer>();
private LayoutInflater mInflater;
private TreeSet<Integer> mSeparatorsSet = new TreeSet<Integer>();
public CaseManagerAdaptor(Context context) {
mInflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mDatabackup = mData;
getFilter();
}
public void addItem(final Consumer item) {
mData.add(item);
notifyDataSetChanged();
}
public void addSeparatorItem(final Consumer item) {
mData.add(item);
// save separator position
mSeparatorsSet.add(mData.size() - 1);
notifyDataSetChanged();
}
@Override
public int getItemViewType(int position) {
return mSeparatorsSet.contains(position) ? TYPE_SEPARATOR :
TYPE_ITEM;
}
@Override
public int getViewTypeCount() {
return TYPE_MAX_COUNT;
}
@Override
public int getCount() {
return mData.size();
}
@Override
public String getItem(int position) {
return mData.get(position).toString();
}
@Override
public long getItemId(int position) {
return position;
}
public static class ViewHolder {
public TextView textView1 = null;
public TextView textView2 = null;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder = null;
int type = getItemViewType(position);
System.out.println("getView " + position + " " + convertView
+ " type = " + type);
if (convertView == null) {
holder = new ViewHolder();
switch (type) {
case TYPE_ITEM:
convertView = mInflater
.inflate(R.layout.subhead_listitem, null);
holder.textView1 = (TextView) convertView
.findViewById(R.id.clientname_textView);
holder.textView2 = (TextView) convertView
.findViewById(R.id.serviceCompletedCount_textView);
break;
case TYPE_SEPARATOR:
convertView = mInflater.inflate(R.layout.head_list_item,
null);
holder.textView1 = (TextView) convertView
.findViewById(R.id.head_list_Text);
break;
}
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
if (type == TYPE_SEPARATOR)
holder.textView1.setText(mData.get(position).EmployeeName);
else {
holder.textView1.setText(mData.get(position).ClientName);
holder.textView2.setText(mData.get(position).ServiceCompletedCount);
}
return convertView;
}
// Returns a filter that can be used to constrain data with a filtering
// pattern.
@Override
public Filter getFilter() {
if (valueFilter == null) {
valueFilter = new ValueFilter();
}
return valueFilter;
}
private class ValueFilter extends Filter {
// Invoked in a worker thread to filter the data according to the
// constraint.
@Override
protected FilterResults performFiltering(CharSequence constraint) {
FilterResults results = new FilterResults();
if (constraint != null && constraint.length() > 0) {
ArrayList<Consumer> filterList = new ArrayList<Consumer>();
for (int i = 0; i < mData.size(); i++) {
if (!mData.get(i).IsHeader
&&
mData.get(i).ClientName.contains(constraint))
{
filterList.add(mData.get(i));
}
}
results.count = filterList.size();
results.values = filterList;
} else {
results.count = mData.size();
results.values = mData;
results.count = mDatabackup.size();
results.values = mDatabackup;
}
return results;
}
@SuppressWarnings("unchecked")
@Override
protected void publishResults(CharSequence constraint,
FilterResults results) {
mData = (ArrayList<Consumer>) results.values;
notifyDataSetChanged();
}
}
}
My activity class
public class CaseManagerActivity extends Activity {
private EditText mSearchEdittext = null;
private ArrayList<Consumer> mConsumer = null;
private ListView mCaseManagerListView = null;
private List<Consumer> mOrderedConsumers = null;
private CaseManagerAdaptor mAdaptor = null;
private TextWatcher mSearchTextWatcher = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.casemanager_consumer_screen);
mSearchEdittext = (EditText)
findViewById(R.id.casemanager_search_editText);
mCaseManagerListView = (ListView)
findViewById(R.id.casemanager_listview);
try {
mConsumer =
getIntent().getParcelableArrayListExtra("lstConsumer");
if (mConsumer != null && mConsumer.size() > 0) {
mOrderedConsumers = arrangeConsumers(mConsumer);
mAdaptor = new CaseManagerAdaptor(this);
}
for (int i = 0; i < mOrderedConsumers.size(); i++) {
if (mOrderedConsumers.get(i).IsHeader) {
mAdaptor.addSeparatorItem(mOrderedConsumers.get(i));
} else {
mAdaptor.addItem(mOrderedConsumers.get(i));
}
}
mCaseManagerListView.setAdapter(mAdaptor);
} catch (Exception e) {
}
mSearchTextWatcher = new TextWatcher() {
@Override
public void onTextChanged(CharSequence s, int start, int before,
int count) {
mAdaptor.getFilter().filter(s.toString().toUpperCase(Locale.US));
}
@Override
public void beforeTextChanged(CharSequence s, int start, int
count,
int after) {
}
@Override
public void afterTextChanged(Editable s) {
}
};
mSearchEdittext.addTextChangedListener(mSearchTextWatcher);
}

Alarm clock app which ask questions (defined by user)

Alarm clock app which ask questions (defined by user)

There are a lot of alarm clocks for Android which require solving math
problems, scanning barcodes, photographing things etc. I tried to find one
which just ask question and require response but from user-defined list.
Is anyone know app such this?

Samsung Keyboard Handwriting Recognition

Samsung Keyboard Handwriting Recognition

Does anyone know if it is possible to have the Samsung Keyboard in the
Galaxy Note 10.1 to show up with Handwriting recognition as the default?
If possible, I'd like to do this with
android:inputType=""

Can't navigate to file in same folder using relative path?

Can't navigate to file in same folder using relative path?

I am absolutely confounded by this seemingly simple error. I can't
navigate to a file in the same folder using this code
NavigationService.Navigate(new Uri("Rotate.xaml", UriKind.Relative));
I also tried
NavigationService.Navigate(new Uri("/Rotate.xaml", UriKind.Relative));
However when I move the file I'm working on to the main project folder and
then use this navigation code
NavigationService.Navigate(new Uri("/Pages/Rotate.xaml", UriKind.Relative));
it works! Why can't I navigate to the file when I am in the same folder
but I can when I'm in the main project folder?

To give you a better idea here is the view of my solution explorer. This
view corresponds to the first two situations. In the thirdsituation I have
the PictureSelect.xaml file outside of the Pages folder and try to
navigate to the Rotate.Xaml file.

Assign categories to subsection, the create list of categories (like list of figures)

Assign categories to subsection, the create list of categories (like list
of figures)

Basically I'm using LaTeX to organize my sheet music. Each piece of music
is a subsection, which shows up in the ToC.
What I would like to do is assign a category to each piece of music and
then organize these categories in a "List of Categories" at the front of
the document much like the "List of Figures".
I haven't found a way to do this, and am wondering if this community could
help. I'm competent with LaTeX but am not experienced with making my own
commands. Hoping there's a package that could help with this.

Type 'MyClass' cannot inherit from a type that is not marked with DataContractAttribute or SerializableAttribute. Consider marking the base...

Type 'MyClass' cannot inherit from a type that is not marked with
DataContractAttribute or SerializableAttribute. Consider marking the
base...

I get this error message when I try to serialize an entity which derives
from TableEntity:
Type 'MyClass' cannot inherit from a type that is not marked with
DataContractAttribute or SerializableAttribute. Consider marking the base
type 'Microsoft.WindowsAzure.Storage.Table.TableEntity' with
DataContractAttribute or SerializableAttribute, or removing them from the
derived type.
The error message is pretty clear about what's going wrong.
So my question is, how can I work around DataContractAttribute not being
decorated in the TableEntity class?
Code:
[DataContract]
public class MyClass : TableEntity
{
public string Name { get; set; }
public string Email { get; set; }
}
I need to serialize MyClass as a byte[] and save that into the table storage.
public class MyClassAsByteArray : TableEntity
{
public byte[] SomeByteArray { get; set; }
}
If anyone has a suggestion on how to serialize this as a byte[], please
let me know.

Advantage & disadvantage of keeping a Constant.h file inside a project?

Advantage & disadvantage of keeping a Constant.h file inside a project?

i have seen many projects which is having a Constant.h file, where all the
classes has been declared & whenever programmers need to use those classes
they call Constant.h file.
So i am wondering wheather it is a good practice or not ?
Does it have some performance issue as we are calling many unnecessary
files present in Constant.h, even if it is not required ?

Sunday, 25 August 2013

Instance defined under child class returning nil and RSpec: no implicit conversion from nil to integer

Instance defined under child class returning nil and RSpec: no implicit
conversion from nil to integer

I have below code where action class is being returned after require
Robot Class
attr_accessor :action
def initialize
@action = Actions.new
end
def left
@action.left
end
Now Action class uses Direction::Move.new instance which is defined under
initialize method.
Actions Class
def place(x_coordinate, y_coordinate, direction = :north)
@x_coordinate = x_coordinate
@y_coordinate = y_coordinate
@direction = direction
@report.log_position(x_coordinate, y_coordinate, direction) if
x_coordinate.between?(@board.left_limit, @board.right_limit) &&
y_coordinate.between?(@board.bottom_limit, @board.top_limit) &&
@move.directions.grep(direction).present?
end
def left
@move.left(direction)
end
I have now defined Actions class with place method so direction gets
allocated to attr_accessor then robot.left is called
describe '#left' do
it 'should turn left' do
action.place(0, 0, Direction::North)
expect(robot.left).to eq(Direction::West)
end
end
But when I do Rspec test, it returns below error:
RSpec: no implicit conversion from nil to integer
Why robot.left which is calling action.left doesn't allow direction to be
passed over to this action.left method?

[ Other - Food & Drink ] Open Question : Are Eggo waffles suppose to be green?

[ Other - Food & Drink ] Open Question : Are Eggo waffles suppose to be
green?

Saturday, 24 August 2013

How to get time stamps in boot log messages untill the login prompt?

How to get time stamps in boot log messages untill the login prompt?

How do I get the time stamps in the bootlog like the following?
[Tue Mar 19 13:46:28.140 2013] U-Boot 1.4.0XXXXXX (Mar 04 2013 -
08:41:02)MPC83XX
[Tue Mar 19 13:46:28.156 2013]
[Tue Mar 19 13:46:28.156 2013] Reset Status:
[Tue Mar 19 13:46:28.156 2013]
[Tue Mar 19 13:46:28.156 2013] CPU: e300c3, MPC8308, Rev: 1.0 at 333.333
MHz, CSB: 133.333 MHz
[Tue Mar 19 13:46:28.187 2013] Board: XXXXX
[Tue Mar 19 13:46:28.187 2013] I2C: ready
[Tue Mar 19 13:46:28.187 2013] ZDRAM: 256 MiB (DDR2, 32-bit, ECC off,
266.667 MHz)
[Tue Mar 19 13:46:28.203 2013] ZDRAM Test Started ... DRAM Test Passed.
[Tue Mar 19 13:46:28.312 2013] ZFlash: 4 MiB
[Tue Mar 19 13:46:28.312 2013] ZNAND: 512 MiB
[Tue Mar 19 13:46:28.312 2013] Using default environment
..
..
[Tue Mar 19 13:49:58.640 2013] Jan 1 04:41:28 localhost kernel: device
xxxx-1 entered promiscuous mode
[Tue Mar 19 13:49:58.656 2013] Jan 1 04:41:28 localhost kernel: device
xxxx-2 entered promiscuous mode
[Tue Mar 19 13:49:58.671 2013] Jan 1 04:41:28 localhost kernel: device
xxxx-3 entered promiscuous mode
[Tue Mar 19 13:49:58.687 2013] Jan 1 04:41:28 localhost kernel: device
xxxx-4 entered promiscuous mode
[Tue Mar 19 13:49:58.703 2013] Jan 1 04:41:32 localhost kernel:
linux-xxx_port_mode(0, 2)
[Tue Mar 19 13:49:58.734 2013] Jan 1 04:41:32 localhost kernel: linux-xxx
interface [2]
[Tue Mar 19 13:49:58.750 2013] Jan 1 04:41:48 localhost kernel:
xxxx_ioctl(284): xxx.
[Tue Mar 19 13:49:58.765 2013] root@localhost:/root>
How do get the boot log and kernel initialization log till the login prompt?
Some expert has taken the above log in my project for a product earlier.
Can someone help how this needs to be done?

Htaccess /imagename/delete

Htaccess /imagename/delete

Okay so i'm working on creating a thing to delete images from my server. I
figured out about the unlink function and have turned it into a get
variable. How can I use htaccess to delete a file from my server with a
url like this example.com/imagename/delete
RewriteRule ^/delete/([^/]+)$ index.php?delete=$1
I realized that this does /delete/imagename but I want the urls to be
/imagename/delete. I tried the following but that didn't work.
RewriteRule ^/([^/]+)$/delete index.php?delete=$1
I know this sounds simple and easy to find on the web but I can't seem to
find this!

DreamHost and BitBucket SSH Key connection without prompting for passphrase

DreamHost and BitBucket SSH Key connection without prompting for passphrase

Originally based on this guide: Using Bitbucket for Automated Deployments
I have a repo set up on BitBucket with a POST hook pointing to the
deploy.php script on my web server. The only difference between my script
and the default code in the guide is the path on line 143:
$deploy = new Deploy('/home/my_username/my_domain.com');
As expected, the script runs whenever I push a commit to my origin repo on
BitBucket but it doesn't pull in any new commits. The 2 entries in the log
from lines 117 and 121 are:
INFO: Resetting repository... HEAD is now at 35272c4 Initial commit
INFO: Pulling in changes... HEAD is now at 35272c4 Initial commit
No matter how many times I push a new commit, this script will not detect
any new commits. But if I ssh to my web server and run git pull origin
master, it will ask for my passphrase and then will successfully pull in
all commits since the last pull.
Is it possible to set up this connection to avoid the passphrase prompt so
that it performs the git pull successfully?

MEAN stack, Win 7, git push heroku master results in sh: bower: not found error

MEAN stack, Win 7, git push heroku master results in sh: bower: not found
error

Can some please advise why I'm getting this error when doing a git push
heroku master on windows 7 for a basic mean stack app? I;m trying a basic
mean stack app and did the following commands before the "git push heroku
master" heroku command cd mean-stack
npm install
pm install -g bower
npm install -g yo grunt-cli bower@0.9.2
bower install
git init
git add .
git status
git add -f public/lib
git commit -m "init"
heroku create
C:\ss\D1\google\04\mean\mean-stack>git push heroku master
Enter passphrase for key
'/c/ss/D1/google/04/eclipse/eclipse/.ssh/id_rsa':
Counting objects: 466, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (448/448), done.
Writing objects: 100% (466/466), 8.61 MiB | 522 KiB/s, done.
Total 466 (delta 55), reused 0 (delta 0)
-----> Node.js app detected
-----> Resolving engine versions
Using Node.js version: 0.10.15
Using npm version: 1.2.30
-----> Fetching Node.js binaries
-----> Vendoring node into slug
-----> Installing dependencies with npm
npm WARN package.json mean@1.0.0 No repository field.
npm http GET https://registry.npmjs.org/express
npm http GET https://registry.npmjs.org/connect-flash
npm http GET https://registry.npmjs.org/mongoose
npm http GET https://registry.npmjs.org/passport
npm http GET https://registry.npmjs.org/passport-local
....
....
npm http GET https://registry.npmjs.org/lru-cache
npm http GET https://registry.npmjs.org/sigmund
npm http 200 https://registry.npmjs.org/sigmund
npm http GET https://registry.npmjs.org/sigmund/-/sigmund-1.0.0.tgz
npm http 200 https://registry.npmjs.org/lru-cache
npm http GET
https://registry.npmjs.org/lru-cache/-/lru-cache-2.3.1.tgz
npm http 200 https://registry.npmjs.org/sigmund/-/sigmund-1.0.0.tgz
npm http 200
https://registry.npmjs.org/lru-cache/-/lru-cache-2.3.1.tgz
> bson@0.1.8 install
/tmp/build_39luvwq9ok8kb/node_modules/connect-mongo/node_modules/mongodb/node_modules/bson
> (node-gyp rebuild 2> builderror.log) || (exit 0)
> kerberos@0.0.3 install
/tmp/build_39luvwq9ok8kb/node_modules/mongoose/node_modules/mongodb/node_modules/kerberos
> (node-gyp rebuild 2> builderror.log) || (exit 0)
> bson@0.2.2 install
/tmp/build_39luvwq9ok8kb/node_modules/mongoose/node_modules/mongodb/node_modules/bson
> (node-gyp rebuild 2> builderror.log) || (exit 0)
make: Entering directory
`/tmp/build_39luvwq9ok8kb/node_modules/connect-mongo/node_modules/mongodb/node_modules/bson/build'
CXX(target) Release/obj.target/bson/ext/bson.o
make: Entering directory
`/tmp/build_39luvwq9ok8kb/node_modules/mongoose/node_modules/mongodb/node_modules/bson/build'
CXX(target) Release/obj.target/bson/ext/bson.o
make: Entering directory
`/tmp/build_39luvwq9ok8kb/node_modules/mongoose/node_modules/mongodb/node_modules/kerberos/build'
SOLINK_MODULE(target) Release/obj.target/kerberos.node
SOLINK_MODULE(target) Release/obj.target/kerberos.node: Finished
COPY Release/kerberos.node
make: Leaving directory
`/tmp/build_39luvwq9ok8kb/node_modules/mongoose/node_modules/mongodb/node_modules/kerberos/build'
SOLINK_MODULE(target) Release/obj.target/bson.node
SOLINK_MODULE(target) Release/obj.target/bson.node: Finished
COPY Release/bson.node
make: Leaving directory
`/tmp/build_39luvwq9ok8kb/node_modules/connect-mongo/node_modules/mongodb/node_modules/bson/build'
SOLINK_MODULE(target) Release/obj.target/bson.node
SOLINK_MODULE(target) Release/obj.target/bson.node: Finished
COPY Release/bson.node
make: Leaving directory
`/tmp/build_39luvwq9ok8kb/node_modules/mongoose/node_modules/mongodb/node_modules/bson/build'
> mean@1.0.0 postinstall /tmp/build_39luvwq9ok8kb
> bower install
sh: bower: not found
npm ERR! weird error 127
npm ERR! not ok code 0
! Failed to install --production dependencies with npm
! Push rejected, failed to compile Node.js app
To git@heroku.com:afternoon-spire-6716.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:afternoon-spire-6716.git'

SpringFramework set selected FilePath to a "path attribute" of form

SpringFramework set selected FilePath to a "path attribute" of form

When a file is selected it must set the fileName with path to a textField
with path="inputFileName". I tried to below code which is not working as
setFileName is not called either onClick nor onSelect.
Any pointers how this can be done will be great help to me.
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="f" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%!
public void setFileName(){
System.out.println("In SetFile Name for InputFile");
}
%>
<html>
<body>
File Convertor
<PRE>
<f:form method="PUT" commandName="file2" >
Input File <f:input path="inputFileName"/><input type="file"
name="ChooseMyFile" value="A" onclick="setFileName()"
onselect="setFileName()"/>
Output File <f:input path="outputFileName"/>
</f:form>
</PRE>
</body>
</html>

Nonlinear solution condition

Nonlinear solution condition

The solution of nonlinear solitary wave equation can be written as
\begin{align} \phi(x) = \pm v \tanh\left[\frac{m}{ \sqrt 2} (x-x_0)\right]
\end{align}
the +ve refers kink and the minus refers anikink solution.
where $x_0$ is a constant of integration. What I dont understand from the
above equation is :
The energy density is localized near $x = x_0$ , and goes to zero
exponentially fast for $|x- x_0 | > 1/m.$ Can anyone explain me with
mathematical argument and graphical picture.
Please write if you need more information. Thanks in advance.

blktrace output & block sizes in linux block layer

blktrace output & block sizes in linux block layer

I have been using blktrace/blkparse recently and have a couple of
questions and would appreciate if somebody can help me out:
1) The number of blocks value in blkparse output is represented in sectors
(512 bytes). Is this correct? Is this still applicable in SSDs which don't
have 512 bytes sectors?
2) This number of blocks value doesn't go above 2048 (1MB) even if i run a
workload which submits data bigger then 1MB blocks (using libaio). Is
there a limit on block size that can be submitted to Linux block layer and
if the block layer automatically breaks larger blocks into smaller ones?
Could somebody point me to kernel codepath where this is done?
Thanks very much in advance.
Terko

Liferay cluster with SAN storage with ext3

Liferay cluster with SAN storage with ext3

I'm deploying an liferay portal in a cluster which has 2 node load
balanced, and config both to access to the same data location in a SAN
storage devide. The problem is each node can not see the other changing,
i.e when node 1 add new image, node 2 can not find this image without
mounting the san devide.
So, any one ever successfully deployed a cluster like this. I've found one
solution is GFS2, but I want to use ext3, because it very simple.
Thanks!

vhost on lampp doesn't show the proper page

vhost on lampp doesn't show the proper page

After the setup of lampp and the creation of my zend applicaiton I tried
to create a virtual host to test it, following this steps:
1: create a new host in lampp/etc/extra/httpd-vhosts.conf:
<VirtualHost *:80>
DocumentRoot "/my/application/path/public/"
ServerName myname.local
# This should be omitted in the production environment
SetEnv APPLICATION_ENV development
<Directory "/my/application/path/public/">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
2: add an entry in /etc/hosts, modify the following line:
127.0.0.1 localhost
into
127.0.0.1 myname.local localhost
Then I had restart lampp and go to httpd://myname.local, but instead the
index.php of my application it displayed the index page of lampp
Please ask me for further informations if needed

How to get my original ROM working again?

How to get my original ROM working again?

I have a Samsung Galaxy Ace GT-S5830L and I a few days ago downloaded and
installed a custom ROM 4.2.2 the name of the file is
(cm-10.1-20130503-NIGHTLY-cooper), It worked good at first, but then the
apps didn't download it used a lot of memory, it crashed/hanged and it
became annoying, So I'm trying to return to my previous original version
2.3.4, but It doesn't work... I made a backup with clockworks, but it
doesn't work. I tried downloading one from the internet and using thor (i
think that was its name) to install it, but it doesn't connect succeed
anytime I try... I also tried with kies, but It didn't work, it just staid
there for hours without doing anything...
So what are my options to restore the original ROM?, I really need to get
back to it, this version is just to buggy and annoying for me to stay with
it.

Friday, 23 August 2013

want to create tree node and print following pattern on console

want to create tree node and print following pattern on console

B1
A1
A B2
C1
A2
C2
Want to print this pattern dynamically. What i tried is using node to
represent the positions say left,right
Node<Integer> root = new Node<Integer>(2);
Node<Integer> n11 = new Node<Integer>(7);
Node<Integer> n12 = new Node<Integer>(5);
Node<Integer> n21 = new Node<Integer>(2);
Node<Integer> n22 = new Node<Integer>(6);
Node<Integer> n23 = new Node<Integer>(3);
Node<Integer> n24 = new Node<Integer>(6);
Node<Integer> n31 = new Node<Integer>(5);
Node<Integer> n32 = new Node<Integer>(8);
Node<Integer> n33 = new Node<Integer>(4);
Node<Integer> n34 = new Node<Integer>(5);
Node<Integer> n35 = new Node<Integer>(8);
Node<Integer> n36 = new Node<Integer>(4);
Node<Integer> n37 = new Node<Integer>(5);
Node<Integer> n38 = new Node<Integer>(8);
root.left = n11;
root.right = n12;
n11.left = n21;
n11.right = n22;
n12.left = n23;
n12.right = n24;
n21.left = n31;
n21.right = n32;
n22.left = n33;
n22.right = n34;
n23.left = n35;
n23.right = n36;
n24.left = n37;
n24.right = n38;
the program should accept the position as dynamically

HTML5 NOT WORKING IN FIREFOX

HTML5 NOT WORKING IN FIREFOX

I am new to the html5. When i am trying to implement a simple video tag I
got an error "No video with supported format and MIME type found". My code
is
<!DOCTYPE HTML>
<html>
<body>
<video width="320" height="240" controls="controls">
<!source src="movie.ogg" type="video/ogg" />
<source src="http://video-js.zencoder.com/oceans-clip.mp4" type="video/mp4
codecs='avc1.42E01E,mp4a.40.2'" />
<!source src="movie.webm" type="video/webm" />
Your browser does not support the video tag.
</video>
</body>
</html>
please help me
i am using firefox version 21.0

Continuity test if statment

Continuity test if statment

I have a if statement that looks something like this
if ($(window).width() < 799) {
$('.element').css({'display': 'none'});}
else{ $('.element').css({'display': 'block'});}
I would like to continuity test the statement so that when the window is
resized it would go back to normal (or the other way around). I have tried
setInterval however that does not seem to work nor does it seem like the
right thing to do. I'am aware that I can use css media quires for some of
this but some of the code not show can not be done in css.

How to enable button if item selected in a GridView

How to enable button if item selected in a GridView

I want to enable button when a grid view item is selected so that i will
update my GUI in metro apps. The button is also include as a list view
item. Below is the code snippet of what i want to do. Please help.
<GridView Name="searchPanelGrid" SelectionMode="Single"
HorizontalAlignment="Left"
ScrollViewer.IsHorizontalScrollChainingEnabled="True"
ScrollViewer.IsVerticalScrollChainingEnabled
="True"
ScrollViewer.HorizontalScrollBarVisibility="Auto"
ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.HorizontalScrollMode="Enabled"
ScrollViewer.VerticalScrollMode="Enabled"
ItemsSource="{Binding
Source={StaticResource CollectionItems}}"
Grid.Row="2">
<GridView.ItemsPanel>
<ItemsPanelTemplate>
<WrapGrid Orientation="Horizontal" />
</ItemsPanelTemplate>
</GridView.ItemsPanel>
<GridView.ItemTemplate>
<DataTemplate>
<Grid Margin="6" Height="175" Width="150"
Background="#FFFAFAFA">
<Grid.RowDefinitions>
<RowDefinition Height="85"/>
<RowDefinition Height="50"/>
<RowDefinition Height="30"/>
</Grid.RowDefinitions>
<StackPanel Background="#FF0A56BF" Width="150"
Height="85" Grid.Row="0">
<Image Source="{Binding Path=ThumnailUrl}"
Stretch="UniformToFill" HorizontalAlignment="Left"
VerticalAlignment="Top"/>
</StackPanel>
<TextBlock Text="{Binding Path=VideoName}"
TextWrapping="Wrap" Foreground="#FF017DD5"
Grid.Row="1" HorizontalAlignment="Left"
VerticalAlignment="Top" Height="Auto" FontSize="12"/>
<Button x:Name="downloadButton" Grid.Row="3"
Content="Download Video" HorizontalAlignment="Left"
VerticalAlignment="Bottom" Style="{StaticResource
DownloadButtonStyle}" Click="downloadButton_Click"
IsEnabled="{Binding}" />
</Grid>
</DataTemplate>
</GridView.ItemTemplate>
</GridView>
Unable to bind button property IsEnabled. Any suggestion how i do this ??

Scroll Not Working For my ListView

Scroll Not Working For my ListView

I have layout i want to use a scroll view.Inside the scroll view there is
i a listview that have fixed 9 item so i want that these 9 items should be
shown on the complete page and rest of the parts come inside the scroll
view .
MY XML File:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<LinearLayout
android:id="@+id/headerLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="@drawable/top_bg"
android:orientation="horizontal" >
<ImageView
android:id="@+id/back_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:onClick="goBack"
android:src="@drawable/back_button" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="75dp"
android:layout_marginTop="10dp"
android:text="Traveller Details"
android:textColor="@android:color/white" />
</LinearLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_below="@+id/headerLayout"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="@+id/tittleLayout"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_marginTop="5dp"
android:orientation="vertical" >
<TextView
android:id="@+id/TittleTravellerDetails"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:gravity="left"
android:text="Traveller Details" />
<View
android:layout_width="wrap_content"
android:layout_height="2dip"
android:layout_marginTop="2dp"
android:background="#FF909090" />
</LinearLayout>
<LinearLayout
android:id="@+id/passengerDetails"
android:layout_below="@+id/tittleLayout"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:orientation="vertical">
<Spinner
android:id="@+id/Tittle"
android:layout_width="290dp"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:visibility="gone"
android:layout_height="wrap_content"/>
<EditText
android:id="@+id/firstName"
android:layout_width="290dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
android:maxLines="1"
android:hint="First Name" />
<EditText
android:id="@+id/LastName"
android:layout_width="290dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
android:maxLines="1"
android:hint="Last Name" />
<ListView
android:id="@+id/passengerList"
android:layout_width="290dp"
android:layout_height="166dp"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
android:visibility="gone"
android:choiceMode="singleChoice" />
</LinearLayout>
<LinearLayout
android:id="@+id/ContactDetailsLayout"
android:layout_below="@+id/passengerDetails"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_marginTop="10dp"
android:orientation="vertical" >
<TextView
android:id="@+id/TittleContactDetails"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:gravity="left"
android:text="ContactDetails" />
<View
android:layout_width="wrap_content"
android:layout_height="2dip"
android:layout_marginTop="2dp"
android:background="#FF909090" />
</LinearLayout>
<LinearLayout
android:id="@+id/mobileEmailDetails"
android:layout_below="@+id/ContactDetailsLayout"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:orientation="vertical">
<EditText
android:id="@+id/mobileNumber"
android:layout_width="290dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
android:maxLength="10"
android:maxLines="1"
android:inputType="number"
android:hint="Mobile No" />
<TextView
android:id="@+id/emailid"
android:layout_width="284dp"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginTop="10dp"
android:hint="Email ID" />
</LinearLayout>
<LinearLayout
android:id="@+id/continueBooking"
android:layout_below="@+id/mobileEmailDetails"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:orientation="vertical">
<ImageView
android:id="@+id/continuebooking"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="20dp"
android:layout_marginTop="30dp"
android:src="@drawable/searchflight" />
</LinearLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
When the Listview will appear inside the layout id :passengerDetails then
the edit text and the spinner will not appear .Please help me to resolve
the issue.suggest me what i have to do

Thursday, 22 August 2013

How to get index of UIButton that viewwithtag in uitableview ios

How to get index of UIButton that viewwithtag in uitableview ios

I have a problem: i want to get index of UIButton in tableview. I created
uitableview has 2 uibutton in each row, but when i click on uibutton, it
get index incorrect. Code create UITableview :
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = (UITableViewCell *)[_tableView
dequeueReusableCellWithIdentifier:CellIdentifier];
if (nil == cell) {
cell = [[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:CellIdentifier];
UIButton *market = [UIButton buttonWithType:UIButtonTypeCustom];
[market setFrame:CGRectMake(200, 6, 30, 30)];
[market setTag:4000];
[market addTarget:self action:@selector(marketPressedAction:)
forControlEvents:UIControlEventTouchDown];
[cell.contentView addSubview:market];
}
UIButton *marketButton = (UIButton*)[cell.contentView viewWithTag:4000];
return cell;
}
And marketPressedAction fucntion
- (void)marketPressedAction:(id)sender
{
buttonPressed = (UIButton *)sender;
buttontag = buttonPressed.tag ;
NSLog(@"Market button click at row %d",buttontag);
}
When table has 5 row, i click on button, it show error:
-[__NSArrayM objectAtIndex:]: index 4000 beyond bounds [0 .. 4]'
Thanks in advance

UITableView not correctly aligning

UITableView not correctly aligning

I have a table that is during odd things with its alignment. IT is a
UITableView on top of a view controller.

Why is there so much distance (the green line) between the navigation bar
and the first cell? And why is there a small gap between the cell and the
left side off the screen (red line)? I can of course correct this with IB
by dragging the TableView off screen but would rather fix this the 'right
way' and understand why its doing this in the first place.

Phonegap height change in IOS?

Phonegap height change in IOS?

I have a simple phonegap project, i want to add admobs to it, i need to
decrees the phonegap height to leave a 50dp space in the top of the
screen, and leave 90dp when on ipad, im not sure about the way to do this,
right now i just left a 50dp space in the html file where i place admob to
the top of the screen above that html, im sure this is not the right way
if i want to use smart banners for Iphones and ipads.
i trying doing some changes with this code but with no luck, im sure there
is another way.
CGRect screenBounds = [[UIScreen mainScreen] bounds];
self.window = [[[UIWindow alloc] initWithFrame:screenBounds] autorelease];

$f(x)=\int_{0}^x \cos^4 t\, dt$=?

$f(x)=\int_{0}^x \cos^4 t\, dt$=?

How to prove that if $f(x)=\int_{0}^x \cos^4 t\, dt$ then $f(x+\pi)$
equals to $f(x)+f(\pi)$
I thought to first integrate $\cos^4 t$ but this might be the problem of
Definite Integral

knockoutjs conteiner less template inside SELECT, foreach OPTION not working with Internet Explorer

knockoutjs conteiner less template inside SELECT, foreach OPTION not
working with Internet Explorer

I have an quiz/survey application and I'm having problems populating a
dropdown list using knockoutjs.
Please check this fiddle with Firefox, then try it with Internet Explorer
9 (or IE8, or IE7... knockout says to be compatible from IE6+).
In Firefox my jsfiddle example works, but not with Internet Explorer.
I suspect that something is not working well with $parent, or
$parent.ParticipantAnswer == null is not understood by Internet Explorer.
I tried to debug but obviously didn't find the cause, so here I am.
In both tab1 and tab2, the options are not populated, so here the code
where these 2 templates are called:
<!-- ko if: AnswerTypeId == 2 -->
<select data-bind="attr: { name: Id, id: 'answerq' + Id }">
<option value="0"></option>
<!-- ko template: { name: 'option-template', foreach: Answers } -->
<!-- /ko -->
</select>
<!-- /ko -->
<!-- ko if: AnswerTypeId == 6 -->
<select data-bind="attr: { name: Id, id: 'answerq' + Id }">
<option value="0"></option>
<!-- ko template: { name: 'location-template', foreach: Answers } -->
<!-- /ko -->
</select>
<!-- /ko -->
And here the 2 templates:
<script type="text/html" id="option-template">
<!-- ko if: $parent.ParticipantAnswer != null &&
$parent.ParticipantAnswer.AnswerId == $data.Id -->
<option data-bind="text: Description, attr: { value: Id, selected:
'selected' }"></option>
<!-- /ko -->
<!-- ko if: ($parent.ParticipantAnswer == null ||
$parent.ParticipantAnswer.AnswerId != $data.Id) -->
<option data-bind="text: Description, attr: { value: Id }"></option>
<!-- /ko -->
</script>
<script type="text/html" id="location-template">
<!-- ko if: $parent.ParticipantAnswer != null &&
$parent.ParticipantAnswer.AnswerInt == $data.Id -->
<option data-bind="text: Description, attr: { value: Id, selected:
'selected' }"></option>
<!-- /ko -->
<!-- ko if: ($parent.ParticipantAnswer == null ||
$parent.ParticipantAnswer.AnswerInt != $data.Id) -->
<option data-bind="text: Description, attr: { value: Id }"></option>
<!-- /ko -->
</script>
I was thinking that a container less template would create problems, but
this jsfiddle works on both Firefox and IE.
I really have no idea why it doesn't work with IE, I'm asking here for a
valid fix and maybe an explanation of the cause, so we all can learn from
it ;) Thank you.

Why is Velocity macro not parsing a normal reference notation?

Why is Velocity macro not parsing a normal reference notation?

I have a macro which is parsing on one development machine and not on the
other. I cannot find any differences and wish to know if this is an issue
with the velocity version (currently running 1.6.4) or perhaps something
else.
In my macros I have;
#macro(mylinkmacro $formName)
<a href="javascript: document.$formName.submit();">label</a>
One output is;
<a href="javascript: document.$formName.submit();">label</a>
the other is (where I've given a formName of "myform");
<a href="javascript: document.myform.submit();">label</a>
Where I get the $formName in the output I using running Tomcat 6.0.35.0,
Java 1.6.0_26, Velocity 1.6.4 JAR, Velocity Tools 2.0 JAR and Velocity
Tools Generic 1.1 JAR. I've tried compiling and running this on both
Ubuntu and Win7.
Where I get the myform in the output is a different Win7 and Ubuntu
environment with the same source code.

Wednesday, 21 August 2013

How the IIS server persistent the identity credential? Is this an security issue?

How the IIS server persistent the identity credential? Is this an security
issue?

As far as I know the IIS persistent the identity credentital, when you
configure it run or connect an disk using a specificed identity (username
and password), so when the IIS server machine restart, it doesn't need you
re-config it.
But as the credential are persistent that means each user, who can access
the persistent storage (whater ever file or other storage), can extract
the user name and password. Does this an security issue? How does IIS
resolve this issue? (Only save an token, which is the result of using the
username and password for authentication, doesn't work, because you can
also extract the token, and use it.)

how to dismiss a view that has been replaced by another one properly

how to dismiss a view that has been replaced by another one properly

I have two views that are associated with the same div element:
MuSe.views.View1= Backbone.View.extend({
el: "#applicationCanvas",
...
MuSe.views.View2= Backbone.View.extend({
el: "#applicationCanvas",
...
I begin with rendering View1 and when the user terminates the interaction
I want to replace everything with View2.
I would like to dismiss View1 properly (unbind it from the div
#applicationCanvas so that the garbage collector can do its job) and to do
so I call undelegateEvents() on it. I can't call remove() because I need
#applicationCanvas for View2. I was wondering if calling undelegateEvents
and replacing the entire dom subtree of #applicationCanvas was enough.
What's your say?
Thanks

Detecting & Installing CA Certificate Chain from browser

Detecting & Installing CA Certificate Chain from browser

I have an enterprise certificate chain from Microsoft Active Directory
Certificate Services which needs to be installed when a user loads my
webpage. If this certificate chain has been installed previously, skip the
install process.
I know I can't do it programmatically or without them acknowledging the
install. I'm a Javascript developer and don't have much server side
experience. My question is how/what would be a good way of approaching
this while making the install as seamless as possible?
I'm open to all suggestions so I can determine what I need to learn and
move on from there. An example of what I mean can be found here.

BX slider. Adding and removing class to previous slides

BX slider. Adding and removing class to previous slides

I am trying to add a class to each slide navigation bullet that is before
the current slide.
Right now it adds a class if you click the next button. However I cant
figure out how to remove the class when the previous button is clicked.
Something along the lines of
$(document).ready(function($) {
function(){
if (slide <= currentSlide) {
$('.bx-pager .active').addClass('blueylooey');
} else {
$('.bx-pager .active').removeClass('blueylooey');
}
});
This is what I have working so far: http://jsfiddle.net/mreee/xVnQY/

Catching errors

Catching errors

I got an form sending to authorization.php
<form method="POST" action="components/authorization.php">
<div class="auth"></div>
<fieldset>
<label>Ïîëíûé èãðîâîé íèê</label>
<input type="text" id="eu_name"
name="eu_name" placeholder="Èãðîâîé íèê…">
<label>Íàçâàíèå Ñîöèóìà (Society)</label>
<input type="text" id="eu_society"
name="eu_society" placeholder="Ñîöèóì…">
<label>Äîïîëíèòåëüíàÿ èíôîðìàöèÿ</label>
<textarea class="textarea" id="eu_notes"
name="eu_notes"></textarea>
<label class="checkbox">
<input id="eu_want_team"
name="eu_want_team" type="checkbox"> Èùó
ëþäåé äëÿ êîìàíäíîé îõîòû
</label>
<input type="hidden" name="vk_id"
id="vk_id" value="<?php echo $viewer_id;
?>" />
<button type="submit" id="submit"
class="btn green">Îòïðàâèòü</button>
</fieldset>
</form>
Authorization.php contains an class which is taking post values and
inserting them into database.
require_once 'database.php';
class Authorization extends Database {
public $vk_id;
public $eu_name;
public $eu_society;
public $eu_notes;
public $eu_want_team;
public function __construct() {
parent::__construct('144.76.6.45','5432','eu','eu','eu123');
$this->vk_id = $_POST['vk_id'];
$this->eu_name = $_POST['eu_name'];
$this->eu_society = $_POST['eu_society'];
$this->eu_notes = $_POST['eu_notes'];
$this->eu_want_team = $_POST['eu_want_team'];
}
function querySelect($query) {
$this->query = $query;
$this->STH = $this->DBH->prepare($this->query);
$this->STH->execute();
$this->STH->setFetchMode(PDO::FETCH_ASSOC);
}
function queryInsert($query) {
$this->query = $query;
$this->STH = $this->DBH->prepare($this->query);
$this->STH->bindParam(':vk_id', $this->vk_id);
$this->STH->bindParam(':eu_name', $this->eu_name);
$this->STH->bindParam(':eu_society', $this->eu_society);
$this->STH->bindParam(':eu_notes', $this->eu_notes);
$this->STH->bindParam(':eu_want_team', $this->eu_want_team);
$this->STH->execute();
}
}
try {
$auth = new Authorization();
$auth->queryInsert('INSERT INTO users (vk_id, eu_name, eu_society,
eu_notes, eu_want_team) VALUES (:vk_id, :eu_name, :eu_society, :eu_notes,
:eu_want_team)');
$auth->DBH->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
echo 'Error: ' . $e->getMessage();
}
It doesnt works, i tried to catch the error by setting
$auth->DBH->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION) and
displaying $e->getMessage() but it doesnt display. I'll send variables via
ajax ofc, after solving this.
1) How to display errors? 2) Whats the problem in the code?

MVC partial view with int model throws exception

MVC partial view with int model throws exception

I have created a partial view that allows an int to be updated using the
jQuery spinner plugin. This is shown in a qtip tooltip.
@model int
...
@Html.TextBoxFor(x => x, new { @class = "spinner" })
and the controller action:
[HttpGet]
public PartialViewResult TaskPriority(int id)
{
var task = Task.Get(id);
return PartialView("TaskPriority", task.Priority);
}
When I call the action from my page I get:
Value cannot be null or empty. Parameter name: name
The exception is thrown on the TextBoxFor line.
So what am I doing wrong here and why is it wrong? Am I overcomplicating it?

Looking for lines which is in one file but not in other using Unix and Awk

Looking for lines which is in one file but not in other using Unix and Awk

I have 2 files with 7 fields and I want to print the lines which are
present in file1 but not in file2 based on field1 and field2.
Logic: I want to print all the lines, where there is a particular column1
and column2. And we do not find the set of column1 and column2 in file2.
Example: "sc2/10 10" this set you would not see in file 2, therefore it is
printed as output.
File1:
sc2/80 20 . A T 86 F=5;U=4
sc2/60 55 . G T 76 F=5;U=4
sc2/10 10 . G C 50 F=5;U=4
sc2/68 20 . T C 71 F=5;U=4
sc2/24 24 . T G 31 F=5;U=4
sc2/11 30 . A T 60 F=5;U=4
File2:
sc2/80 20 . A T 30 F=5;U=4
sc2/60 55 . T T 77 F=5;U=4
sc2/68 20 . C C 01 F=5;U=4
sc2/24 29 . T G 31 F=5;U=4
sc2/24 19 . G G 11 F=5;U=4
sc2/88 89 . T G 51 F=5;U=4
Expected Output:
sc2/10 10 . G C 50 F=5;U=4
sc2/11 30 . A T 60 F=5;U=4
I would appreciate your help.

Tuesday, 20 August 2013

Runtime exception from AsynchTask

Runtime exception from AsynchTask

I have a Popup system that displays Popup alerts with a Textview. The
Popup class (shown below) is called through an Intent from another class.
The code for the Popup class works when the Popup is displayed on the
onCreate method (the code that makes it is done is shown in block comments
in the oncreate class). However, my function is to create the popups so
that it does not stop/pause the background applications. Pretty much get
the functionality of a Toast. Display the Popup without interrupting the
background apps. So I have decided to implement this using AsynchTask but
I keep getting a the run time exception. Could someone guide me in the
right path? I believe I must implement a onPostExecute but not sure how I
should go about this.
public class Popups extends Activity {
private Dialog mDialog;
//static final String ACTION = "android.provider.Telephony.SMS_RECEIVED";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.popups);
//IntentFilter filter = new IntentFilter(ACTION);
//this.registerReceiver(mReceivedSMSReceiver, filter);
/*
String message = getIntent().getStringExtra("message");
TextView messageView = (TextView) findViewById(R.id.message);
messageView.setText(message);
Handler handler = new Handler();
long delay = 5000;
handler.postDelayed(new Runnable() {
@Override
public void run() {
Popups.this.finish();
}
}, delay);
*/
PopupAsynch myPopup = new PopupAsynch();
myPopup.execute(1);
}
private class PopupAsynch extends AsyncTask<Integer, Void, Integer>
{
TextView messageView = (TextView) findViewById(R.id.message);
String message = getIntent().getStringExtra("message");
@Override
protected Integer doInBackground(Integer... params) {
Handler handler = new Handler();
long delay = 5000;
handler.postDelayed(new Runnable() {
@Override
public void run() {
Popups.this.finish();
}
}, delay);
messageView.setText(message);
return 1;
}
}
}

Justifying AngularUI tabs

Justifying AngularUI tabs

I have not been able to find a way to justify angularui's tabs so they are
all the same size. Has any of you encountered this issue and come up with
a way of making them look all the same size regardless of the size of the
elements.

Change names of appended table row fields jQuery

Change names of appended table row fields jQuery

I have a table in an html form containing a table that a row is added to
every time a button is clicked. When each row is added, I want the name
and id of each field in the new row (there are four) to be updated from
"Id.0" in the first row to "Id.1" in the second row and then "Id.2" in the
third, etc. I can accomplish this with the id no problem using
var next=$("#QualificationRequirements tr:last").clone();
fixIds(next,nexdex);
nexdex++;
$("#QualificationRequirements").append(next);
function fixIds(element, counter) {
$(element).find("[id]").add(element).each(function() {
this.id = this.id.replace(/\d+$/, "")+counter;
});
}
However I have found that the same logic does not apply to the name
attribute, and
$(element).find("[name]").add(element).each(function() {
this.name = this.name.replace(/\d+$/, "")+counter;
});
causes an error.
Can anyone see what I'm doing wrong? Thanks!

Check invitation accepted with Facebook app

Check invitation accepted with Facebook app

I'm using facebook invite plugin in a facebook app. I want to know if its
possible to know if a user have accepted or refused an invitation request.
I want to track refuse & acception requests for analytics stuff. The best
thing would be that i receive a notification saying yes or no.
I have checked on facebook developers but i dont have find a solution to
my problem :
https://developers.facebook.com/docs/howtos/multi-friend-selector/
If someone could help me, that would be awesome.
Thanks in advance
Regards

How to add dropdown dynamically

How to add dropdown dynamically

I am trying to add the dynamic drop down through javascript.
i have a dropdown which has numbers, when selected creates the drop down.
but i want to add the dynamic dropdown through javascript. how can i do
this?
here is php code
code:
<?php
try {
$dbh = new
PDO('mysql:dbname=theaterdb;host=localhost','tiger','tiger');
} catch (PDOException $e) {
echo 'Connection failed: ' . $e->getMessage();
}
$sql = "SELECT theater_name FROM theater;";
$sth = $dbh->prepare($sql);
$sth->execute();
echo "<select name='theater_name' id='course'
onchange='showUser(this.value);'>";
echo "<option>----Select Theater----</option>";
while($row = $sth->fetch(PDO::FETCH_ASSOC)) {
echo "<option value='" . $row['theater_name'] ."'>" .
$row['theater_name']. "</option>";
}
echo "</select>";
?>
This php code gets the drop down values from mysql database. but this drop
down will be created dynamically from javascript
javascript code
function create(param) {
'use strict';
var i, target = document.getElementById('screens');
target.innerHTML = '';
for(i = 0; i < param; i += 1) {
target.innerHTML +='</br>';
target.innerHTML +='Movie in hall '+i+' ';
target.innerHTML += '<?php
try {
$dbh = new
PDO('mysql:dbname=theaterdb;host=localhost','tiger','tiger');
} catch (PDOException $e) {
echo 'Connection failed: ' . $e->getMessage();
}
$sql = "SELECT theater_name FROM theater;";
$sth = $dbh->prepare($sql);
$sth->execute();
echo "<select name='theater_name' id='course'
onchange='showUser(this.value);'>";
echo "<option>----Select Theater----</option>";
while($row = $sth->fetch(PDO::FETCH_ASSOC)) {
echo "<option value='" . $row['theater_name'] ."'>" .
$row['theater_name']. "</option>";
}
echo "</select>";
?>';
target.innerHTML +=' '+'Timings '+' ';
target.innerHTML += '<input type="text" name="timings">';
target.innerHTML +='</br>';
target.innerHTML +='</br>';
}
}
so now i have added this php code in javascript but it is not creating the
dropdown..
Why? How can i do this

Monday, 19 August 2013

How do you identify and serve gzipped content to Cloudfront in Asp.net mvc?

How do you identify and serve gzipped content to Cloudfront in Asp.net mvc?

I have an asp.net MVC application that serves static content through a
controller method that detects the "Accept-Encoding" header and serves
content accordingly. This was causing problems so I made the compressor
method return Gzipped content regardless of the header values, and I still
get Google PageSpeed telling me that content should be GZipped!
I have seen articles about configuring this in IIS at machine level, but
not how to get this to work when returning compressed content
programmatically.
Can anyone help? Many thanks.

Method Created Objects Deleted on Exit

Method Created Objects Deleted on Exit

Are objects / fields created in a method deleted upon the exit of that
specific method?
Example:
public static void createFolder() {
File folder = new File(C:\example\path "foldername");
folder.mkdir();
}
Would the MEMORY used to store the File "folder" be deleted upon exit of
the "createFolder" method?

Determining A Splitting Field

Determining A Splitting Field

I am trying to determine the splitting fields of a bunch of polynomials.
I'll ask one here and hope that a general enough technique can be
described to find the rest of them.
Currently, I'm trying to find the splitting field of
$(x^{15}-5)(x^{77}-1)$ over $\Bbb Q$, find the degree, and determine if
it's a Galois extension.
Now, I know that the right polynomial is the cyclotomic polynomial, hence
has degree $\varphi(77)=60$, over $\Bbb Q$. The left polynomial is
irreducible by Eisenstein's Criterion, hence adjoining $\sqrt[15]{5}$
gives a degree 15 extension and as a separate extension, adjoining
$\zeta_{15}$ (a primitive $15^{th}$ root of unity) gives a degree $8$
extension. All of this seems well and good, but now I'm lost. The
splitting field itself is obvious, but how can I check the degree and
determine if it is Galois?

javascript loop array get counts

javascript loop array get counts

If I have an array like this how can I loop through and push the counts
into a a new array?
All help wlcomed!
var Products = [
['Product A'],
['Product A'],
['Product A'],
['Product A'],
['Product A'],
['Product B'],
['Product B'],
['Product B'],
['Product B'],
['Product B'],
['Product B'],
['Product B'],
['Product B'],
['Product B'],
['Old Product B'],
['Old Product B'],
['Old Product B'],
['Old Product B'],
['Old Product B'],
['Old Product]
];
End Goal :
var UniqueProducts = [
['Product A',5],
['Product B',6],
['Old Product B',9]
];