Wednesday, April 18, 2012

How to give a click function for center | focus image in roudabout carousel?

I am trying to give click function to focus image (center image) in jquery round about carousel .



http://fredhq.com/projects/roundabout/demos/images in this url I need click fucntion which should go to other web page.
I need this function only for center(focus) image not for other child images . For other image it should come in focus and then I need click even to happen.



For example :



On click of the center or focus image I need to go to (open new window) google.com



questions :



1) Is there any way to call a onclick event for focus image ?
2) If its not possible through roundabout carousel is there any other carousel which supports this.
3) http://fredhq.com/projects/roundabout Is there any API I can use for this on click event?



Can Anyone help me in this





How to check if variable is undefined

I am using HAML and jquery to code my application. I have a single 'Share' template that is used to display a URL link. I want it to be flexible such that it will display different URLs depending on the variables that are passed into it.



//Code to trigger view and populate template -> Note I only pass in the thread vara here
share_view = new Onethingaday.Views.Threads.ShareView
thread: new Onethingaday.Models.Thread(@options.thread_muses.first().get('question'))

//snippet from share view to pass the variables to the template
render: ->
$(@el).html @template
nickname: @options.nickname
thread_slug: @options.thread.get('slug')
thread_text: @options.thread.get('text')
@

//Snippet of share view's template. Added if-else statement to check if nickname is defined
.sidebar_text Link:
<% if (typeof <%= nickname %> !== "undefined") { %>
%input.detail_text{value: "<%= 'http://dailymus.es/' + nickname + '/threads/' + thread_slug %>"}
<% } else { %>
%input.detail_text{value: "<%= 'http://dailymus.es/' + '/threads/' + thread_slug %>"}
<% } %>


In the above example, I did not define "nickname" variable. I expect that the else portion will be triggered and the URL displayed is "http://dailymus.es/threads/some-slug-text"



However I am still getting the following



enter image description here



As you see, it is still triggering the 'if' portion and displaying the 'undefined' as part of the URL.



How can I correctly check for 'undefined' variables in my case?





how to make the library project's method working in another project in android?

I have a project which I am trying to use in another new project, my existing project java code is here:



package com.powergroup.splitview;

import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.TextView;

public class SplitviewActivity extends FragmentActivity implements
Left.OnButtonClickListener {

LinearLayout LEFT, RIGHT, leftfragmentln, rightfragmentln;
Right rightFr;
Left leftFr;


@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//reduced the Gray Bar
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);


setContentView(R.layout.main);
// initializes the objects
initializer();

// sets the size of the two sides, give the ration here
setSize(20, 80);
// sets the colour of the two sides
setColor(Color.BLUE, Color.RED);

}

public void initializer() {
LEFT = (LinearLayout) findViewById(R.id.lnLeft);
RIGHT = (LinearLayout) findViewById(R.id.lnRight);
leftfragmentln = (LinearLayout) findViewById(R.id.lnLeftFragment);
rightfragmentln = (LinearLayout) findViewById(R.id.lnRightFragment);
rightFr = (Right) getSupportFragmentManager().findFragmentById(
R.id.view_right);
leftFr = (Left) getSupportFragmentManager().findFragmentById(
R.id.view_left);

}

public void setColor(int leftColor, int rightColor) {

// for landscape mode
if ((rightFr != null) && rightFr.isInLayout() && (leftFr != null)
&& leftFr.isInLayout()) {

LEFT.setBackgroundColor(leftColor);
RIGHT.setBackgroundColor(rightColor);
} else {
// for portrait mode
RIGHT.setBackgroundColor(rightColor);

}

}

public void setSize(float leftsize, float rightsize) {

// for landscape mode
if ((rightFr != null) && rightFr.isInLayout() && (leftFr != null)
&& leftFr.isInLayout()) {

android.widget.LinearLayout.LayoutParams par1 = (LayoutParams) LEFT
.getLayoutParams();

android.widget.LinearLayout.LayoutParams par2 = (LayoutParams) RIGHT
.getLayoutParams();
par1.weight = rightsize;
par2.weight = leftsize;

}

}

// a method to add view in a blank xml programatically
public void setView(View leftView, View rightView) {
if ((rightFr != null) && rightFr.isInLayout() && (leftFr != null)
&& leftFr.isInLayout()) {
leftfragmentln.addView(leftView);
rightfragmentln.addView(rightView);
} else {

rightfragmentln.addView(rightView);

}
}

@Override
public void onClickButton(String s) {

if ((rightFr != null) && rightFr.isInLayout()) {
rightFr.setText(s);
} else {
Intent intent = new Intent(this, RightActivity.class);
intent.putExtra("value", s);
startActivity(intent);
}

}

}


I have made above code as a library and trying to use in my another project where i can use the above methods. What should I do? Plz Help





Left outer join of datatable with linq expression?

I have two DataTables:



DataTable dtFields = new DataTable("tmpFieldTable");

dtFields.Columns.Add("FieldID");
dtFields.Columns.Add("CDGroupID");
dtFields.Columns.Add("CDCaption");
dtFields.Columns.Add("fldIndex");


and



 DataTable dtCDGroup = new DataTable("tmpCDGroup");

dtCDGroup.Columns.Add("CDGroupID");
dtCDGroup.Columns.Add("Name");
dtCDGroup.Columns.Add("Priority");


I am using following LINQ expression to join these tables:



var resultList = dtFields.AsEnumerable()
.Join(dtCDGroup.AsEnumerable(),
fieldList => fieldList.Field<string>("CDGroupID"),
cd => cd.Field<string>("CDGroupID"),
(fieldList, cd) => new
{
FieldID = fieldList.Field<string>("FieldID"),
CdGroup = cd.Field<string>("Name"),
CDCaption = fieldList.Field<string>("CDCaption"),
Priority = (cd.Field<string>("Priority") ?? "99"),
fldIndex = fieldList.Field<string>("fldIndex").ToString()
})
.OrderBy(result => result.Priority)
.ThenBy(result => result.fldIndex);


How can I perform left outer join with these DataTables?





xml file node value not getting in iE?

i have this xml file



<form> <age>18 To 25~18-25</age><religion>No Religious Belief~8</religion><mothertongue>Any~1</mothertongue><countries>Any~0</countries><work_status>Any~2</work_status><photo>Any~0</photo> </form>


i want to get nodevalue of the node countries(by name, not by position, because postion can vary) .



after parsing, i am using this in my javascript code



xmlDoc.getElementsByTagName("countries")[0].childNodes[0].nodeValue



it is giving me correct value in mozilla but not in ie
error occurs that object is required



please help





non static method ... cannot be referenced from a static context

Here is the error message



non static method hero(double,double,double) cannot be reference from a static context



Here is the class method.



class MyMath {
double hero(double n1, double n2, double n3)
{
double n4;
double n5;
n4 = (n1 + n2 + n3) / 2;
n5 = Math.sqrt((n4 * (n4 - n1) * (n4 - n2) * (n4 - n3)));
return n5;
}
}


Here is the main program



double length_of_a;
double length_of_b;
double length_of_c;
double area_of_triangle;

area_of_triangle = (double) MyMath.hero(length_of_a,length_of_b,length_of_c);




What parameters does TeamCity pass to MSBuild under the covers?

I just downloaded TeamCity 7 today and decided to get it up and running for my Azure solution. I am not trying to do anything fancy (yet) and started with a very basic command line build:



msbuild /t:Publish /p:Configuration=Release;TargetProfile=Production;PublishDir=S:\HoursTracker\Deployments


This builds successfully and produces a package that looks like this*:



enter image description here



I then attempted to configure TeamCity in an identical fashion:



enter image description here



This builds successfully and produces a package that looks like this*:



enter image description here



What I don't understand is why there is such a huge discrepancy in the size of the MVC project. Publishing directly from Visual Studio produces the exact same result as my MSBuild command so I'm convinced that TeamCity is the odd man out. Since I assume TeamCity is not broken, can someone please educate me on how to properly configure it so that I get the expected output?



*I have renamed the package files with .zip so that the details were viewable for this post.