Saturday, 31 August 2013

Read File in chunks and then read line by line using LineNumberReader. Repeat this activity

Read File in chunks and then read line by line using LineNumberReader.
Repeat this activity

I have a file containing some 6.5 lakh lines. Now I wish to read every
line of this file using LineNumberReader.
However I am encountering an outofMemoryError on adding these many number
of lines to another 3rd party library..
What I intend to do is, read 200000 lines of a file at a time and add
these lines to 3rd party library.
I am using LineNumberReader but I think the entire file is being read
although I have provided condition that when line count reaches 200000
break the loop and add these to 3rd party library..
A code snippet for the same:
LineNumberReader lnr=new LineNumberReader(new FileReader(file));
String line=null;
int i=0;
while(flags)
{
while( null != (line = lnr.readLine()) ){
i++;
3rdPartyLibrary.add(line.trim());
if(i==200000)
{
System.out.println("Breaking");
lnr.mark(i);
break;
}
if(i==400000)
{
System.out.println("" );
lnr.mark(i);
break;
}
if(i==600000)
{
System.out.println("BREAKING " );
lnr.mark(i);
break;
}
}
if(line==null)
{
System.out.println(" FLAG");
flags=false;
}
lnr.reset();
}
What I am intending to do here is read file from 0-200000 in first
iteration. Then read each individual line and add to 3rd party lib.. Once
this is done, read another 200000 lines from (200001-400000) and then
repeat the same activity.
Need help..Can someone please guide..

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

Effective method for reading large CSV files?

Effective method for reading large CSV files?

I currently have 5 CSV files with about 45,000 records per each file.
Whats the best method to go about this? Ive done I/O before, but never on
this scale. Parse into a vector string?

Drawing a circle with inner box shadow

Drawing a circle with inner box shadow

I want to draw few circle using inner box-shadow.
Here is my JsFiddle
css
.circle {
width: 20px;
height: 20px;
display: inline-block;
border-radius: 50%;
border:1px solid #000;
}
How can i apply inner box-shadow in the circle

why size of a class is zero in this case and how we ensure different objects have different address

why size of a class is zero in this case and how we ensure different
objects have different address

i create a clss bt its size is zero .now how can be ensure that object
have different addresses as wwe know empty class have non zero size to
ensure that
`#include<cstdio>
#include<iostream>
using namespace std;
class Test
{
int arr[0];//why size is zero?
};
int main()
{
Test a,b;
if (&a == &b)// now how we ensure about address of objects ?
cout << "impossible " << endl;
else
cout << "Fine " << endl;//why address is nt same?
return 0;
}`

sample for camel to send data from grails to services ( service mix)

sample for camel to send data from grails to services ( service mix)

I don't understand what exactly Camel does. If you could give in 101 words
an introduction to Camel:
What exactly is it? How does it interact with an application written in
Java? Is it something that goes together with the server? Is it an
independent program?
Can you give me an sample.

Pass a Nokogiri::XML::Element into Delayed Job

Pass a Nokogiri::XML::Element into Delayed Job

I create a variable, called node:
doc.xpath('//Product').each do |node|
and pass it into a delayed job like this:
delay.create_new_book_record(client_id, user_id, node)
and although the variable 'node' I'm passing in looks something like this
just before I pass it into the delayed method:
//node.inspect #=>
<Product>
<RecordReference>9780857380272</RecordReference>
<NotificationType>02</NotificationType>
#...etc
it is passed in like this to delayed job which looks like an empty hash to
me:
INSERT INTO "delayed_jobs"
....
:create_new_book_record\nargs:\n- 1\n- 2\n-
!ruby/object:Nokogiri::XML::Element {}\n"]
And the error that gets thrown when I try to parse node in the delayed_job
task is
wrong argument type Nokogiri::XML::Element (expected Data)
So: how do I pass a Nokogiri::XML::Element into a delayed job task so that
it can be processed within the task?

Friday, 30 August 2013

Play2.11 Play can not find the model class but I can run pure JPA Juit test properly, Please come to help, thanks

Play2.11 Play can not find the model class but I can run pure JPA Juit
test properly, Please come to help, thanks

I am using Play2.11 Java and JPA2.0 Hibernate implementation and mysql
I can run the Junit test case properly to run CURD operation on the models
which put a persistence.xml under test/meat-inf, but when run play to CURD
from the web page, it shows can not find the models.* class. After some
time digging still do not have a clue. please help to check, thanks a lot
conf/meta-inf/persistence.xml:
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="DEVUnit" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<non-jta-data-source>dev</non-jta-data-source>
<class>models.Account</class>
<properties>
<property name="hibernate.dialect"
value="org.hibernate.dialect.MySQLDialect" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.format_sql" value="false" />
</properties>
</persistence-unit>
test/meta-inf/persistence.xml
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="DEVUnit" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>models.Account</class>
<properties>
<property name="hibernate.dialect"
value="org.hibernate.dialect.MySQLDialect" />
<property name="hibernate.connection.driver_class"
value="com.mysql.jdbc.Driver" />
<property name="hibernate.connection.username" value="***" />
<property name="hibernate.connection.password" value="***" />
<property name="hibernate.connection.url"
value="jdbc:mysql://****.net:3306/dev?characterEncoding=UTF-8" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.format_sql" value="false" />
</properties>
</persistence-unit>
Only one line different the <non-jta-data-source>dev</non-jta-data-source>
conf/application.conf
# This is the main configuration file for the application.
# ~~~~~
# Secret key
# ~~~~~
# The secret key is used to secure cryptographics functions.
# If you deploy your application to several instances be sure to use the
same key!
application.secret="Qk5y/1b1;]>p=yo6?/FnmQR4F@W2lGYWfJI>e4oBs2D0nahNl>Y40y1A:P[uc;RJ"
# The application languages
# ~~~~~
application.langs="en"
# Global object class
# ~~~~~
# Define the Global object class for this application.
# Default to Global in the root package.
#application.global=Global
#ehcacheplugin=disabled
# Router
# ~~~~~
# Define the Router object to use for this application.
# This router will be looked up first when the application is starting up,
# so make sure this is the entry point.
# Furthermore, it's assumed your route file is named properly.
# So for an application router like `conf/my.application.Router`,
# you may need to define a router file `my.application.routes`.
# Default to Routes in the root package (and `conf/routes`)
# application.router=my.application.Routes
# Database configuration
# ~~~~~
# You can declare as many datasources as you want.
# By convention, the default datasource is named `default`
#
db.default.driver=com.mysql.jdbc.Driver
db.default.url="jdbc:mysql://****.net/dev?characterEncoding=UTF-8"
db.default.user=***
db.default.password=****
db.default.jndiName=dev
#
# You can expose this datasource via JNDI if needed (Useful for JPA)
# db.default.jndiName=DefaultDS
# Evolutions
# ~~~~~
# You can disable evolutions if needed
evolutionplugin=disabled
# Logger
# ~~~~~
# You can also configure logback (http://logback.qos.ch/), by providing a
logger.xml file in the conf directory .
# Root logger:
logger.root=ERROR
# Logger used by the framework:
logger.play=INFO
# Logger provided to your application:
logger.application=DEBUG

Thursday, 29 August 2013

Multiple templates with same match

Multiple templates with same match

I'm currently stuck on applying multiple xsl:template with the same match
for an element. The example below shows the problem.
Does anyone knows a XSL template that creates the expected output using
two "template match"s? For technical reasons it's not possible to put the
two "template" elements together.
Input
<root>
<elem>123.45</elem>
<elem>789.12</elem>
</root>
XSLT
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:decimal-format name="de" decimal-separator=","
grouping-separator="."/>
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="/root/elem">
<xsl:element name="renamed">
<xsl:apply-templates select="@* | node()"/>
</xsl:element>
</xsl:template>
<xsl:template match="/root/elem">
<xsl:element name="elem">
<xsl:value-of select="format-number(.,'#.##0,0000','de')" />
</xsl:element>
</xsl:template>
</xsl:stylesheet>
Output:
<root>
<elem>123,4500</elem>
<elem>789,1200</elem>
</root>
Expected output:
<root>
<renamed>123,4500</renamed>
<renamed>789,1200</renamed>
</root>
Thanks

Proerties and dynamic values for display

Proerties and dynamic values for display

In the below code, is it possible to get the value (Value='ABC' or 'CDE' )
dynamically?.
<logic:equal name="screen1" property="prefix" value="ABC">
<td colspan="7">&nbsp;</td>
</logic:equal>
<logic:equal name="screen1" property="prefix" value="CDE">
<td class="fldlabel"><bean:message key="label.Group"/></td>
<td colspan="5">&nbsp;</td>
</logic:equal>
In example, I need to implement below logic
if prefix (ABC, LMN, EYX, FDG ) then display text box1 else prefix (GGG,
RRR, RRR, MMM ) then display text box 2 else display nothing.
Please help me to fix this.
if i have function to find like below would be better
if (ABC, LMN, EYX, FDG ) then category 1
if (GGG, RRR, RRR, MMM ) then category 2 .
then i can display the text box based on category.

Wednesday, 28 August 2013

Obtaining the quantity and proportion in SPSS 21

Obtaining the quantity and proportion in SPSS 21

pI have the data in a sav file/p precodeCODE | QUANTITY ------|----------
A | 1 B | 4 C | 1 F | 3 B | 3 D | 12 D | 5 /code/pre pI need to obtain the
quantity of codes which have a quantity lt;= 3 and to obtain the
proportion in a percentage with respect to the total number and present a
result like this/p precodelt;= 3 | PERCENTAGE ------|---------- 4 | 57 %
/code/pre pAll of this using SPSS syntax./p

Import project into Android-Studio

Import project into Android-Studio

I have been given an Android project created in Eclipse which I need to
port to Android-Studio.
I'm using the most up-to-date version of the Android-Studio (0.2.6 build
130.795381) which includes a bundled gradle distribution (version 1.7).
I followed the instructions written here and asked the guy that handed me
the project to provide me with the products of this procedure.
So he did and sent me a "build.gradle" file which suppose to make the
import possible.
I opened the Android-Studio and tried to import the project (using any of
the possible options) and it failed due to:
I tried to download gradle version 1.6 and choose it by selecting the
"local gradle distribution" option, but this time it fails due to:
How can I overcome this problem?

Apache POI - formatting output to HTML

Apache POI - formatting output to HTML

I am writing to an Excel file using Apache POI, but I want my output to be
formatted as HTML not as literal text.
SXSSFWorkbook workbook = new SXSSFWorkbook();
Sheet sheet0 = workbook.createSheet("sheet0");
Row row0 = sheet0.createRow(2);
Cell cell0 = row0.createCell(2);
cell0.setCellValue("<html><b>blah blah blah</b></html>");
What appears when I open the Excel file is:
"<html><b>blah blah blah</b></html>"
but I want:
"blah blah blah"
essentially I am looking for a piece of code along the lines of:
cell0.setCellFormat(CellFormat.HTML);
Except, that doesn't exist.

How To Add 'Back' Parameter on Slide Transition?

How To Add 'Back' Parameter on Slide Transition?

I'm using Intel's AppFramework and I have this code :
<div title="welcome" id="login" class="panel" selected="true">
<!-- some code here -->
<a href="#register" class="soc-btn gray-btn left"
data-transition="slide">Sign Up</a>
<!-- some code here -->
</div
<div title="register" id="register" class="panel">
<!-- some code here -->
<a href="#login" class="soc-btn gray-btn left"
data-transition="slide">Cancel</a>
<!-- some code here -->
</div>
the transition from #login to #register works like a charm, page loaded
from right-to-left. but how to apply 'slide-back' transition make 'cancel'
button on #register to load #login from left-to-right?
I saw on ui/transition/all.js documentation :
Initiate a sliding transition. This is a sample to show how transitions
are implemented.
These are registered in $ui.availableTransitions and take in three
parameters.
@param {Object} previous panel
@param {Object} current panel
@param {Boolean} go back
@title $ui.slideTransition(previousPanel,currentPanel,goBack);
but how to add 'goBack' parameter into my code? thank you
here's the complete code of the slide transition :
(function ($ui) {
/**
* Initiate a sliding transition. This is a sample to show how
transitions are implemented. These are registered in
$ui.availableTransitions and take in three parameters.
* @param {Object} previous panel
* @param {Object} current panel
* @param {Boolean} go back
* @title $ui.slideTransition(previousPanel,currentPanel,goBack);
*/
function slideTransition(oldDiv, currDiv, back) {
oldDiv.style.display = "block";
currDiv.style.display = "block";
var that = this;
if (back) {
that.css3animate(oldDiv, {
x: "0%",
y: "0%",
complete: function () {
that.css3animate(oldDiv, {
x: "100%",
time: $ui.transitionTime,
complete: function () {
that.finishTransition(oldDiv, currDiv);
}
}).link(currDiv, {
x: "0%",
time: $ui.transitionTime
});
}
}).link(currDiv, {
x: "-100%",
y: "0%"
});
} else {
that.css3animate(oldDiv, {
x: "0%",
y: "0%",
complete: function () {
that.css3animate(oldDiv, {
x: "-100%",
time: $ui.transitionTime,
complete: function () {
that.finishTransition(oldDiv, currDiv);
}
}).link(currDiv, {
x: "0%",
time: $ui.transitionTime
});
}
}).link(currDiv, {
x: "100%",
y: "0%"
});
}
}
$ui.availableTransitions.slide = slideTransition;
$ui.availableTransitions['default'] = slideTransition;
})(af.ui);

geoserver openlayer and googlemap offset

geoserver openlayer and googlemap offset

in my application I am using a googlemap as baselayer and geoserver as wms
server for adding several layers to the googlemap, at the first load there
is an offset between the layers and the googlemap, it disappears if I
switch-on and off some developing tool in a browser, like firebug on
firefox and development tools in chrome, I activated the sphericalmercator
on the baseLayer, but still there is the offset, my code is visible at
pastebin.com/rn9xQbke, I need someone more experienced to point me on the
right direction

ASP.NET MVC 4 - How to setup HTTPS secured webpage

ASP.NET MVC 4 - How to setup HTTPS secured webpage

I'am writing a web application (ASP.NET MVC4) which has a view to insert
some sensitive user information (not specifically username and password).
I want to secure this screen with the HTTPS protocol and want to store
this information in a secured cookie. First i want to set it up in my
ASP.NET development server of visual studio, afterwards i want to deploy
to azure websites.
I have decorated my controller action with "[RequireHttps]" keyword.
[RequireHttps]
public ActionResult BlobSettings()
{
ViewBag.Message = "Settings";
return View();
}
I have also enabled SSL in my project settings of visual studio. Now two
instances are created in IIS Express (HTTP and HTTPS). When i open HTTPS
url, my whole website is running with the HTTPS Protocol.Not really bad,
but i thought to work with HTTP and HTTPS pages (the other pages should
not be secured).
So my fist question is how can you setup project to work with HTTP and
HTTPS pages and how should you test it with ASP.net developer server?

Tuesday, 27 August 2013

MaxMind free GeoLiteCity.dat file size issue

MaxMind free GeoLiteCity.dat file size issue

Last year I downloaded maxmind free GeoLiteCity.dat from
http://www.maxmind.com website and it's file size around 30MB, but today I
was trying to download new bat file from maxmind
http://dev.maxmind.com/geoip/legacy/geolite/. But it has only 17MB file
size.
So any one know that 17MB file has more ip address than they offered 30MB
file?

Linking to a different site with href tag

Linking to a different site with href tag

I'm trying to use the a tag below to go to www.facebook.com/group:
<a href="www.facebook.com/group" target="_blank"></a>
Instead of that link I want, the link takes me to
http://www.goups.com/www.facebook.com/group . How can I solve this issue?

Extjs 4 : Custom form creation

Extjs 4 : Custom form creation

How to get following layout in extjs 4.1.3??

I want checkbox to attach next to textbox. Any Idea?

how to pass php controller file to view php file in jquery function codeigniter

how to pass php controller file to view php file in jquery function
codeigniter

HI Am new to Php: i had tried to upload a image file with random
generated nos .then i want to return the uploaded file name in view
php and set in jquery function.here is code uploaded file.
// controller file this file only when i click upload calling
// controller file
function uploadfileview(){
$targeturl = getcwd()."/uploads/";
if($_SERVER['REQUEST_METHOD'] == "POST"){
$checkexisting =
getcwd()."/uploads/".$_FILES['userfile']['name'][0];
$random_number = rand(0,1000000);
//checking the file is existing or not
if(file_exists($checkexisting)) {
if(move_uploaded_file($_FILES['userfile']['tmp_name'][0],
$targeturl.$random_number.'-'.$_FILES['userfile']['name'][0])){ echo
json_encode(array( 'files' =>
$random_number.'-'.$_FILES['userfile']['name'][0], 'post' => $_POST,
'fileurl' =>
getcwd()."/uploads/".$random_number.'-'.$_FILES['userfile']['name'][0] ));
$bb = $random_number.'-'.$_FILES['userfile']['name'][0]; } }else{
if(move_uploaded_file($_FILES['userfile']['tmp_name'][0],
$targeturl.$random_number.'-'.$_FILES['userfile']['name'][0])){ echo
json_encode(array( 'files' =>
$random_number.'-'.$_FILES['userfile']['name'][0], 'post' => $_POST,
'fileurl' =>
getcwd()."/uploads/".$random_number.'-'.$_FILES['userfile']['name'][0] ));
} $data['testing'] = $random_number.'-'.$_FILES['userfile']['name'][0];
return $this->$data('reimbursement'); } // exit; } }
here is the ajax upload form.function.
// for uploaded the file name
jQuery(function(){
var button = $('#uploader-button'), interval;
new AjaxUpload( button, {
action: baseUrl + "expensereimbursement/uploadfileview",
name: 'userfile[]',
multiple: true,
onSubmit : function(file , ext){
// Allow only images. You should add security check on the
server-side.
if (ext && /^(jpg|png|jpeg|pdf)$/.test(ext)){
} else {
// extension is not allowed
$('#bq-reimbursement-form .error-ajax').text('Error:
Invalid File
Format').css('color','red').show().fadeOut(5000);
// cancel upload
return false;
}
// change button text, when user selects file
button.text('Uploading');
// If you want to allow uploading only 1 file at time,
// you can disable upload button
this.disable();
// Uploding -> Uploading. -> Uploading...
interval = window.setInterval(function(){
var text = button.text();
if (text.length < 13){
button.text(text + '.');
} else {
button.text('Uploading');
}
}, 200);
},
onComplete: function(file, response){
button.text('Upload');
window.clearInterval(interval);
// enable upload button
this.enable();
var obj = $.parseJSON(response);
if(obj.error){
$('#bq-reimbursement-form .error-ajax').text('Error: File
Already Exist!').css('color','red').show().fadeOut(5000);
}else {
var url = "https://docs.google.com/viewer?url=" +
obj.fileurl;
var html = '<li><input type="text" name="imageName[]"
value="'+file +'" class="display-type" ><a
class="filenames" target="_blank" href="'+url+'">'+file
+'</a><span class="close-button
display-type">x</span></li>';
$('#upload-file-bq .files').append(html);
}
}
});
});
var html = '<li><input type="text" name="imageName[]" value="'+file
+'" class="display-type" ><a class="filenames" target="_blank"
href="'+url+'">'+file +'</a><span class="close-button
display-type">x</span></li>';
// file = my uploaded file name to be return from controller.
here file only i want to return the uploaded file name can any one
help me please.

MAC OSX: How to launch application on startup?

MAC OSX: How to launch application on startup?

I have an OSX project (objective-c) and I'd like to run it on startup. How
can I do this?
Any help is highly appreciated!

Monday, 26 August 2013

iphone-"Use of Undeclared Identifier 'textFieldShouldReturn' Objective C

iphone-"Use of Undeclared Identifier 'textFieldShouldReturn' Objective C

I've hit an "Use of Undeclared Identifier" Error. Seems there could be a
lot of reasons for this, and I couldn't see what the problem was with
mine. First, here's the code:
#import "CMViewController.h"
#import "CMAEncode.h"
@interface CMViewController ()
@property (weak, nonatomic) IBOutlet UITextView *toCode;
@property (weak, nonatomic) IBOutlet UITextView *Coded;
@property (weak, nonatomic) IBOutlet UISwitch *onOrOff;
- (IBAction)StartEncodeDecode:(id)sender;
@end
@implementation CMViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)StartEncodeDecode:(id)sender {
NSString *finishedText;
NSString *toCode = self.toCode.text;
if (self.onOrOff.on == TRUE) {
finishedText = [CMAEncode encodeText:toCode];
self.Coded.text = finishedText;
} else {
}
-(BOOL)textFieldShouldReturn:(UITextField *)textField // Undeclared
Identifier here.
{
[textField resignFirstResponder];
return YES;
}
}
@end
I'm trying to make a textfield resign first responder so the keyboard will
return. But I really just want to know why this error is occurring, it
might help people out with future instances of this error.

mobile broadband is not enabled in Ubuntu 13.04

mobile broadband is not enabled in Ubuntu 13.04

i have DLINK DWM-156 USB modem its working internet browsing, but its not
working Ubuntu one and software center please tell me how it is possible

Samsung S4 not sending emails when they have an attachment

Samsung S4 not sending emails when they have an attachment

I am using the std email app on the Samsung S4. I cannot send emails when
they have an attachment. The email just sits in the outbox. When I send
the same email without an attachment is gets sent. I have tried all file
formats for the attachment, including word, excel, jpeg in case it was
only affecting certain file types. I have also tried different file sizes,
and it does not matter, even very small attachments of a few bytes will
not work.

Perl use Return as EOL instead of Ctrl-D in Linux

Perl use Return as EOL instead of Ctrl-D in Linux

I'm a beginner to perl, and just started reading user input in my script.
chomp(my $inp = <> );
I have been used to using Return key as the terminator for user input in
other languages, and am unsure how to stop reading user input after
getting a single key press, or some characters followed by Return key. In
perl running on unix, capturing input via the diamond operator, seems to
require pressing Ctrl-D for end of input.
My problem is that I'd like to build an interactive menu where user is
presented a list and asked to press "A", "B" or "C". Once he presses any
of these keys, I'd like to loop according to conditions, without waiting
for him to press Ctrl D. How can I get this level of interactive user
input in perl? In C, I'd use getch. In Bash, I'd use a read and $REPLY.

WP + woocommerce search with specific attribute

WP + woocommerce search with specific attribute

I have a problem. When I am adding a product in php code I need to check
first if the product with the same code does not exists. I am using
attribute in woocommerce and set new attribute code. In DB it is like:
meta_key '_product_attributes' with value:
'a:1:{s:4:"code";a:6:{s:4:"name";s:4:"code";s:5:"value";s:3:"789";s:8:"position";s:1:"0";s:10:"is_visible";i:0;s:12:"is_variation";i:0;s:11:"is_taxonomy";i:0;}}'
How can I query posts only with specific code?

Update method in Rails

Update method in Rails

I need to update a table(MySQL DB) from the JSON received for a different
table controller. I have an "Lists" Controller(for List table in DB) and a
"Table" (for Tables table in DB)Controller. I get the JSON to insert a new
row in Lists table. Now from the JSON received, I need to pick the table
number and update the Tables table too. Below is the JSON recieved
Started POST "/lists.json" for 192.168.1.2 at 2013-08-26 16:55:51 +0530
Processing by ListsController#create as JSON
Parameters: {"list"=>[{"amount"=>"10.50", "orderno"=>"0220130826163623",
"quan
tity"=>"1", "itemname"=>"Patatas Ali Oli", "tableno"=>"02",
"ordstatus"=>"ordere
d"}, {"amount"=>"10.50", "orderno"=>"0220130826163623", "quantity"=>"1",
"itemna
me"=>"Garlic Bread", "tableno"=>"02", "ordstatus"=>"ordered"},
{"amount"=>"12.50
", "orderno"=>"0220130826163623", "quantity"=>"1", "itemname"=>"Entrecote
A La P
lancha", "tableno"=>"02", "ordstatus"=>"ordered"}, {"amount"=>"10.50",
"orderno"
=>"0220130826163623", "quantity"=>"1", "itemname"=>"Pollo Al Horno",
"tableno"=>
"02", "ordstatus"=>"ordered"}]}
From the above JSON i need to pick the "tableno"=>"02" and update my
Tables row for tableno=02. Below is the code I have written in Lists
Controller :
def create
lists = params[:list].collect{|list_attributes|
List.new(list_attributes)}
table = Table.find(:tablabel => List.tableno,:tabstatus => 'reserved');
valid,not_valid = lists.partition{|list| list.valid?}
if not_valid.blank?
lists.map(&:save)
@lists = lists
format.html { redirect_to @list, notice: 'List was successfully
created.' }
format.json { render json: @list, status: :created, location: @list }
else
format.html { render action: "new" }
format.json { render json: @list.errors, status:
:unprocessable_entity }
end
end
Problem is the Lists table is getting updated successfully but extracting
and updating Tables part is not working. I am just a beginner in Rails so
not sure what I am missing. Please advise. Thanks.

Perl-Qurey to valdidate the Web links of a website

Perl-Qurey to valdidate the Web links of a website

How to create a simple perl tool to valdidate the Web links of a website.
If you provide a video link it wolud be better to understand.

Sunday, 25 August 2013

Genarate ECPublicKey in java

Genarate ECPublicKey in java

hi all i am new to java ecc encryption.so i got ECC public key data array
from java card.the size is 49 byte length.so i need to genarate Eccpublic
key.so i have created public key.but it gives
java.security.spec.InvalidKeySpecException: encoded key spec not
recognised error.This is my code anyone can help me how to generate
Eccpublickey using data array.Thanks
byte[] pub = new byte[] {
/*(Public data) 49 length byte ARRAY
*/
};
System.out.println("Length :" + pub.length);
X509EncodedKeySpec ks = new X509EncodedKeySpec(pub);
KeyFactory kf;
try {
kf = KeyFactory.getInstance("ECDH");
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
return;
}
ECPublicKey remotePublicKey;
try {
remotePublicKey = (ECPublicKey) kf.generatePublic(ks);
} catch (InvalidKeySpecException e) {
e.printStackTrace();
return;
} catch (ClassCastException e) {
e.printStackTrace();
return;
}
System.out.println(remotePublicKey);
} catch (Exception e) {
e.printStackTrace();
}

[ Video & Online Games ] Open Question : About Battlelfield multiplayer series!!?

[ Video & Online Games ] Open Question : About Battlelfield multiplayer
series!!?

I've never played Battlelfield online but I know u have 4 loadouts:
Assault, Support, Engineer and Recon...is it possible that your whole team
use Assault loadouts? Is it possible to play with your other customized
player (Support, Engineer...) as bots or is it possible for your friend to
play as one of your customized players? please tell me more on this
subject if you can Thanks

[ Entertaining ] Open Question : What if you get drunk at a high school party? What happens?

[ Entertaining ] Open Question : What if you get drunk at a high school
party? What happens?

How are you supposed to get home, and expect nothing from your
parents!?!?!? How do you guys get away with drinking?

What are some resources to learn writing Microcopy

What are some resources to learn writing Microcopy

I am researching the practice of communicating with a user what should he
ought to do next while using your webapp.
This is a great example
http://www.uxmatters.com/mt/archives/2010/08/avoid-being-embarrassed-by-your-error-messages.php
This is another one I really enjoyed
http://baymard.com/blog/contextual-words-are-usability-poison
I'm looking for examples on both the Microcopy aspect and the visual
aspect (Using Popups vs tooltips for example),
I'm looking for best practices in that regard.
Sorry for being unclear at first.

Saturday, 24 August 2013

opencart .htaccess redirect subfolder to subdomain language not working

opencart .htaccess redirect subfolder to subdomain language not working

hi i install opencart in subfolder web8.us/shop/ and redirected
permanently to shop.web8.us in .htaccess like
RewriteEngine On Options +FollowSymLinks RewriteBase /
RewriteCond %{http_host} ^web8.us [nc] RewriteRule ^(.*)$
http://www.web8.us/$1 [L,R=301]
this is the magic line below here
RedirectMatch 301 ^/shop/(.*)$ http://shop.web8.us/$1
all work good whit out languages if you like to change language from
english to spanish its stackon english any ideas?
thank you in advance GEORGI

Changing aspect ratio of Virtualbox VM under OSX

Changing aspect ratio of Virtualbox VM under OSX

I have a Windows guest on an OSX host, running at 1024x768. I want to use
scale-mode to make the window small enough to have on the side of my
screen, but the problem is that since I maximised the VM in scale mode
earlier, the aspect ratio is now nearer my 16:10. I've tried resizing in
only one dimension, disabling and re-enabling scale mode and also
reinstalling guest additions. A search of the Virtualbox docs does tell me
that maintaining aspect ratio is doable under OSX, but it doesn't say how.
I'd really like to be able to fix this without reinstalling my VM if
possible.
I'm running Virtualbox 4.2.16 r86992 under OSX 10.8.4 with a Window 7 guest.

\href[page=10,pdfremotestartview=FitV] seems not to work

\href[page=10,pdfremotestartview=FitV] seems not to work

I'm trying to get a pdf file I'm composing (using LaTeX et. al.) to have a
functional hypertext link that will open a remote pdf file on the web
(ideally in the same PDF viewer I'm using to read the one I'm composing
although I don't think that's possible is it?) and then navigate to a
certain page while fitting the height of that page to the viewing window.
Here's my MWE:
\documentclass[12pt]{article}
\usepackage{geometry}
\geometry{letterpaper}
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage[colorlinks=true,urlcolor=cyan]{hyperref}
\title{Brief Article}
\author{The Author}
\begin{document}
\maketitle
I want this \href[page=10,pdfremotestartview=FitV]{http://www.ctex.org/
documents/packages/layout/geometry.pdf}{link
} to take me to page 10 of the
linked PDF file while fitting the height of the page to the window. And while
it does switch to my web browser which then downloads the PDF file and opens
that file (using the browser plugin) in a browser window, the browser/plugin
does not navigate to page 10 or fit the vertical height of the page to the
window.
\end{document}
As I write in the MWE, it works part of the way, but not all the way.
Am I doing something wrong here?
I found this, but I think it's much more complex a problem than the one I
face, and although it was helpful to me, it didn't completely solve the
problem I'm having now.
Any suggestions?

Is turning input and label into block level items okey?

Is turning input and label into block level items okey?

I know that you can't (semantically) do something like:
<p>
<div> Lorem... </div>
</p>
I am working on the comment_form() for WordPress:
<form...>
<div<
<label>Label<label><input...>
</div>
...
</form>
I am using Foundation's mixin's (sass) to set a grid to label and input.
This mixin will make the label and input a block (those are normally a
inline). Is this, okey? Should I put the label and input in 2 different
div's again and set the grid mixins on those instead?
What I also found in the default comment_form() function is:
<p class="form-submit">
<input name="submit" type="submit" id="<?php echo esc_attr(
$args['id_submit'] ); ?>" value="<?php echo esc_attr(
$args['label_submit'] ); ?>" />
<?php comment_id_fields( $post_id ); ?>
</p>
Because I can't change that p to a div I probably have to recreate the
hole function. I think I need to do this because Foundation will set the
display to block for the input submit. Should I leave it as is or if I
want semantic markup, should I recreate the function?

How to filter search results based on multiple data attributes

How to filter search results based on multiple data attributes

I'm trying to search multiple data results based on inline data
attributes. However, I can only figure out how to search a single data
attribute instead of them all. How would I accomplish this?
What I have: http://jsfiddle.net/9SMZC/2/
$("input[type=text]").keyup(function () {
var filter = $(this).val();
$("a").each(function () {
if ($(this).attr("data-event-name").search(new RegExp(filter,
"i")) < 0) {
$(this).hide();
} else {
$(this).show();
matches++;
}
});
});
Thanks in Advance!

Google Apps Script conditional loop

Google Apps Script conditional loop

I am trying to loop over one column in my sheet and set the value an
adjacent cell dependent upon the value and color of the active cell. this
is what I've tried but I cannot seem to get working...
function setValue(){
var sheet = SpreadsheetApp.getActiveSpreadsheet();
var end = SpreadsheetApp.getActiveSheet().getLastRow();
for( var i = 1; i < end + 1; ++i){
var value = sheet.getRange(i, 4).getValue();
var color = sheet.getRange(i, 4).getColor();
if (value == "Authenticated" && color == "#ffffff") {
sheet.getRange(i, 5).setValue("True");
}
else {
sheet.getRange(i, 5).setValue("False");
}
}
}
Please help. I'm new to Apps Script. Thanks!

how to return an class without array in codeignaitor

how to return an class without array in codeignaitor

i have function that return me Class in Array like this :-
function getInfo($ev_id){
$query = $this->db->query("SELECT * FROM events,users
where events.ev_user_id = users.id
and ev_id = $ev_id");
$result = $query->result();
return $result[0];
}
this function is return me data Array, so i need use result to put it in
input type to show it for user.
i need to use :-
$eventinfo->ev_text
not use an fetch array to display it like $eventinfo->ev_text

iphone Facebook Sdk login issue

iphone Facebook Sdk login issue

pam trying Facebook SDK into my application, it works in my simulator
perfectly, when i install into my iphone and try running it , it shows me
a alert , which tells myapp needs to access your profile,friendlist etc
allow or dont allow option, i allow it , but nothing happens stays in same
page../p pi have installed facebook application in my iphone , tried by
logged in logged out evrything but no use..../p pBut, wen i go to settings
and delete the facebook details , it works perfectly ...br ![settings
page] a href=http://postimg.org/image/pkkzmj0ob/
rel=nofollowhttp://postimg.org/image/pkkzmj0ob//a/p
ppls advice...... /p
pThanks in advance..../p

Friday, 23 August 2013

Play! 2 WS library : Detect and handle closed connection in streaming http response

Play! 2 WS library : Detect and handle closed connection in streaming http
response

In the play WS library, I am using this call to process a streaming http
response:
def get[A](consumer: ResponseHeaders => Iteratee[Array[Byte], A]):
Future[Iteratee[Array[Byte], A]]
I am passing it something like: _ => (Iteratee.foreach(chunk =>
println(chunk)))
Everything works fine, but at some point the connection seems to close and
I don't know how to handle this. I tried adding .mapDone to print out some
stuff when the Iteratee is done, but it never happens.
On this get request, how can I detect that the connection has been closed
and handle that event?

Efficient collision detection between balls (ellipses)

Efficient collision detection between balls (ellipses)

I'm running a simple sketch in an HTML5 canvas using Processing.js that
creates "ball" objects which are just ellipses that have position, speed,
and acceleration vectors as well as a diameter. In the draw function, I
call on a function called applyPhysics() which loops over each ball in a
hashmap and checks them against each other to see if their positions make
them crash. If they do, their speed vectors are reversed.
Long story short, the number of calculations as it is now is (number of
balls)^2 which ends up being a lot when I get to into the hundreds of
balls. Using this sort of check slows down the sketch too much so I'm
looking for ways to do smart collisions some other way.
Any suggestions? Using PGraphics somehow maybe?

How to read KendoUI Cascading DropDownList from Controller

How to read KendoUI Cascading DropDownList from Controller

vs'12 , KendoUI, asp.net C# MVC4 Internet Application EF Code First
All of my Json Gets ( for the DDL's look like so )
public JsonResult GetCascadeCountys(int clients)
{
var Countys = db.Countys.AsQueryable();
if (0 != clients)
{
Countys = Countys.Where(p => p.ClientID == clients);
}
return Json(Countys.Select(p => new { CountyID = p.CountyID,
CountyName = p.County }), JsonRequestBehavior.AllowGet);
}
All my DDL in my view look like so
<label for="countys">County:</label>
@(Html.Kendo().DropDownList()
.Name("DDLcountys")
.HtmlAttributes(new { style = "width:300px", id = "countys"})
.OptionLabel("Select County...")
.DataTextField("CountyName")
.DataValueField("CountyID")
.DataSource(source => {
source.Read(read =>
{
read.Action("GetCascadeCountys", "ImageUpload")
.Data("filterCountys");
})
.ServerFiltering(true);
})
.Enable(false)
.AutoBind(false)
.CascadeFrom("clients")
)
<script>
function filterCountys() {
return {
clients: $("#clients").val()
};
}
</script>
The script givin on the Tutorial Page of the KendoUI DropDownList
Documentation were these Altered for my DDL's
<script>
$(document).ready(function () {
var clients = $("#client").data("kendoDropDownList"),
countys = $("#county").data("kendoDropDownList"),
$("#get").click(function () {
var clientsInfo = "\nclients: { id: " + clients.value() + ",
name: " + clients.text() + " }",
countysInfo = "\ncountys: { id: " + countys.value() + ",
name: " + countys.text() + " }",
alert("Select Tract To Upload:\n" + clientsInfo +
countysInfo);
});
});
</script>
My Controller that i'm trying to read the User selected Data From
[HttpPost]
public ActionResult Index(IEnumerable<HttpPostedFileBase> attachments,
string messageId, FormCollection values, )
{
if (ModelState.IsValid)
{
To read the Values I have tried the following
string something = values["DDLcountys"];
string something1 = values["countys"];
have tried reading from [DataSourceRequest] DataSourceRequest request



Please note that on my other view i have another KendoUI DDL - wich works
perfectly by grabbing the ID value. The difference between the 2 DDLs are
this
@(Html.Kendo().DropDownList()
.OptionLabel("Select Role...")
.Name("DDLRoles")
.DataTextField("RoleName")
.DataValueField("RoleID")
.BindTo(ViewBag.DDLRoles)
.AutoBind(true))
I'm using ViewBag to Bind to it instead of Method Linq Chains
I'm simply setting the name attribute instead of both
1. .Name("DDLtracts")
2. .HtmlAttributes(new { style = "width:300px", id = "tracts"})
My Question is how to read a KendoUI "Cascading" DDL Correctly from my
[HTTPPOST] Controller

Split a vector into three vectors of unequal length in R

Split a vector into three vectors of unequal length in R

a questions from a relative n00b: I'd like to split a vector into three
vectors of different lengths, with the values assigned to each vector at
random. For example, I'd like to split the vector of length 12 below into
vectors of length 2,3, and 7
I can get three equal sized vectors using this:
test<-1:12 split(test,sample(1:3))
Any suggestions on how to split test into vectors of 2,3, and 7 instead of
three vectors of length 4?

ruby - rspec test not passing

ruby - rspec test not passing

I'm working through the learn ruby tutorials and I'm trying pass the last
example where it tests the printable method. I tested the method by
calling the method directly within my ruby program and it spits out
exactly whats needed. What is preventing my code from properly passing?
Any help is greatly appreciated.
Here's the rspec file:
require 'dictionary'
describe Dictionary do
before do
@d = Dictionary.new
end
it 'is empty when created' do
@d.entries.should == {}
end
it 'can add whole entries with keyword and definition' do
@d.add('fish' => 'aquatic animal')
@d.entries.should == {'fish' => 'aquatic animal'}
@d.keywords.should == ['fish']
end
it 'add keywords (without definition)' do
@d.add('fish')
@d.entries.should == {'fish' => nil}
@d.keywords.should == ['fish']
end
it 'can check whether a given keyword exists' do
@d.include?('fish').should be_false
end
it "doesn't cheat when checking whether a given keyword exists" do
@d.include?('fish').should be_false # if the method is empty, this
test passes with nil returned
@d.add('fish')
@d.include?('fish').should be_true # confirms that it actually checks
@d.include?('bird').should be_false # confirms not always returning
true after add
end
it "doesn't include a prefix that wasn't added as a word in and of
itself" do
@d.add('fish')
@d.include?('fi').should be_false
end
it "doesn't find a word in empty dictionary" do
@d.find('fi').should be_empty # {}
end
it 'finds nothing if the prefix matches nothing' do
@d.add('fiend')
@d.add('great')
@d.find('nothing').should be_empty
end
it "finds an entry" do
@d.add('fish' => 'aquatic animal')
@d.find('fish').should == {'fish' => 'aquatic animal'}
end
it 'finds multiple matches from a prefix and returns the entire entry
(keyword + definition)' do
@d.add('fish' => 'aquatic animal')
@d.add('fiend' => 'wicked person')
@d.add('great' => 'remarkable')
@d.find('fi').should == {'fish' => 'aquatic animal', 'fiend' =>
'wicked person'}
end
it 'lists keywords alphabetically' do
@d.add('zebra' => 'African land animal with stripes')
@d.add('fish' => 'aquatic animal')
@d.add('apple' => 'fruit')
@d.keywords.should == %w(apple fish zebra)
end
it 'can produce printable output like so: [keyword] "definition"' do
@d.add('zebra' => 'African land animal with stripes')
@d.add('fish' => 'aquatic animal')
@d.add('apple' => 'fruit')
@d.printable.should == %Q{[apple] "fruit"\n[fish] "aquatic
animal"\n[zebra] "African land animal with stripes"}
end
end
and here's what I've created so far for the printable function:
class Dictionary def initialize(opts = {}) @opts = opts end
def entries
@opts
end
def add(opts)
opts.is_a?(String) ? @opts.merge!(opts => nil) : @opts.merge!(opts)
end
def keywords
@opts.keys.sort
end
def include?(key)
@opts.has_key?(key)
end
def find(key)
@opts.select { |word,defin| word.scan(key).join == key }
end
def printable
opts_sorted = @opts.sort_by { |word,defin| word}
opts_sorted.each do |word,defin|
print "[#{word}] \"#{defin}\"\n"
end
end
end
and here's the error:
1) Dictionary can produce printable output like so: [keyword] "definition"
Failure/Error: @d.printable.should == %Q{[apple] "fruit"\n[fish]
"aquatic animal
"\n[zebra] "African land animal with stripes"}
expected: "[apple] \"fruit\"\n[fish] \"aquatic animal\"\n[zebra]
\"African lan
d animal with stripes\""
got: [["apple", "fruit"], ["fish", "aquatic animal"],
["zebra", "African
land animal with stripes"]] (using ==)
Diff:
@@ -1,4 +1,4 @@
-[apple] "fruit"
-[fish] "aquatic animal"
-[zebra] "African land animal with stripes"
+["apple", "fruit"]
+["fish", "aquatic animal"]
+["zebra", "African land animal with stripes"]
# ./11_dictionary/dictionary_spec.rb:81:in `block (2 levels) in <top
(required)>
'

Thursday, 22 August 2013

How to add a hyperlink dynamically using javascript?

How to add a hyperlink dynamically using javascript?

I am using jQuery's getJson to get a Json object and want to display it on
html page.
I can display them successfully with code like this:
$.getJSON(full_name, {}, function(data) {
$.each(data, function(index, field){
$("div").append(index + " : " + field + "<br>");
});
});
And in json data, there is an item with index called 'reference'. I want
to change its field from a simple text to a hyperlink. And when I click
this link, it will send a GET method request to an url, and display
something get from the server on a new page.
How to change my page to achieve this function?
Thanks, guys!

Retrieve escaped XML and unescape using XSLT 1.0

Retrieve escaped XML and unescape using XSLT 1.0

I am calling a web service that embeds the response XML as escaped XML.
I'm receiving the complete SOAP response, but am only interested in the
'escaped XML' portion ().
I'm trying to write a XSL (1.0) to retrieve that escaped XML and UNESCAPE
it, so I can process it via other non-XSLT components.
I have tried some of the other solutions for 'unescaping' in
StackOverflow, but with no luck.
Response from Web Service
<?xml version="1.0" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<SendMessageResponse xmlns="http://www.company.com/CAIS">
<SendMessageResult>&lt;?xml
version="1.0"?&gt;&lt;IEXInboundServiceResponse&gt;&lt;IEXInboundServiceResponseVersion&gt;1.0&lt;/IEXInboundServiceResponseVersion&gt;&lt;ServiceResponse&gt;IEX_SUCCESS&lt;/ServiceResponse&gt;&lt;RequestMessageId&gt;22658651-024E-445B-96C1-94F027205E01&lt;/RequestMessageId&gt;&lt;/IEXInboundServiceResponse&gt;</SendMessageResult>
</SendMessageResponse>
</s:Body>
</s:Envelope>
Desired output after unescaping
<?xml version="1.0"?>
<IEXInboundServiceResponse>
<IEXInboundServiceResponseVersion>1.0</IEXInboundServiceResponseVersion>
<ServiceResponse>IEX_SUCCESS</ServiceResponse>
<RequestMessageId>22658651-024E-445B-96C1-94F027205E01</RequestMessageId>
</IEXInboundServiceResponse>
Help!
Thanks
David

Java/Wicket: Compile Basic Hello World with Resources

Java/Wicket: Compile Basic Hello World with Resources

I am following this example of a Hello World Wicket application
https://www.ibm.com/developerworks/web/library/wa-aj-wicket/
In particular I placed HelloWorld.html in my source directory next to
HelloWorld.java.
My file structure looks like this:
$ tree
..
„¥„Ÿ„Ÿ pom.xml
„¥„Ÿ„Ÿ src
„  „¥„Ÿ„Ÿ main
„  „  „¥„Ÿ„Ÿ java
„  „  „  „¤„Ÿ„Ÿ com
„  „  „  „¤„Ÿ„Ÿ example
„  „  „  „¤„Ÿ„Ÿ wicket
„  „  „  „¥„Ÿ„Ÿ HelloWorld.html
„  „  „  „¥„Ÿ„Ÿ HelloWorld.java
„  „  „  „¤„Ÿ„Ÿ HelloWorldApplication.java
„  „  „¥„Ÿ„Ÿ resources
„  „  „¤„Ÿ„Ÿ webapp
„  „  „¤„Ÿ„Ÿ WEB-INF
„  „  „¤„Ÿ„Ÿ web.xml
„  „¤„Ÿ„Ÿ test
„  „¤„Ÿ„Ÿ java
„¤„Ÿ„Ÿ wicketTest.iml
However when I compile this to a war file, and load in Jetty, i recieve
this error, in the browser:
Unexpected RuntimeException
Last cause: Can not determine Markup. Component is not yet connected to a
parent. [Page class = com.example.wicket.HelloWorld, id = 4, render count
= 1]
Stacktrace
Root cause:
org.apache.wicket.markup.MarkupNotFoundException: Can not determine
Markup. Component is not yet connected to a parent. [Page class =
com.example.wicket.HelloWorld, id = 4, render count = 1]
at org.apache.wicket.Component.getMarkup(Component.java:737)
at org.apache.wicket.Component.internalRender(Component.java:2344)
at org.apache.wicket.Component.render(Component.java:2307)
at org.apache.wicket.Page.renderPage(Page.java:1010)
When I look in the war file I notice that the html file is missing:
$ tar tvf target/wicketTest-1.0-SNAPSHOT.war
drwxrwxrwx 0 0 0 0 Aug 22 14:50 META-INF/
-rwxrwxrwx 0 0 0 128 Aug 22 14:50 META-INF/MANIFEST.MF
drwxrwxrwx 0 0 0 0 Aug 22 14:50 WEB-INF/
drwxrwxrwx 0 0 0 0 Aug 22 14:50 WEB-INF/classes/
drwxrwxrwx 0 0 0 0 Aug 22 14:50 WEB-INF/classes/com/
drwxrwxrwx 0 0 0 0 Aug 22 14:50 WEB-INF/classes/com/example/
drwxrwxrwx 0 0 0 0 Aug 22 14:50
WEB-INF/classes/com/example/wicket/
drwxrwxrwx 0 0 0 0 Aug 22 14:50 WEB-INF/lib/
-rwxrwxrwx 0 0 0 608 Aug 22 14:50
WEB-INF/classes/com/example/wicket/HelloWorld.class
-rwxrwxrwx 0 0 0 551 Aug 22 14:50
WEB-INF/classes/com/example/wicket/HelloWorldApplication.class
-rwxrwxrwx 0 0 0 25962 Aug 21 16:07
WEB-INF/lib/slf4j-api-1.6.4.jar
-rwxrwxrwx 0 0 0 2126440 Aug 21 16:07
WEB-INF/lib/wicket-core-6.10.0.jar
-rwxrwxrwx 0 0 0 86671 Aug 21 16:07
WEB-INF/lib/wicket-request-6.10.0.jar
-rwxrwxrwx 0 0 0 415858 Aug 21 16:07
WEB-INF/lib/wicket-util-6.10.0.jar
-rwxrwxrwx 0 0 0 690 Aug 22 13:22 WEB-INF/web.xml
drwxrwxrwx 0 0 0 0 Aug 22 14:50 META-INF/maven/
drwxrwxrwx 0 0 0 0 Aug 22 14:50 META-INF/maven/wicketTest/
drwxrwxrwx 0 0 0 0 Aug 22 14:50
META-INF/maven/wicketTest/wicketTest/
-rwxrwxrwx 0 0 0 675 Aug 22 08:52
META-INF/maven/wicketTest/wicketTest/pom.xml
-rwxrwxrwx 0 0 0 112 Aug 22 14:50
META-INF/maven/wicketTest/wicketTest/pom.properties
How do I specify in my POM file to include the html file?
My POM right now is minimal:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>wicketTest</groupId>
<artifactId>wicketTest</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket-core</artifactId>
<version>6.10.0</version>
</dependency>
</dependencies>
</project>

which machineKey config is better?

which machineKey config is better?

i 'm working on my web application security and want to know if i use this:
<machineKey validationKey="AutoGenerate,IsolateApps"
compatibilityMode="Framework45" decryptionKey="AutoGenerate,IsolateApps"
validation="SHA1"/>
in my web.config , now first user send first request to my site and in
this time validationKey will be create and after that second user send
second request now validationkey will be create again or what ?
and are the same these validations keys for all user ?
what is deference between that config and this?
<machineKey compatibilityMode="Framework45"
validationKey="37BAD4B702C65CF39B1ED514AC4B3D88990DDF784AA0895659
B528ED95F8CA0A9CD1AF5ED92A2599362684CB8D204AC30D07E6BF0CF65194A5129"
decryptionKey="B450FB3271C49E6BA89A0C5C8D06B61875BCE4916A40474ED"
validation="SHA1" decryption="AES" />
which one is better to use?

Where do I find my boot menu?

Where do I find my boot menu?

I want to know where the boot menu is on my ASUS laptop. Can anyone tell
me where to find it or where to find my BIOS settings? I am having trouble
booting my computer to ubuntu with a USB.

Eclipse not Starting up. JDK not installing

Eclipse not Starting up. JDK not installing

Okay, so this is a bit of a long and compound question. I intended to
start developing on a different computer while I was away, so obviously
had to go through the process of grabbing everything. I downloaded the 64
bit Android SDK and used the installer to grab everything other than the
disk images for android 4.0.3 (I have a physical 4.0.3 device to test on
with me). So, then I try to start Eclipse.
Failed to load the JNI shared library "C:\Program
Files(x86)\Java\jre7\bin\client\jvm.dll"
So obviously I checked the path and there is jvm.dll in the folder. I went
looking around the internet and the conclusion was to make sure I had 64
bit java, something I knew I already had, anyway in the hope it might fix
the problem I downloaded
jdk-7u25-windows-x64.exe
however when I try to run it I get the following error, which I cannot
find a solution for
This version of the file is not compatible with the version of Windows
you're running. Check your computer's system information to see weather
you need an x86 (32-bit) or x64 (64-bit) version of the program, and then
contact the software publisher.
I am running 64 bit Windows 7 Home Premium (SP1) on an AMD Turion II P540
Dual-Core Processor.
Any suggestions?

Wednesday, 21 August 2013

How to receive 2 notifications via NSNotificationCenter

How to receive 2 notifications via NSNotificationCenter

I have three methods:
- (void)viewDidAppear:(BOOL)animated
{
[self updateViews];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(receiveNotification:) name:@"itemQuantityChanged"
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(receiveNotification:) name:[NSString
stringWithFormat:@"Item %@ deleted", itemUUID] object:nil];
}
- (void)viewDidDisappear:(BOOL)animated
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
- (void) receiveNotification: (NSNotification *)notification
{
if ([[notification name] isEqualToString:@"itemQuantityChanged"])
[self updateViews];
if ([[notification name] isEqualToString:[NSString
stringWithFormat:@"Item %@ deleted", itemUUID]])
NSLog(@"FAIL!");
}
The main idea is that for this class I need to receive 2 different
notifications and in case of receiving them need to perform different
actions. Is everything ok with the realization? I believe that it is
possible to simplify this code. How to removeObserver correctly? I don't
use ARC.

Parallel Image Proccessing with C# 5.0

Parallel Image Proccessing with C# 5.0

. .
I'm trying to do some image proccessing with C# using that same old GDI
techniques, iterating throught every pixel with a nested for-loop, then
using the GetPixel and SetPixel methods on that (Bitmap) image.
I have already got the same results with the pointers approach (using
unsafe context) but I'm trying now to do the old-school Get/Set-Pixel
Methods to play with my Bitmaps . . .
Bitmap ToGrayscale(Bitmap source)
{
for (int y = 0; y < source.Height;y++ )
{
for (int x = 0; x < source.Width; x++)
{
Color current = source.GetPixel(x, y);
int avg = (current.R + current.B + current.G) / 3;
Color output = Color.FromArgb(avg, avg, avg);
source.SetPixel(x, y, output);
}
}
return source;
}
considering performance with the code above . . . it takes just tooooo
musch to finish while stressing the user out waiting for his 1800x1600
image to finish processing.
So i thought that i could use the technique that we use working with HLSL,
running a seperate function for each pixel (Pixel Shader engine (as i was
tought) copies the function returning the float4 (Color) thousands of
times on GPU to do the processing parallel).
So I tried to run a seperate Task (function) for each pixel, putting these
Task variables into a List and the 'await' for List.ToArray(). But I
failed doing that as every new Task 'awaits' to be finished before the
next one runs.
I wanted to call a new Task for each pixel to run this :
Color current = source.GetPixel(x, y);
int avg = (current.R + current.B + current.G) / 3;
Color output = Color.FromArgb(avg, avg, avg);
source.SetPixel(x, y, output);
At the end of the day I got my self an async non-blocking code but not
parallel . . . Any suggesions guys?
Thanks in advance, Zaid A.

Find ant build out file from another buld file

Find ant build out file from another buld file

I build several projects by using this code:
<ant antfile="${std.path}/src/@{project}/build.xml"
target="${build.type}"
inheritAll="false"/>
before it, I create their build.xml files by using this code:
<exec dir="${sdk.dir}/tools" executable="android.bat">
<arg line="update"/>
<arg line="project"/>
<arg line="--path"/>
<arg line="${std.path}/src/@{project}"/>
</exec>
Now i need to find and copy .apk files. But i found some problem there,
for project App1 (example) apk file named Activity1-release.apk, but for
App2 project it's named App2-release.apk . How i can find this apk files?

Remove edge around transparent image in Adobel Illustrator

Remove edge around transparent image in Adobel Illustrator

I googled a lot but somehow I am not able to remove transparent edge
around the image. Please help me asap

If you view the above image there is a transparent background which I am
not able to remove before saving the image

Chrome randomly opening new blank tabs

Chrome randomly opening new blank tabs

Starting a few weeks ago, Chrome has started randomly opening new blank
tabs. It happens mostly when I open an application from the dash, but not
every time. I've tried removing Chrome and re-installing and clearing all
my cookies from Chrome. I haven't figured out any other patterns to this,
but it's pretty annoying. Has anyone else seen this and might know a fix?

Vertically and horizontally centering a matrix bigger than margins

Vertically and horizontally centering a matrix bigger than margins

This question is a follow-up on a previous question: positioning of a
matrix bigger than margins
That question dealt with positioning a pgf matrix that exceeded the
horizontal margins of the page (although I imagine this works for floats
as well?), and both answers provide a solution to the problem.
However, none of those solutions work if the matrix is bigger than the
margins both horizontally and vertically.
How can I make sure that a matrix that is (slightly) too big for the
margins is centered on the page, both vertically and horizontally?
It seems to me that, out of the answers provided in the previous question,
the one based on stackengine might be more up to the task (that's why I
chose to use that one below), but this may well not be the case, and of
course I'm open to all sorts of suggestions.
This is a sample document using the stackengine solution:
\documentclass{article}
\usepackage{tikz}
\usepackage{pgf}
\usetikzlibrary{matrix}
\usepackage{stackengine}
\newcommand\zerowidth[2][c]{\stackengine{0pt}{}{#2}{O}{#1}{F}{T}{L}}
\begin{document}
\newsavebox\toowide
\setbox0=\hbox{%
\begin{tikzpicture}
\matrix [
matrix of nodes,
nodes={
text depth=4em,
text height=5em,
minimum width=10em,
draw
},
row sep=-\pgflinewidth,
column sep=-\pgflinewidth,
]
{
A & B & C & D \\
A & B & C & D \\
A & B & C & D \\
A & B & C & D \\
A & B & C & D \\
A & B & C & D \\
A & B & C & D \\
A & B & C & D \\
};
\end{tikzpicture}
\unskip}
\sbox\toowide{\box0}
\centering\zerowidth{\usebox{\toowide}}
\noindent\rule{\textwidth}{1ex}
\end{document}

Why this "" is shown strange in DOM?

Why this "" is shown strange in DOM?

When you put <p><div></br></div></p> into body, you will get the strange
DOM structure like:
<p></p>
<div></br></div>
<p></p>
Why does this happened? It seems that when <p> contains a block element
this will happen.

Tuesday, 20 August 2013

Android NullPointerException only in Galaxy SII/III phones

Android NullPointerException only in Galaxy SII/III phones

In my app, users select from a ListView and it plays a song based on the
position. Galaxy SII\SIII phones are throwing NullPointerExceptions when
the user tries to select a song. I set the activity to keep the portrait
orientation, and have one main layout(activity_main.xml).
Crash Report:
java.lang.NullPointerException
at com.soundboard.MainActivity.playSong(MainActivity.java:466)
at com.soundboard.MainActivity$10.onItemClick(MainActivity.java:286)
at android.widget.AdapterView.performItemClick(AdapterView.java:301)
at android.widget.AbsListView.performItemClick(AbsListView.java:1519)
at android.widget.AbsListView$PerformClick.run(AbsListView.java:3278)
at android.widget.AbsListView$1.run(AbsListView.java:4327)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5293)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
at dalvik.system.NativeStart.main(Native Method)
Code:
public void playSong(int songIndex){
Log.d(TAG, "Starting playSong(" + songIndex + ")");
FlurryAgent.logEvent("Starting playSong("+songIndex+")");
try {
if(mp != null){
mp.release();
}
try{
mp = MediaPlayer.create(MainActivity.this,
songManager.getSong(songIndex).getResId());
} catch(Exception e){
FlurryAgent.logEvent("playSong():mediaPlayer.create");
}
try{
mp.prepare();
} catch(Exception e){
Log.e(TAG, "Caught error preparing: "+e.getMessage());
FlurryAgent.logEvent("playSong():mediaPlayer.prepare");
e.printStackTrace();
}
mp.start();
FlurryAgent.logEvent("mp.start()");
// Displaying Song title
String songTitle = songManager.getSong(songIndex).getName();
songTitleLabel.setText(songTitle);
// Changing Button Image to pause image
btnPlay.setImageResource(R.drawable.btn_pause);
// set Progress bar values
songProgressBar.setProgress(0);
songProgressBar.setMax(100);
// Updating progress bar
updateProgressBar();
} catch (IllegalArgumentException e) {
Log.e(TAG, "Caught IllegalArgumentException: "+e.getMessage());
} catch (IllegalStateException e) {
Log.e(TAG, "Caught IllegalStateException: "+e.getMessage());
}
}

How do you hide a div by clicking anywhere outside that div?

How do you hide a div by clicking anywhere outside that div?

I'm displaying an iframe overlay with a z-index of 9999 with 100% width
and height. The actual div inside the iframe is is only 620px wide. The
problem is, I can not hide the iframe by simply click outside that div.
Here's the code I'm using now
$(document).click(function() {
alert("hide iframe");
});
$(".myDivInsideMyIframe").click(function(e) {
e.stopPropagation();
return false;
});
How can I hide my iframe by click outside the div thats inside?

How do you use $sce.trustAsHtml(string) to replicate ng-bind-html-unsafe in Angular 1.2+

How do you use $sce.trustAsHtml(string) to replicate ng-bind-html-unsafe
in Angular 1.2+

ng-bind-html-unsafe was removed in Angular 1.2
I'm trying to implement something where I need to use ng-bind-html-unsafe.
In the docs and on the github commit they say:
ng-bind-html provides ng-html-bind-unsafe like behavior (innerHTML's the
result without sanitization) when bound to the result of
$sce.trustAsHtml(string).
How do you do this?

Cross-compiling GSL 1.16 for ARM

Cross-compiling GSL 1.16 for ARM

I am trying to cross-compile the GNU Scientific Library (gsl, v1.16) for
ARM architecture (specifically the Raspberry Pi). I have used the
following to configure;
CROSS=armv6j-hardfloat-linux-gnueabi
./configure --host=x86_64-pc-linux-gnu --build=$CROSS --target=$CROSS \
CC=/usr/bin/$CROSS-gcc \
CXX=/usr/bin/$CROSS-g++ \
AR=/usr/bin/$CROSS-ar \
RANLIB=/usr/bin/$CROSS-ranlib \
CFLAGS="-march=armv6 -mfloat-abi=hard -mfpu-vfp"
I get the following error messages:
libtool: compile: /usr/bin/armv6j-hardfloat-linux-gnueabi-gcc
-DHAVE_CONFIG_H -I. -I.. -I.. -march=armv6 -mfloat-abi=hard -mfpu=vfp
-MT read.lo -MD -MP -MF .deps/read.Tpo -c read.c -o read.o
In file included from fp.c:10:0:
fp-gnux86.c: In function 'gsl_ieee_set_mode':
fp-gnux86.c:42:15: error: '_FPU_SINGLE' undeclared (first use in this
function)
fp-gnux86.c:42:15: note: each undeclared identifier is reported only once
for each function it appears in
fp-gnux86.c:45:15: error: '_FPU_DOUBLE' undeclared (first use in this
function)
fp-gnux86.c:48:15: error: '_FPU_EXTENDED' undeclared (first use in this
function)
fp-gnux86.c:57:15: error: '_FPU_RC_NEAREST' undeclared (first use in this
function)
fp-gnux86.c:60:15: error: '_FPU_RC_DOWN' undeclared (first use in this
function)
fp-gnux86.c:63:15: error: '_FPU_RC_UP' undeclared (first use in this
function)
fp-gnux86.c:66:15: error: '_FPU_RC_ZERO' undeclared (first use in this
function)
fp-gnux86.c:76:13: error: '_FPU_MASK_DM' undeclared (first use in this
function)
make[2]: *** [fp.lo] Error 1
I am compiling on a 64 bit Linux Gentoo system. I have used the Gentoo
toolchain to set-up my cross-compiler. Any pointers to what I am doing
wrong are highly appreciated.
Thanks in advance!

in javascript for loop is executing before the get method executes

in javascript for loop is executing before the get method executes

in following example val e contains all the selected clients from select
box,i am iterating them one by one in for loop and passing them via
jquery's get method to take values according to client but here for loop
is executing before get method ends and due to that it changes the value
of val(which is next value). How to resolve this problem ?
var e = document.getElementById("client");
for (var i = 0; i < e.options.length; i++) {
if(e.options[i].selected){
var val=e.options[i].value;
alert(val); // here it is coming normally
$('#fund').append('<option
value='+select.options.length+'>---'+val+'----</option>');
$.get("listFundsForClient", {client: val}, function(data) {
alert("2nd:"+val);// here it is taking next value due
to for loop iteration
});
}
}

Monday, 19 August 2013

XtraReport Export Excel and Print with Page Header

XtraReport Export Excel and Print with Page Header

Hy, I have an XtraReport and I want to export to an Excel File
after that I need to print it , but I loose all the page formats (Header ,
Footer , Repeat on each Page ... )
string reportPath = "c:\\Test.xls";
// Create a report instance.
XtraReport1 report = new XtraReport1();
reportDS c = new reportDS();
c.Init();
// genereaza report
report.DataSource = new reportDS[] { c };
// Get its XLS export options.
XlsExportOptions xlsOptions = report.ExportOptions.Xls;
// Set XLS-specific export options.
xlsOptions.ShowGridLines = true;
xlsOptions.TextExportMode = TextExportMode.Value;
// Export the report to XLS.
report.ExportToXls(reportPath);
// Show the result.
StartProcess(reportPath);
Can you tell me if it's possible what I want to do ?
And if not , can you suggest me another method ?

MongoDB Java driver: distinct with sort

MongoDB Java driver: distinct with sort

Using the MongoDB console I can write a native MongoDB query using
distinct key with a sort like this:
db.mycollection.distinct('mykey').sort('mykey', 1)
Using the Java driver I would expect to be able to write the same query
like this:
myCollection.distinct("myKey").sort(new BasicDBObject("myKey", 1));
However, this doesn't work because DBCollection#distinct() returns type
List and not type DBCursor like DBCollection#find().
How can I write the distinct query with a sort using the Java driver?

Can not figure outsyntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING

Can not figure outsyntax error, unexpected T_ENCAPSED_AND_WHITESPACE,
expecting T_STRING or T_VARIABLE or T_NUM_STRING

I am querying my database and recordID is an int. I have this line of code
when I echo out the value of $content['recordID'] it prints out a numeric
value, but when I put it in here I get this error:
syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or
T_VARIABLE or T_NUM_STRING.
But if I replace $content['recordID'] with a numeric value it works properly
$sqlCommentAmount = "SELECT * FROM `info` WHERE `recordID` =
$content['recordID']";

Is it possible to use multiple SiteMapNodes with the same Controller and Action, but different titles?

Is it possible to use multiple SiteMapNodes with the same Controller and
Action, but different titles?

I am constructing a Wizard, and use the same "Master" Controller and
Action to orchestrate which child controller and action is called to
implement the step.
I am trying to put together a breadcrumb trail to represent the Wizard
flow, with some difficulty. It is not helped by the fact that one cannot
have multiple "mvcSiteMapNode"s in mvc.SiteMap with the same controller
and action. It seems to need the master controller name ie "Wizard" and
"Index" as opposed to the child controller name ie "Step1" and "Index".
So, on its own, this will work:
<mvcSiteMapNode title="Step1" controller="Wizard"
action="Index" preservedRouteParameters="id"
route="Wizard"/>
However I would like to do, for multiple wizard steps:
<mvcSiteMapNode title="Step1" controller="Wizard"
action="Index" preservedRouteParameters="id"
route="Wizard"/>
<mvcSiteMapNode title="Step2" controller="Wizard"
action="Index" preservedRouteParameters="id"
route="Wizard"/>
But the above will not work, unless there is another way to differentiate
these nodes.
Any wisdom appreciated!
Thanks.

Including jsp images within a jsp file

Including jsp images within a jsp file

I have a page customer.jsp that displays textual information stored within
an object called Customer. On that page, I include an image that is
generated dynamically based on the information stored in Customer, by
including the HTML
<img src="cust_image.jsp" />,
where cust_image.jsp has content type image/jpeg. What is the best way to
make the Customer object available to cust_image.jsp, bearing in mind that
the user could have several open instances of customer.jsp displaying
different customers' details? Is there a way to avoid postfixing
cust_image.jsp with the customer ID?

Firefox: Failure"nsresult: "0x80004005 (NS_ERROR_FAILURE)

Firefox: Failure"nsresult: "0x80004005 (NS_ERROR_FAILURE)

I faced with following error in Firefox 23(this code works fine in IE and
Chrome) during send of XMLHttpRequest:
[Exception... "Failure" nsresult: "0x80004005 (NS_ERROR_FAILURE)"
location: "JS frame :: :: loadUiDesXml :: line 1" data: no] {
message="Failure", result=2147500037, name="NS_ERROR_FAILURE", more...}
I can't google what 2147500037 error means and this error is very strange
for me. This is a piece of code:
var xmlHttp = new XMLHttpRequest();
if (typeof theFile === "string")
{
xmlHttp.open("POST",theFile,false);
}else{
xmlHttp.open("POST",theFile.baseURI,false);
}
xmlHttp.send("");
The file variable is "/emWeb_6-0/des/en/ld117/ept.xml", domen origin
policy shouldn't prevent this request. The most strange thing, that I can
recieve ept.xml in other pages. For example, I can recieve this file
successfully in the following scenario: 1. Recieve ept.xml file on page1.
2. Redirect to page2, recieve ept.xml again 3. Redirect to page3, recieve
some other files, including ept.xml 4. Redirect back to page1, recieve
status.xml, then I try to recieve ept.xml and I get error duting send("")
The network trace is the following:
POST ept.xml
POST ept.xml
POST pch.xml
POST node.xml
POST ftpRslt.xml
POST ept.xml
POST status.xml
POST status.xml
I can't execute xmlHttp.send("") here.
This code works inside frame, I think that it can be related with the
error. Can anyone explain what is the root cause of this?

Sunday, 18 August 2013

Populating List of values from multiple models

Populating List of values from multiple models

How to create a List of values that to be referred by multiple models/screen?
I have created a model as ListValues, which will contains 2 fields (ID,
Name) and I want that to be called by all of my models, what could be the
best way. I do not want to loose on binding as well.

What are my choices for a persistent store other than CoreData?

What are my choices for a persistent store other than CoreData?

Since I'm having so many problems doing a CoreData migration with
MagicalRecord, I'm thinking of breaking out the attributes I added to the
default configuration and making another persistent store other than
CoreData. (I have 24 strings to store).
What are my choices?

Flexslider 2 direction nav pointers missing from download

Flexslider 2 direction nav pointers missing from download

Can anyone point me to where I can get Flexslider2's image file for the
direction nav pointers: bg_direction_nav.png
Couldn't work out why I kept getting strange text 'Fl' or 'Fi' in place of
the arrows on the slider. Checking through everything, I have found that
the background image and the css pointing to it is missing from the
download package!
Hopefully the missing image is my missing link... and I can adapt the css?
Can anyone help please?

Error with clipboard data when copying all using Ctrl+A in web browser

Error with clipboard data when copying all using Ctrl+A in web browser

I am working with clipboard data processing for a new project. I am facing
a strange problem in IE 10 (Version 10.0.9200.16660)
Following is my code
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>page - title</title>
<script type='text/javascript'
src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'></script>
<script type='text/javascript'>
jQuery(document).on('copy', function(e){
var body_element, selection, pageLink, copytext, newdiv, url;
url = document.location.href;
body_element = document.getElementsByTagName('body')[0];
selection = window.getSelection();
alert(selection);
});
</script>
</head>
<body>
<ol>
<li>Hi</li>
<li>Hi</li>
<li>Hi</li>
<li>Hi</li>
<li>Hi</li>
</ol>
</body>
</html>
Error
Save the above code to an HTML file
Run it
Use Ctrl + A, Ctrl + C
It is alerting the whole html, including the page title, the javascripts
etc.. in IE (see the attached image) but working fine in Chrome.
Can someone give me some hint on whats happening?

Need output as to if somewhere within the first array consists second array

Need output as to if somewhere within the first array consists second array

public boolean contains(int[] a,int[] b) {
int w=0;
for(int i=0;i<a.length && w<b.length;i++) {
if(a[i]==b[w])
w++;
else w=0;
}
System.out.println(w);
if(w==b.length) return true;
else return false;
}



This code is failing for the scenario-contains({1, 2, 1, 2, 3}, {1, 2,
3})-for obvious reasons. However, i can't put the right code in that
amends the right output. Please help me out.

Why width CSS attribute of label doesn't work without float?

Why width CSS attribute of label doesn't work without float?

I'm new in CSS, and I've got one question. I'd like to make a good simple
form, and there is the following code:
<form>
<div class="row"><label for="name">Some text field</label><input
type="text" name="name" /></div>
<div class="row"><label for="surname">Some another text
field</label><input type="text" name="surname" /></div>
</form>
Some CSS code:
label {
float: left;
width: 230px;
text-align: right;
margin: 5px;
}
.row {
clear: left;
}
I copied and pasted this code from some book. I understand floating,
clearing, but I don't understand why does "width" attribute work with
label (because it inline element) and, in this case, why doesn't "width"
work without "float"? Please, make me clear. Thanks

Saturday, 17 August 2013

Horizonal LinearLayout with max width TextView

Horizonal LinearLayout with max width TextView

I have a LinearLayout with horizontal orientation and two TextView
children. My goal is to have the left TextView expand to fit its text
content, but only up to a maximum width (to leave room for the right
TextView). The key is I want to be able to express this maximum width in
terms of a percentage similar to the way layout_weight is specified.
The problem with setting the layout_weight is that the TextView is then
unconditionally expanded to fill the maximum width, even if the contents
don't require the extra space.
Here's my current layout:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView android:id="@+id/subject"
android:textSize="18sp"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="0.8"/>
<TextView android:id="@+id/date"
android:textSize="14sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
Thanks!