Thursday, 3 October 2013

Resizable div just isn't working no matter what I do

Resizable div just isn't working no matter what I do

I've been trying to use JqueryUIs resizable to create resizable divs like
on jsfiddle for example. Jsfiddle makes use of JqueryUI resizable with
handles so that you can expand the code editor or the output area
displaying the dhtml results (a design etc). I've just about tried every
solution given to others who experience problems working with jquery ui's
resizble. Is there a way to create a resizable div with CSS only and have
a custom handle? I've tried this as well and it's not working either
http://blog.softlayer.com/2012/no-iframes-dynamically-resize-divs-with-jquery/
but it's what I'm looking for; two divs, one containing the main content
and the other containing sidebar stuff. I made a fiddle quickly of that
solution given here: http://jsfiddle.net/asx4M/ I would appreciate it if
someone could tell me what it is I'm doing wrong or provide me with
another solution for what I'm trying to do.
here's the code as well:
<!DOCTYPE html>
<html>
<head>
<style>
#sidebar {
width: 49%;
}
#content {
width: 49%;
float: left;
}
</style>
<link
href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-
ui.css" rel="stylesheet" type="text/css"/>
<script
src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script
src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js">
</script>
<script type="text/javascript">
$(document).ready(function() {
$( "#sidebar" ).resizable({
});
$("#sidebar ").bind("resize", function (event, ui) {
var setWidth = $("#sidebar").width();
$('#content).width(1224-setWidth);
$('.menu).width(setWidth-6);
});
});
</script>
</head>
<div id="sidebar">
<div class="sidebar-menu">
<!-- all your sidebar/navigational items go here -->
</div>
</div>
<div id="content">
<!-- all your main content goes here -->
</div>

Wednesday, 2 October 2013

jQuery Submit POST without form

jQuery Submit POST without form

I'm trying to submit a POST to a PHP script, without using a form. The
function works correctly apart from the actual post part.
Can anyone see what must be wrong with what I am doing here?
function checkforRates(){
alert('activated');
//FUNCTION CHECKS FOR RATES FOR EACH OF THE ICPS IN LATEST CONTRACT
var count = $("#selectICP").children("option:not([disabled])").length;
success = 0
$('#selectICP option:not([disabled])').each(function() {
opICPs = $(this).val();
$.ajaxSetup({
type: 'POST',
URL: 'functions/workforce_newcontract.php',
data: {'checkrates': 'true', 'ICP': opICPs, 'ctype': ctype},
//data: '?checkrates=true&ICP=' + opICPs + '&ctype=' + ctype,
success: function(result) {
if(result == 1){
//THIS ICP HAS ALL METERS AND ENGINES WITH RATES
success = success + 1;
} else {
$('#contract_window_message_error_mes').html(result);
$('#contract_window_message_error').fadeIn(300).delay(3000).fadeOut(700);
return false;
}
},
error: function() {
$('#contract_window_message_error_mes').html("An error
occured, the form was not submitted.");
$('#contract_window_message_error').fadeIn(300).delay(3000).fadeOut(700);
}
});
if(success === count){
//CONTINUE ONTO NEXT STAGE
alert('Success!');
}
});
}
Many thanks.

How to limit number of store results in grid?

How to limit number of store results in grid?

Using ExtJS 4.2 - I have an AJAX call populating the store with the entire
set of results in JSON format (using loadRawData). I now need to limit the
number of results being shown on the grid at a time. End goal is to
implement client-side paging. I've tried using pagingmemoryproxy with not
much luck.

Unexpected conversion error in recursive query

Unexpected conversion error in recursive query

I've tried this but keep coming up with an error. "Msg 245, Level 16,
State 1, Line 5 Conversion failed when converting the varchar value
'Accessory' to data type int." I'm not certain why I'm getting it, it
appears to be trying to convert EntityType to an ID? but I'm not certain
where or why.
My query I'm using is as follows,
DECLARE @EntityType varchar(25)
SET @EntityType = 'Accessory';
WITH EntityRec (
E_ID, E_Type,
P_ID, P_Name, P_DataType, P_Required, P_OnlyOne,
PV_ID, PV_Value, PV_EntityID, PV_ValueEntityID,
PV_UnitValueID, PV_UnitID, PV_UnitName, PV_UnitDesc, PV_MeasureID,
PV_MeasureName, PV_UnitValue,
PV_SelectionID, PV_DropDownID, PV_DropDownName,
PV_DropDownOptionID, PV_DropDownOptionName, PV_DropDownOptionDesc,
RecursiveLevel
)
AS
(
-- Original Query
SELECT E1.ID AS E_ID, dbo.EntityType.Name AS E_Type,
dbo.Property.ID AS P_ID, dbo.Property.Name AS P_Name, DataType.Name AS
P_DataType, Required AS P_Required, OnlyOne AS P_OnlyOne,
dbo.PropertyValue.ID AS PV_ID, dbo.PropertyValue.Value AS PV_Value,
dbo.PropertyValue.EntityID AS PV_EntityID,
dbo.PropertyValue.ValueEntityID AS PV_ValueEntityID,
dbo.UnitValue.ID AS PV_UnitValueID, dbo.UnitOfMeasure.ID AS PV_UnitID,
dbo.UnitOfMeasure.Name AS PV_UnitName, dbo.UnitOfMeasure.Description
AS PV_UnitDesc, dbo.Measure.ID AS PV_MeasureID, dbo.Measure.Name AS
PV_MeasureName, dbo.UnitValue.UnitValue AS PV_UnitValue,
dbo.DropDownSelection.ID AS PV_SelectionID, dbo.DropDown.ID AS
PV_DropDownID, dbo.DropDown.Name AS PV_DropDownName,
dbo.DropDownOption.ID AS PV_DropDownOptionID, dbo.DropDownOption.Name
AS PV_DropDownOptionName, dbo.DropDownOption.Description AS
PV_DropDownOptionDesc,
0 AS RecursiveLevel
FROM dbo.Entity AS E1
INNER JOIN dbo.EntityType ON dbo.EntityType.ID = E1.TypeID
INNER JOIN dbo.Property ON dbo.Property.EntityTypeID = E1.TypeID
INNER JOIN dbo.PropertyValue ON dbo.Property.ID =
dbo.PropertyValue.PropertyID AND dbo.PropertyValue.EntityID = E1.ID
INNER JOIN dbo.DataType ON dbo.DataType.ID = dbo.Property.DataTypeID
LEFT JOIN dbo.UnitValue ON dbo.UnitValue.ID =
dbo.PropertyValue.UnitValueID
LEFT JOIN dbo.UnitOfMeasure ON dbo.UnitOfMeasure.ID =
dbo.UnitValue.UnitOfMeasureID
LEFT JOIN dbo.Measure ON dbo.Measure.ID = dbo.UnitOfMeasure.MeasureID
LEFT JOIN dbo.DropDownSelection ON dbo.DropDownSelection.ID =
dbo.PropertyValue.DropDownSelectedID
LEFT JOIN dbo.DropDownOption ON dbo.DropDownOption.ID =
dbo.DropDownSelection.SelectedOptionID
LEFT JOIN dbo.DropDown ON dbo.DropDown.ID =
dbo.DropDownSelection.DropDownID
WHERE dbo.EntityType.Name = @EntityType
UNION ALL
-- Recursive Query?
SELECT E2.E_ID AS E_ID, dbo.EntityType.Name AS E_Type,
dbo.Property.ID AS P_ID, dbo.Property.Name AS P_Name, DataType.Name AS
P_DataType, Required AS P_Required, OnlyOne AS P_OnlyOne,
dbo.PropertyValue.ID AS PV_ID, dbo.PropertyValue.Value AS PV_Value,
dbo.PropertyValue.EntityID AS PV_EntityID,
dbo.PropertyValue.ValueEntityID AS PV_ValueEntityID,
dbo.UnitValue.ID AS PV_UnitValueID, dbo.UnitOfMeasure.ID AS PV_UnitID,
dbo.UnitOfMeasure.Name AS PV_UnitName, dbo.UnitOfMeasure.Description
AS PV_UnitDesc, dbo.Measure.ID AS PV_MeasureID, dbo.Measure.Name AS
PV_MeasureName, dbo.UnitValue.UnitValue AS PV_UnitValue,
dbo.DropDownSelection.ID AS PV_SelectionID, dbo.DropDown.ID AS
PV_DropDownID, dbo.DropDown.Name AS PV_DropDownName,
dbo.DropDownOption.ID AS PV_DropDownOptionID, dbo.DropDownOption.Name
AS PV_DropDownOptionName, dbo.DropDownOption.Description AS
PV_DropDownOptionDesc,
(RecursiveLevel + 1)
FROM EntityRec AS E2
INNER JOIN dbo.EntityType ON dbo.EntityType.ID = E2.E_Type
INNER JOIN dbo.Property ON dbo.Property.EntityTypeID = E2.E_Type
INNER JOIN dbo.PropertyValue ON dbo.Property.ID =
dbo.PropertyValue.PropertyID AND dbo.PropertyValue.EntityID = E2.E_ID
INNER JOIN dbo.DataType ON dbo.DataType.ID = dbo.Property.DataTypeID
INNER JOIN dbo.UnitValue ON dbo.UnitValue.ID =
dbo.PropertyValue.UnitValueID
INNER JOIN dbo.UnitOfMeasure ON dbo.UnitOfMeasure.ID =
dbo.UnitValue.UnitOfMeasureID
INNER JOIN dbo.Measure ON dbo.Measure.ID = dbo.UnitOfMeasure.MeasureID
INNER JOIN dbo.DropDownSelection ON dbo.DropDownSelection.ID =
dbo.PropertyValue.DropDownSelectedID
INNER JOIN dbo.DropDownOption ON dbo.DropDownOption.ID =
dbo.DropDownSelection.SelectedOptionID
INNER JOIN dbo.DropDown ON dbo.DropDown.ID =
dbo.DropDownSelection.DropDownID
INNER JOIN dbo.Entity AS E1 ON E1.ID = E2.PV_ValueEntityID
)
SELECT E_ID, E_Type,
P_ID, P_Name, P_DataType, P_Required, P_OnlyOne,
PV_ID, PV_Value, PV_EntityID, PV_ValueEntityID,
PV_UnitValueID, PV_UnitID, PV_UnitName, PV_UnitDesc, PV_MeasureID,
PV_MeasureName, PV_UnitValue,
PV_SelectionID, PV_DropDownID, PV_DropDownName, PV_DropDownOptionID,
PV_DropDownOptionName, PV_DropDownOptionDesc,
RecursiveLevel
FROM EntityRec
INNER JOIN [dbo].[Entity] AS dE
ON dE.ID = PV_EntityID
I've tried many variations of the above query trying to tweak it. My
current problem with it is, I'm not sure what exactly I'm doing wrong. I
understand what the error means I'm just not sure why/where it's trying to
do that.
Other Info
I have a Db Structure like so,
dbo.Entity: ID PK, TypeID FK (References EntityType)
dbo.EntityType: ID PK, Name
dbo.Property: ID PK, EntityTypeID FK, Name, DataType, Required, etc.
dbo.PropertValue: ID PK, EntityID FK, PropertyID FK, ~Value, ~UnitValueID
FK, ~DropDownSelectedID FK, ~ValueEntityID FK
Where "~" means nullable. The value, UnitValueID, DropDownSelectedID, and
ValueEntityID are possible values. (You're going to have only one non-null
value there).
Ex. "Accessory" is an EntityType. A property of Accessory is Type. Type is
a property that accepts the EntityType AccessoryType. "AccessoryType" has
3 properties (DimA, DimB, DimC) whose values are EntityType of
"Dimension". How would I construct a query that gets all Accessories (When
@EntityType = "Accessory"), All AccessoryTypes that are values of those
Accessories, and All Dimensions that are values of those AccessoryTypes?
Any assistance in fixing this would be greatly appreciated.

LINQ sorting of property List in List of custom object

LINQ sorting of property List in List of custom object

I have two lists of objects, each object has the property Recommendations
which itself is a list of 'Recommendation' objects. I want to sort the
recommendation objects based on one of its properties. I have come up with
this:
TPSqlORs.Where(x => x.Recommendations != null).ToList().ForEach(y =>
y.Recommendations.OrderBy(z => z.PointNumber));
SbmReportsORs.Where(x => x.Recommendations != null).ToList().ForEach(y =>
y.Recommendations.OrderBy(z => z.PointNumber));
But it causes no change at all to the original lists, which makes me
suspect the ToList() is just making a copy and the sorting is happening on
a copy which gets lost after execution. I searched along these lines but
apparently whilst it does make a copy, the new list contains references to
the original list elements, so surely it should be sorting them for both
lists?

Tuesday, 1 October 2013

Excel Match Up with returning value

Excel Match Up with returning value

I'm doing a survivor pool and i'm trying to create a spreadsheet that will
do the following: SHEET 1 = Total Stats SHEET 2= INPUT DATA
SHEET 2, every week I will input name of the survivor knocked out. Sheet
1, I need it to return my point system.
Anyways, just thought I would give a brief explanation before I try to
explain the formula I need.
SHEET 1, row A4 = Aras. Now if I enter Aras in sheet 2 row B3 as being
kicked off I need C4 on sheet 1 to return 0. Which, I've used this formula
=IF(A4<>'Weekly Input Data'!B3,1,0) and it works BUT my dilema - for week
2 I need this to remain 0 but it needs to look in another cell for week 2
on sheet 2, so if John gets kicked off in week 2 it needs to show 0 for
both Aras and John and for all the other survivors it needs to show value
of 1 since that survivor made it through the week. I think I need to
insert an array of cells to look up on sheet 2 but this is where i'm lost?
PLEASE HELP ME!! let me know if you have any questions b/c I had a hard
time explaining it.
THanks!

bootstrap css: content not changing position with the page width

bootstrap css: content not changing position with the page width

this is the index page of my blog http://www.lowcoupling.com It is a
tumblr blog based on twitter bootstrap I can't see why the position of the
list of tweets in the footer is not updated with the page width

Can I stay logged on?

Can I stay logged on?

I mean stay logged on to facebook & youtube, like i dont have to sign in
every time its already signed in. When I turn it off and turn it back on
it'll already be signed in.

Proving an Inequality Involving Integer Partitions

Proving an Inequality Involving Integer Partitions

I am having a bit of trouble beginning the following:
Prove that for all positive integers $n$, the inequality
$p(n)^2<p(n^2+2n)$ holds, where $p(n)$ is defined as the number of all
partitions of $n$.
I initially considered weak induction on n, but am not sure if that is the
correct way to begin. Is there an alternate, stronger path (such as a
combinatorial proof) I should consider? I feel like I'm making this more
difficult than it should be, and I apologize if this is the case.
Thank you in advance!

Monday, 30 September 2013

Product of exponents of prime factorization – math.stackexchange.com

Product of exponents of prime factorization – math.stackexchange.com

Let $p(n)$ be the product of the exponents of the prime factorization of
$n$. For example, $$p(5184) = p(2^6 3^4) = 24 \;,$$ $$p(65536) = p(2^{16})
= 16 \;.$$ Define $P(n)$ as the number of iterations …

First occurrence of "by the usual compactness argument"? – mathoverflow.net

First occurrence of "by the usual compactness argument"? – mathoverflow.net

In his blog, Jeff Shallit asks, what was the first occurrence of the exact
phrase, "by the usual compactness arguments," in the mathematical
literature? He reports that the earliest appearance he has …

twitter web intent callbacks do not fire in all versions of internet explorer when a hash exists in the URL

twitter web intent callbacks do not fire in all versions of internet
explorer when a hash exists in the URL

In all versions of IE, the web intent for tweet or follow are not firing
when the url contains a hash. Here is an example:
This fails:
http://clientqa.rtm.com/impossiblycomfortable/test.html#abc
This works:
http://clientqa.rtm.com/impossiblycomfortable/test.html

how to find duration of a video file using mediainfo?

how to find duration of a video file using mediainfo?

How can I find duration of a video file in miliseconds i.e. in integer in
deterministic way. I have used ffprobe to get the duration but it doesn't
give duration for all file formats.

Sunday, 29 September 2013

how to pass array size to function in C++

how to pass array size to function in C++

just I want to ask how can I pass array size to throw function to set size
of my game recoreds
void playGame(int max_streak_length)
{
int tracker =0 ;
const int arrsize = max_streak_length;
int gameRecored[arrsize]={0};
while( tracker < 4)
{
Craps games;
if( games.Play()== true)
{
tracker++;
}
else
if(tracker >0)
{
gameRecored[tracker-1]++;
tracker = 0;
}
}
gameRecored[tracker-1]++;
int v= 0;
}

Secure the removal of an entity with Symfony 2

Secure the removal of an entity with Symfony 2

I'm new to Symfony, and in order to apply what I learned with this
framework, I wanted to build a complete app. I have a Message entity, and
I would like to secure the removal of this entity. Only the user who
created the message and the moderators can remove it. How to secure the
removal ? I mean, in my code I've already written something like
if($message->$user == $this->user || $this->user->isGranted('ROLE_MODO')),
but how to prevent CSRF attack ?

Replace ObjectID method for node-mongo-native

Replace ObjectID method for node-mongo-native

The objectID object used in mongo seems to be a little difficult to deal
with when it comes to passing it back and forth with json and
communicating with other applications. It seems that to use it, I have to
convert back and forth between the object for querying and the string for
json message passing.
I think it would be great instead for node-mongo-native to create my _id's
as strings by default. Something like this would make a good unique id
generation system that also doubles as a timestamper:
function createID(){
return (Date.now() + ((Math.round(Math.random()*1000000))/1000000)
).toString();
}
Is there a way for me to have node-mongo-native use this function for id
generation instead of the default?

Dynamic default open page in excel

Dynamic default open page in excel

Below is my data in sheet "Sheet1"
ID Jan-13 Feb-13 Mar-13 Apr-13 Apr-13 May-13 Jun-13 Jul-13 Aug-13 Sep-13
A1 12 16 26 46 10 20 50 40 25 15 A2 24 18 24 26 20 20 20 20 25 25 A3 48 15
30 18 30 10 10 10 20 45 A4 16 51 20 10 40 50 20 30 30 15
I wish the data should be visible only for latest six months. for example,
if the current month for Sep-13,
ID Apr-13 May-13 Jun-13 Jul-13 Aug-13 Sep-13 A1 10 20 50 40 25 15 A2 20 20
20 20 25 25 A3 30 10 10 10 20 45 A4 40 50 20 30 30 15
and if the current month is Oct-13,
ID May-13 Jun-13 Jul-13 Aug-13 Sep-13 Oct-13 A1 20 50 40 25 15 10 A2 20 20
20 25 25 25 A3 10 10 10 20 45 35 A4 50 20 30 30 15 30
remaining columns should be hidden. If there is no data in Oct-13 the
current month view should be same as Sep-13. I have month row is filled
till 2014 and each row has formula based on another sheet "Sheet2". If I
add data for oct-13 in "Sheet2", the data will be visible for Oct-13
column in "Sheet1" otherwise it will be blank. It will be helpful if
someone help me how to make this dynamic using excel VBA.
Thanks in advance.

Saturday, 28 September 2013

Grails How to show a different link name in a form

Grails How to show a different link name in a form

In my domain i have a one to many relationship with Inventory and
Inventory Item. This is the snippet from the gsp. It shows each inventory
item assigned to a specific inventory.
<g:if test="${inventoryInstance?.inventoryItem}">
<li class="fieldcontain">
<span id="inventoryItem-label" class="property-label"><g:message
code="inventory.inventoryItem.label" default="Inventory Item"
/></span>
<g:each in="${inventoryInstance.inventoryItem}" var="i">
<span class="property-value"
aria-labelledby="inventoryItem-label"><g:link
controller="inventoryItem" action="show"
id="${i.id}">${i?.encodeAsHTML()}</g:link></span>
</g:each>
</li>
</g:if>
Problem is the links shown is package.InventoryItem: 1
how do you change it to the InventoryItem's name ( i have a name row in my
database)

Using BindConstraint in Clutter to constrain the size of an actor

Using BindConstraint in Clutter to constrain the size of an actor

I recently discovered constraints in Clutter, however, I can't find
information on how to constrain the size of actor by proportion. For
example, I want an actor to keep to 1/2 the width of another actor, say
it's parent.

Converting JSON string to Associative array in PHP

Converting JSON string to Associative array in PHP

What I'm trying to Do is so simple yet everything I tries had failed. I
have the following string: "{"msg":"background1.jpg"}", and I want to
convert it to an array to access the msg value. this should simply be done
like so(or so I've thought):
$theString = "{"msg":"background1.jpg"}";
var_dump(json_decode($theString, TRUE));
The vr_dump() is dumping NULL, also tried:
var_dump(json_decode(json_encode($theString), TRUE));
This dumps string(45) "{"msg":"background1.jpg"}"
and tried many many more things, but all failed. Any thought please.

Export/save specific data from a html file to word or text or excel or csv extension

Export/save specific data from a html file to word or text or excel or csv
extension

I have some huge html files in ".txt" extension. I want to extract
information such as Name, Address, Mobile No, E-mail Address and want to
save it in a text or excel or csv so that it will be easier for me to
access data...Please help as soon as possible.
Thanks - Vikram Kumar

Friday, 27 September 2013

is it possible to just login once using Google Calendar APIs v3?

is it possible to just login once using Google Calendar APIs v3?

I am developing a desktop application which interacts with Google
Calendar. I want user to log in just the first time, so later it will auto
login. Can it be done using Google Calendar API v3?

Redirect Old URLs with htm Extension

Redirect Old URLs with htm Extension

I have moved to php software that creates SEF URLs. But my site has been
around a long time and there are many Not Found errors that come in for
old URLs that have the htm extension. Is there a way to direct any URL
with the .htm extension to, say, the home page of the site?

Is there a CDN for unstable versions of Angular.js?

Is there a CDN for unstable versions of Angular.js?

I generally use CDNs for javascript libraries, but now I want to try
something from the newest "release candidate" version of Angular.js ( 1.2
at this time )
Is there a CDN that serves "unstable" new releases of Angular.js? Or do I
have to download it and serve it myself?

jquery multitype Jagged array behaving strangely

jquery multitype Jagged array behaving strangely

Please refer to this:
http://jsfiddle.net/MasterOfKitties/v7xbu/7/
/*This is the desired behavior*/
/*var A = [1, 2, 3]*/
/*var B = "hello", [1, 2, 3],
"hello", [2, 3, 2],
"hello", [1, 5, 1]]*/
var A = new Array();
var B = new Array();
function fnMakeArray()
{
var strTemp;
var arrTemp = new Array();
strTemp = parseInt(window.prompt("Enter a number until you hit
cancel",""));
while (strTemp>0)
{
arrTemp.push(strTemp);
strTemp = parseInt(window.prompt("Enter a number until you hit
cancel",""));
}
A[0] = "hello";
A[1] = arrTemp;
alert(A);
}
function fnReplicateArray()
{
B.push(A);
fnDisBArray();
alert(B);
}
function fnDisBArray()
{
var strTemp;
for(var x = 0; x<B.length;x++)
{
strTemp += "<P>" + B[x] + "</p>"
}
document.getElementById('parse').innerHTML = strTemp ;
}
For some reason, when attempting to display the B array, it puts out
undefined. Furthermore, it does not seem to increment the jagged array
correctly, as the b[0] element begins to radically change even though the
b[1] or b[2] element is being arranged.
Any assistance? What's going on?

Converting Binary To Ascii but Getting Same Result for all bit strings

Converting Binary To Ascii but Getting Same Result for all bit strings

I am doing a little project where I have to write a Genetic Algorithm to
evolve my name and id number. Basically I'm randomly generating bit
strings which have to then be generated into strings of ascii characters
and measure to see how close the generation gets. I will then mutate the
best 10 generations to try and get it as close as possible to my name and
id.
The bit I am having trouble with at the moment is the ascii generation. It
works fine for the first bit string but then just repeats itself for the
rest of them despite the fact that each bit string is different. Can
anyone see the problem? Any help is much appreciated.
Code so far:
import java.util.Random ;
public class GeneticAlgorithm {
public static void main(String[] args) throws Exception
{
int popSize = 0 ;
int gen ;
double repRate ;
double crossRate ;
double mutRate ;
int seed = 9005970 ;
String id = "John Connolly 00000000" ;
int bits = 7 * id.length() ;
String output ;
int pop ;
int bitGen ;
Random rand = new Random(seed) ;
ConvertToAscii convert = new ConvertToAscii() ;
Fitness fit = new Fitness() ;
try {
popSize = Integer.parseInt(args[0]) ;
if(popSize < 0 || popSize > 100000)
{
System.out.print("Invalid number! A positive number
between 0 and 100000 must be used for the population
rate!") ;
System.exit(1) ; // Signifies system exit if error occurs
}
gen = Integer.parseInt(args[1]) ;
if(gen < 0 || gen > 100000)
{
System.out.println("Invalid number! A positive number
between 0 and 100000 must be used for the generation
rate!") ;
System.exit(1) ;
}
repRate = Double.parseDouble(args[2]) ;
if(repRate < 0 || repRate > 1.0)
{
System.out.println("Invalid number! A positive decimal
point number between 0 and 1.0 must be used for the
reproduction rate!") ;
System.exit(1) ;
}
crossRate = Double.parseDouble(args[3]) ;
if(crossRate < 0 || crossRate > 1.0)
{
System.out.println("Invalid number! A positive decimal
point number between 0 and 1.0 must be used for the
crossover rate!") ;
System.exit(1) ;
}
mutRate = Double.parseDouble(args[4]) ;
if(mutRate < 0 || mutRate > 1.0)
{
System.out.println("Invalid number! A positive decimal
point number between 0 and 1.0 must be used for the
mutation rate!") ;
System.exit(1) ;
}
if(repRate + crossRate + mutRate != 1.0)
{
System.out.println("The Reproduction Rate, Crossover Rate
and Mutation Rate when sumed together must equal 1.0!") ;
System.exit(1) ;
}
output = args[5] ;
java.io.File file = new java.io.File(output);
java.io.PrintWriter writeOut = new java.io.PrintWriter(file) ;
StringBuffer bitString = new StringBuffer() ;
int bestFit = 0, fitness = 0, totalFit = 0 ;
String ascii = "" ;
writeOut.println(popSize + " " + gen + " " + repRate + " " +
crossRate + " " + mutRate + " " + output + " " + seed) ;
for(pop = 0 ; pop < popSize ; pop++)
{
ascii = "" ;
writeOut.print(pop + " ") ;
for(int i = 0 ; i < bits ; i++)
{
bitGen = rand.nextInt(2);
writeOut.print(bitGen) ;
bitString.append(bitGen) ;
}
ascii = convert.binaryToASCII(bitString) ;
writeOut.print(" " + ascii) ;
writeOut.println() ;
}
writeOut.close() ;
System.exit(0) ;
} catch(ArrayIndexOutOfBoundsException e) {
System.out.println("You have entered the incorrect number of
arguments!") ;
System.out.println("Please enter the required 6 arguments.") ;
System.exit(1) ;
} catch(NumberFormatException n) {
System.out.println("Invalid argument type") ;
System.exit(1) ;
}
}
}
Here is the conversion code:
public class ConvertToAscii {
public String binaryToASCII(StringBuffer bitString)
{
String ascii = "" ;
String byteString ;
int decimal ;
int i = 0, n = 7 ;
int baseNumber = 2 ;
char asciiChar ;
while(n <= 154)
{
byteString = bitString.substring(i, n) ;
decimal = Integer.parseInt(byteString, baseNumber) ;
System.out.print(" " + decimal) ;
i += 7 ;
n += 7 ;
if(decimal < 33 || decimal > 136)
{
decimal = 32 ;
asciiChar = (char) decimal ;
} else {
asciiChar = (char) decimal ;
}
ascii += asciiChar ;
}
return ascii ;
}
}

Accordion like menu - sub-menu not hiding while click on another link - jQuery

Accordion like menu - sub-menu not hiding while click on another link -
jQuery

I have a menu made with ul an li, and I am trying to hide other sub-menus
when a click event is triggered on a anchor. The HTML menu looks like this
<ul id="navigation">
<li>
<a href="javascript:void(0)">link 1</a>
<ul class="subnavi">
<li><a href="#">sublink 1</a></li>
<li><a href="#">sublink 2</a></li>
</ul>
</li>
<li>
<a href="javascript:void(0)">link 2</a>
<ul class="subnavi">
<li><a href="#">sublink 3</a></li>
<li><a href="#">sublink 4</a></li>
</ul>
</li>
<li class="active">
<a href="javascript:void(0)">link 3</a>
<ul class="subnavi">
<li><a href="#">sublink 5</a></li>
<li><a href="#">sublink 6</a></li>
</ul>
</li>
<li>
<a href="#">link 4</a>
</li>
</ul>
the CSS code looks like this
#navigation li ul{ display: none;}
an the Jquery part looks like this
$('#navigation > li:has(ul) > a').on("click",function(ev) {
$(this).siblings('ul').toggle().end().siblings().find('ul').hide();
ev.preventDefault();
});
What am I doing wrong ?

Why i haven't got any beep from my kernel driver

Why i haven't got any beep from my kernel driver

I want to do beep whis IOCTL_BEEP_SET, but i hear only some slight knock
out from speaker.. Where is my problem? I want to create code that i can
run on difference versions of Windows. And don't want to write port and
using HalMakeBeep().
NTSTATUS Beep(IN DWORD dwFreq, IN DWORD dwDuration)
{
HANDLE hBeep;
UNICODE_STRING BeepDevice;
OBJECT_ATTRIBUTES oaBeepAttr;
IO_STATUS_BLOCK IoStatusBlock;
BEEP_SET_PARAMETERS BeepParameters;
NTSTATUS Status;
RtlInitUnicodeString(&BeepDevice, DD_BEEP_DEVICE_NAME_U);
InitializeObjectAttributes(&oaBeepAttr,&BeepDevice, 0, NULL, NULL);
Status = ZwCreateFile(&hBeep,
FILE_READ_DATA|FILE_WRITE_DATA|SYNCHRONIZE,
&oaBeepAttr,
&IoStatusBlock,
NULL,
0,
FILE_SHARE_READ|FILE_SHARE_WRITE,
FILE_OPEN_IF,
FILE_SYNCHRONOUS_IO_NOALERT,
NULL,
0);
if (!NT_SUCCESS(Status))
{
DbgPrint("ZwCreateFile error = 0x%x\n", Status);
return STATUS_UNSUCCESSFUL;
}
if ((dwFreq >= BEEP_FREQUENCY_MINIMUM && dwFreq <=BEEP_FREQUENCY_MAXIMUM) ||
(dwFreq == 0x0 && dwDuration == 0x0))
{
BeepParameters.Frequency = dwFreq;
BeepParameters.Duration = dwDuration;
Status = ZwDeviceIoControlFile(hBeep,
NULL,
NULL,
NULL,
&IoStatusBlock,
IOCTL_BEEP_SET,
&BeepParameters,
sizeof(BeepParameters),
NULL,
0);
if (Status != STATUS_SUCCESS && Status != STATUS_PENDING )
{
DbgPrint("ZwDeviceIoControlFile returns error
0x%X\nIO_STATUS_BLOCK 0x%X 0x%X 0x%X\n",
Status,IoStatusBlock.Status, IoStatusBlock.Pointer,
IoStatusBlock.Information);
}
DbgPrint("ZwDeviceIoControlFile returns error 0x%X\nIO_STATUS_BLOCK
0x%X 0x%X 0x%X\n", Status,IoStatusBlock.Status, IoStatusBlock.Pointer,
IoStatusBlock.Information);
}
else
{
DbgPrint("Wrong parameters\n");
ZwClose(hBeep);
return STATUS_INVALID_PARAMETER;
}
ZwClose(hBeep);
return STATUS_UNSUCCESSFUL;
}

Thursday, 26 September 2013

Unicode support for android - How to identify fontavailable on particular device

Unicode support for android - How to identify fontavailable on particular
device

We looked at various threads on stackoverflow, so do understand limitation
of some fonts on lower android version.
Is there way to identify whether particular device has unicode font
available ( e.g. Hindi, Chinese, etc )?
If we get to know which fonts are available then we will display unicode
support only on those phone..
So what we want to achieve is method something like
isUnicodeAvailable(fontname/FontType)
Settings page
Some Method (){
if ( **isUnicodeAvailable(FontName)** ) {
//Show text with unicode
}else{
//Show normal text
}
}

Thursday, 19 September 2013

Adding a strong name / signature to an outside DLL?

Adding a strong name / signature to an outside DLL?

We're signing our library but one of our external dependencies is itself
not signed, giving us the following error:
Referenced assembly 'ManyConsole' does not have a strong name
We get the ManyConsole package (a great one BTW!) via Nuget but are ok
with a non-Nuget orphan that is signed by us. In fact, we could very well
sign it with the same key as our own app but it's not clear how we can
sign an "outside" DLL.

WordPress theme - pagination issue

WordPress theme - pagination issue

I've installed a WordPress theme and pages 2,3,4,etc aren't working. They
come up with a 404 error that the pages cannot be found.
The url for page 2 is http://mysite.com/?paged=2.
After some messing around I've figured out how to get my pages to appear
but I have to manually type in the url to see them. For example, the url
to get page 2 to appear is http://mysite.com/?page_id=2&paged=2
How can I get it to go to this url automatically? Is it a permalink
problem (in my WordPress settings) or do I need to edit the pagination
code?
Any help will be so appreciated!
Here is the pagination code:
<?php
global $wp_query;
$big = 999999999;
echo paginate_links( array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link(
$big ) ) ),
'format' => '?paged=%#%',
'current' => max( 1, get_query_var('paged') ),
'total' => $wp_query->max_num_pages,
'type' => 'list',
'prev_text' => __(''),
'next_text' => __('»')
) );
?>
</div>

Using $in and $lt to find data with specific array values in MongoDB

Using $in and $lt to find data with specific array values in MongoDB

I have a people collection with a timeline array containing a year when
something happened to this person. For example the year they were born,
like this:
db.people.insert({
"timeline": [
{ "born_year": 1999 },
{ "other_event": 2005 }
]
});
I can query this collection for someone born 1999:
db.people.find({
"timeline": { $in: [ { "born_year": 1999 } ] }
});
However, when using $lt to query for people born before 2000 I don't get
any results at all:
db.people.find({
"timeline": { $in: [ { "born_year": { $lt: 2000 } } ] }
});
Can anyone explain to me what I'm doing wrong here?

High Level Overview Of Throwing Exceptions In Java

High Level Overview Of Throwing Exceptions In Java

I am a little bit confused with exceptions in Java and when to use which
particular style of implementation.
I used IllegalArgumentException as an example, but the main point I would
like to address is when does one throw, extends or throw new exception?
Also as an additional point I have an assignment where I have to create a
java class and the spec vaguely states that the constructor should throw
an IllegalArgumentException so which one would be the best to use?
public class Test{
//when does one use this type of exception
public Test(String yourName) throws IllegalArgumentException{
//code implemented
}
//when does one use this type of exception
public Test(String yourName) extends IllegalArgumentException{
//code implemented
}
public Test(String yourName){
if(yourName.length() <= 0){
//why not use this type of exception instead
//and what happens when I use this type of exception
throw new IllegalArgumentException("Please Enter Your Name..!");
}
}
}
Thanks in advance.

crm 4.0 filtered lookup

crm 4.0 filtered lookup

I have a lookup field in my base-entity. The target entity has a
number-field in it.
When I open the lookup-dialog all the target-records are shown, but I only
want to show the records where the number-field is 123, for example.
the value is fixed, but how can filter the lookupfield. Best would be if
could edit the fetchxml in javascript, but I don't know how

Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:2.4:javadoc (default) on project

Failed to execute goal
org.apache.maven.plugins:maven-javadoc-plugin:2.4:javadoc (default) on
project

when am trying to build webservices am getting build errors. its failing
to execute goal org.apache.maven.plugins:maven-javadoc-plugin:2.4:javadoc
Failed to execute goal
org.apache.maven.plugins:maven-javadoc-plugin:2.4:javadoc (default) on
project hibu-apiservices-webservices: An error has occurred in JavaDocs
report generation:Exit code: 1 - Sep 19, 2013 5:07:50 PM
com.sun.jersey.wadl.resourcedoc.ResourceDoclet start
[ERROR] SEVERE: Could not serialize ResourceDoc.
[ERROR] java.lang.IllegalArgumentException
[ERROR] at sun.net.www.ParseUtil.decode(ParseUtil.java:189)
[ERROR] at sun.misc.URLClassPath$FileLoader.<init>(URLClassPath.java:954)
[ERROR] at sun.misc.URLClassPath$3.run(URLClassPath.java:326)
[ERROR] at java.security.AccessController.doPrivileged(Native Method)
[ERROR] at sun.misc.URLClassPath.getLoader(URLClassPath.java:320)
[ERROR] at sun.misc.URLClassPath.getLoader(URLClassPath.java:297)
[ERROR] at sun.misc.URLClassPath.findResource(URLClassPath.java:144)
[ERROR] at java.net.URLClassLoader$2.run(URLClassLoader.java:362)
[ERROR] at java.security.AccessController.doPrivileged(Native Method)
[ERROR] at java.net.URLClassLoader.findResource(URLClassLoader.java:359)
[ERROR] at java.lang.ClassLoader.getResource(ClassLoader.java:978)
[ERROR] at
javax.xml.bind.ContextFinder.loadJAXBProperties(ContextFinder.java:391)
[ERROR] at javax.xml.bind.ContextFinder.find(ContextFinder.java:323)
[ERROR] at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574)
[ERROR] at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:522)
[ERROR] at
com.sun.jersey.wadl.resourcedoc.ResourceDoclet.start(ResourceDoclet.java:177)
[ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[ERROR] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[ERROR] at java.lang.reflect.Method.invoke(Method.java:597)
[ERROR] at com.sun.tools.javadoc.DocletInvoker.invoke(DocletInvoker.java:269)
[ERROR] at com.sun.tools.javadoc.DocletInvoker.start(DocletInvoker.java:143)
[ERROR] at com.sun.tools.javadoc.Start.parseAndExecute(Start.java:340)
[ERROR] at com.sun.tools.javadoc.Start.begin(Start.java:128)
[ERROR] at com.sun.tools.javadoc.Main.execute(Main.java:41)
[ERROR] at com.sun.tools.javadoc.Main.main(Main.java:31)
[ERROR]
[ERROR] Command line was:"C:\Program
Files\Java\jdk1.6.0_13\bin\javadoc.exe"
-J-Djava.util.logging.ConsoleHandler.level=ALL @options
[ERROR] -> [Help 1]

JSONModel returns nil

JSONModel returns nil

I'mm using JSONModel to get the JSON from the URL. It's a very simple
object, containing only 2 strings - "name" and "url".
First I made the Object Model:
@protocol
Tutorial
@end
@interface Tutorial : JSONModel
@property (nonatomic, strong) NSString *name;
@property (nonatomic, strong) NSString *url;
@end
Then Object Feed:
#import "JSONModel.h"
#import "Tutorial.h"
@interface TutorialFeed : JSONModel
@property (nonatomic, strong) NSArray <Tutorial> *tutorials;
@end
and then in MasterViewController.m:
#import "MasterViewController.h"
#import "DetailViewController.h"
#import "TutorialFeed.h"
#import "JSONModelLib.h"
@interface MasterViewController () {
TutorialFeed *feed;
TutorialFeed *testFeed;
}
@end
@implementation MasterViewController
-(void)viewDidAppear:(BOOL)animated
{
feed = [[TutorialFeed alloc]
initFromURLWithString:@"http://api.matematikfessor.dk/apps/teacher_videos"
completion:^(JSONModel *model, JSONModelError *err) {
NSLog(@"Tutorials %@", feed.tutorials);
}];
}
@end
The problem is, I get returned nil in my log :( Im not sure why is this
happening, because I managed to fetch data from JSON from this URL: Kiwa
URL
All that done, following this tutorial
Im not sure what am I doing wrong. Does anybody has any clue ?

Wednesday, 18 September 2013

JMeter: An error occurred: java.lang.ExceptionInInitializerError

JMeter: An error occurred: java.lang.ExceptionInInitializerError

Trying to install Jmeter 2.9 on Mac osx , seeing following error
JMeter: An error occurred: java.lang.ExceptionInInitializerError
ANy help would be appreciated

Blackberry package-id of apk2bar generated package

Blackberry package-id of apk2bar generated package

We have a problem where we would like to distribute our blackberry app as
a new application - rather than an upgrade and the Blackberry portal is
saying that our current .bar file has the same package ID as another app.
The .bar file is created from an android app using apk2bar.
Looking at the package id in the .bar's manifest file it's obviously a
generated hash, and in trying to figure out where it comes from I found
this comment on twitter from @BlackBerryDev:
The package name and code signing key are both used to create the package ID.
(Source: https://twitter.com/ruvcan/status/327129884629553153)
My question is, what exactly is the code signing key - is that the
developer certificate, or is it based on the client-*.csj files in the
keystore, or both or something else?
What I need to know is what's the easiest way to get a new package ID
without changing the package id of the underlying Android app?
What I'd like to know is how the blackberry code signing works with a bit
more detail. I haven't been able to find a good explanation of how all the
bits (client-RDK.csj, client-PBDT.csj, developer certificate, key store,
blackberry ID, android package id, version numbers, portal packages,
applications vs upgrades etc...) all tie together.

iphone- App Crashes for No Reason

iphone- App Crashes for No Reason

Here is some background information. I originally developed this game for
the iPhone 3.1 software, but then edited the code to make it compatible
with newer software. My app is a space game.Basically, UIImageViews start
to spawn at the top of the screen and come down, and you have to move your
character (another UIImageview) out of the way. All of the code works
flawlessly on the simulator. It also generally works fine on the device.
However, just on the device, once every five or six times, halfway through
the game the volume shuts off (I have a fire button which not only spawns
a new uiimageview that moves accross the screen, but it also plays an
avaudio noise). When I click the fire button, no avaudio sound is made.
The rest of the game keeps running fine. Then, when I crash into a meteor,
the game crashes. I don't know where or what the problem is because the
game only has the sound turn off and then crash when you hit a meteor like
once out of every six times you play the game, and there is no problems at
all on the simulator, only on the device. If you need any additional
information or have any suggestions, please feel free to ask.
Here is my code for when you crash into a meteor (even if the problem is
here, it does not explain my avaudioplayer malfunctioning only when the
game is about to crash):
if (CGRectIntersectsRect(one.frame, image.frame) && ![meteorsToRemove
containsObject:one]) {
NSURL *url = [NSURL fileURLWithPath:[NSString
stringWithFormat:@"%@/shipExplosion.wav", [[NSBundle mainBundle]
resourcePath ]]];
NSError *error;
audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:url
error:&error];
audioPlayer.numberOfLoops = 0;
[audioPlayer play];
[error release];
background.image = [UIImage imageNamed:@"gameOver.png"];
fire.hidden = YES;
image.hidden=YES;
quit2.hidden=NO;
one.hidden=NO;
highscorePageButton.hidden=NO;
playAgain.hidden=NO;
image.center=CGPointMake(500,500);
secondsTotalCount.hidden=NO;
NSString *newText = [[NSString alloc] initWithFormat:@"You Lasted
%d Seconds", _totalSeconds];
secondsTotalCount.text = newText;
NSArray *paths =
NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSNumber *highscore = [[NSNumber alloc]
initWithInteger:_totalSeconds];
NSString *choice = [NSString stringWithFormat:@"%@/userschoice",
documentsDirectory];
NSMutableArray *array;
if ([[NSFileManager defaultManager] fileExistsAtPath:choice]) {
array = [NSMutableArray arrayWithContentsOfFile:choice];
}
else {
array = [[[NSMutableArray alloc] init]autorelease];
}
[array addObject:highscore];
[array writeToFile:choice atomically:YES];
[newText release];
}
Note: one is the name of a meteor, image is the name of your
character.MeteorsToRemove is an array of inactive meteors (that got shot
down by the character). Also, I save the score of the character in a text
file named choice.

How can I parse escaped XML with XML::LibXML

How can I parse escaped XML with XML::LibXML

So the responses are basically full XML documents escaped as a string
inside of another XML Document. What is the best way to extract this
String and Parse it into something I can simply get the values from.
(will accept simply how to get it back to raw XML)
<soap:Body>
<DoItUsernamePwdResponse xmlns="http://www.aspdotnetstorefront.com/">
<DoItUsernamePwdResult>&lt;?xml version="1.0"
encoding="utf-8"?&gt;&lt;AspDotNetStorefrontImportResult
Version="9.2" DateTime="9/18/2013 1:46:06 PM"&gt;&lt;Item
NodeType="Entity" Name="Nike"
GUID="84775261-731D-4E11-BB82-FA5F61BC61C5" ID="1" ActionTaken="Add"
Status="OK" Message=""
/&gt;&lt;/AspDotNetStorefrontImportResult&gt;</DoItUsernamePwdResult>
</DoItUsernamePwdResponse>
</soap:Body>

Cant define a Foreign Key in PHPMyAdmin

Cant define a Foreign Key in PHPMyAdmin

Setting up a database in PHPMyAdmin and i have two tables, Foo and Bar. I
want to use the Primary Key from Foo as a Foreign Key in Bar, but when i
go to the relational view it says "No index defined!". Any ideas why?
Also, if i set this up, does that mean that as an Foreign Key, Foo will
have its data auto imported and updated to Bar every time a new row is
added?

Need to select closest item on table

Need to select closest item on table

I need to hide the "lblItemPrice" div when I click the "btnEdit" button.I
need to get the closest div which having "lblItemPrice" class.
I have tried like this,But not working.
$('.btnEdit').die('click').live('click', function () {
$(this).closest('.lblItemPrice').hide();
});
HTML
<table class="invoice" id="invoiceList">
<tbody>
<tr class="">
<td class="value" id="pricetd">
<div id="itemPriceDiv">
<div class="lblItemPrice">
$2.00
</div>
<input type="text" id="editPrice" name="editPrice"
placeholder="edit price">
</div>
</td>
<td class="value">
$2.00
</td>
<td>
<button class="btnEdit actionButton secondaryButton short"
type="button">
Edit</button>
</td>
<td>
</td>
</tr>
</tbody>
</table>

JAXB Umarshaller error

JAXB Umarshaller error

I am trying to generate Object from XML using JAXB. First, I created the
objects out of supplied schema and packaged them into 1 .jar. Now I am
using this simple test program (after it refused to work with Jersey):
import org.editeur.ns.onix._3_0.reference.*;
public class Mapping {
public static void main(String[] args) {
System.out.println("Please enter the Onix message:");
BufferedReader reader = new BufferedReader(new
InputStreamReader(System.in));
try {
String request = reader.readLine();
request.trim();
StringReader stringReader = new StringReader(request);
JAXBContext context =
JAXBContext.newInstance("org.editeur.ns.onix._3_0.reference");
Unmarshaller unmarshaller = context.createUnmarshaller();
ONIXMessage message = (ONIXMessage)
unmarshaller.unmarshal(stringReader);
stringReader.close();
//System.out.println(message.getHeader().getSentDateTime());
//System.out.println(message.getHeader().getMessageNote().get(0).getValue());
} catch(Exception ex) {
ex.printStackTrace();
}
}
}
I use the following test XML-string (withouts spaces or line breaks):
<?xml version="1.0" encoding="UTF-8"?><ONIXMessage
release="3.0"><Header><Sender><SenderName>Global
Bookinfo</SenderName><ContactName>Jane King, +1 555 321
7654</ContactName><EmailAddress>jbk@globalbookinfo.com</EmailAddress></Sender><Addressee><AddresseeName>BooksBooksBooks.com</AddresseeName></Addressee><MessageNumber>231</MessageNumber><SentDateTime>20100510T1115-0400</SentDateTime><MessageNote>Sample
message</MessageNote></Header><Product><RecordReference>com.globalbookinfo.onix.01734529</RecordReference><NotificationType>03</NotificationType><RecordSourceType>04</RecordSourceType><RecordSourceIdentifier><RecordSourceIDType>06</RecordSourceIDType><IDValue>0614141800001</IDValue></RecordSourceIdentifier><RecordSourceName>Global
Bookinfo</RecordSourceName><ProductIdentifier><ProductIDType>03</ProductIDType><IDValue>9780007232833</IDValue></ProductIdentifier><ProductIdentifier><ProductIDType>15</ProductIDType><IDValue>9780007232833</IDValue></ProductIdentifier></Product></ONIXMessage>
But it gives me the same error:
javax.xml.bind.UnmarshalException: unexpected element (uri:"",
local:"ONIXMessage"). Expected elements are
<{http://ns.editeur.org/onix/3.0/reference}Addressee>,<{http://ns.editeur.org/onix/3.0/reference}AddresseeIDType>,<{http://ns.editeur.org/onix/3.0/reference}AddresseeIdentifier>,<{http://ns.editeur.org/onix/3.0/reference}AddresseeName>,<{http://ns.editeur.org/onix/3.0/reference}Affiliation>,<{http://ns.editeur.org/onix/3.0/reference}AgentIDType>,<{http://ns.editeur.org/onix/3.0/reference}AgentIdentifier>,<{http://ns.editeur.org/onix/3.0/reference}AgentName>,<{http://ns.editeur.org/onix/3.0/reference}AgentRole>,<{http://ns.editeur.org/onix/3.0/reference}AlternativeName>,<{http://ns.editeur.org/onix/3.0/reference}AncillaryContent>,<{http://ns.editeur.org/onix/3.0/reference}AncillaryContentDescription>,<{http://ns.editeur.org/onix/3.0/reference}AncillaryContentType>,<{http://ns.editeur.org/onix/3.0/reference}Audience>,<{http://ns.editeur.org/onix/3.0/reference}AudienceCode>
...
at
com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:648)
at
com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:236)
at
com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:231)
at
com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChildElement(Loader.java:105)
at
com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext$DefaultRootLoader.childElement(UnmarshallingContext.java:1051)
at
com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:484)
at
com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:465)
at
com.sun.xml.internal.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java:135)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:501)
at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:400)
at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(XMLNSDocumentScannerImpl.java:626)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3104)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:921)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:647)
at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
at
com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
at
com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:200)
at
com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:173)
at
javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:137)
at
javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:194)
at Mapping.main(Mapping.java:19)
When I was generating classes with XJC, no problems were detected. But
when parsing XML, it seems to ask for a correct element. But according to
the Schema, the first element (root) is ONIXMessage tag, which is there.
When I am using Jersey, it does not even show anything - just returns null
contents of ONIXMessage root tag.
What is wrong? How can I fix it? Any help appreciated.

Google Maps - "App won't run unless you update Google Play services"

Google Maps - "App won't run unless you update Google Play services"

I'm just trying to run the simple Google Maps tutorial here:
https://developers.google.com/maps/documentation/android/start
I'm running my app on my Nexus 4, and I receive the "update Google Play
services" message with an Update button. When I click the Update button,
it takes me to the Google Play services app on the Play Store, but it
appears that it's updated to the latest version.
Is there anything else I might be missing?
Android Manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.ridenotifier"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission
android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="16" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<uses-library android:name="com.google.android.maps" />
<activity
android:name="com.example.ridenotifier.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.example.ridenotifier.ContactListActivity"
android:label="@string/title_activity_contact_list" >
</activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyATNKboMr-94m9GUWOlLkEgApQW4uvh4Js"
/>
</application>
</manifest>

Tuesday, 17 September 2013

R- Display value with aggregate

R- Display value with aggregate

I have a dataframe in R with the following variables:
DateTime year dayYear diameter dendro
I want to calculate the min diameter for each day of the year for each
dendrometer, so I used aggregate:
dailymin <- aggregate(diameter~year+dayYear+dendro, FUN=min, data=myData)
However, I also need the time when the min diameter happened at each day
and dendro. Therefore, I need to keep the info contained in the variable
DateTime in the row of each min. Thanks for helping me.

How to query the element and other nodes of the XML through scanf inputs for searching? Using C console MSXML

How to query the element and other nodes of the XML through scanf inputs
for searching? Using C console MSXML

How to query the element and other nodes of the XML through scanf inputs
for searching? Using C++ console MSXML

Java making LinkedList from scratch [on hold]

Java making LinkedList from scratch [on hold]

I have a project due tomorrow for my class involving adts and really
haven't started yet.
I need to design a structure that looks like this (almost exactly as
displayed in the UML) does anyone know any reading/websites that are easy
to access and can get the point across. He gave us this assignment with
very little information on the subject. Basically it involves making a
linked list with an array

Executing VIM commands in a shell script

Executing VIM commands in a shell script

I am writing a bash script that runs a command line program (Gromacs),
saves the results, modifies the input files, and then loops through the
process again. I am trying to use VIM to modify the input text files, but
I have not been able to find a way to execute internal VIM commands like
:1234, w, x, dd, ect. from the .sh file after opening my input files in
VIM ("vim conf.gro").
Is there any practical way to execute VIM commands from the shell script?

Where are math.py and sys.py?

Where are math.py and sys.py?

I found all the other modules in Python33/Lib, but I can't find these. I'm
sure there are others "missing" too, but these are the only ones I've
noticed. They work just fine when I import them, I just can't find them. I
checked sys.path and they weren't anywhere in there. Are they built-in or
something?

Failure of image in middle of sequence to load

Failure of image in middle of sequence to load

I have a list of images in a database. Under user control, they are
selected one at a time. After sizing other elements on the screen
appropriately, the latest user selected image is displayed via a java
script function that resizes the page and loads the image via
document.getElementById("prodSlideShowImage").src =svi;
where prodSlideShowImage is the same div for all images and svi is the
relative location on the disk of the current image. All the data
associated with the image is displayed properly on the page but not the
image. I have been in Firebug and determined that all the data base image
name and ancillary data were appropriately downloaded after the ajax call.
There are ten images in my test data base. They all work except for the
fourth and the ninth. I have checked the directory on the web server to be
sure they are there and are the same size as the ones on my localhost
(XAMPP with Windows7). (This code runs correctly on my local server).
User interface timing does not seem to be a problems. I have tried varying
speeds and always get the same result.
I could really use any suggestions that someone might make.
Thanks in advance for your help.
Ann Maybury ann.maybury@gmail.com

Sunday, 15 September 2013

TDS SQL Querying: Asynchronous Approach

TDS SQL Querying: Asynchronous Approach

I'm using: Node.js, MS-SQL, tedious TDS implementation for Node.js
Essentially, I have an array of items. I need to lookup each item in an
SQL-based database via TDS protocol and
Extract column data for each item
Identify items which arn't found in the database
The problem is that the queries are asynchronous in the sense that I need
to wait for the response of a query before sending the next one. So my
options are:
Wait. Wait for each query-response for each item in the array to execute
back-to-back.
Do something like SELECT <cols> FROM <table> WHERE <key> IN <the array> to
do a single query, then leave it up to me to efficiently try to match
items in my array to returned rows
Something better?
Thoughts? Ideally I'd like an asynchronous solution where I can send off a
query for each item in the array at the same time, process separate
request as they come in, and continue once all request-response pairs are
completed.

Android pause async task after network lost

Android pause async task after network lost

I am using an AsyncTask where I download images using HttpUrlConnection.Im
using a BroacastReciever to listen to connectivity changes. I want to know
how I can pause it when network is lost and continue it after regaining
the connectivity. It would be helpful if anyone can provide some
snippet/code.
Thank you.

Cahnge default style of MS Access elements

Cahnge default style of MS Access elements

When I add any element (control like text box, label etc) to my form, it
has default style as:
Font: Calibri (Detail) Font Size: 11 Fore Color: Text 2, Lighter 40%
How is it possible to change that, I need MS Sans Serif, 8, Black for
default.
Thanks!

jquery - On Paste, Getting input value not working

jquery - On Paste, Getting input value not working

I have been trying to get the value of an input of paste, but it always
returns nothing:
$('form#post-game :input[name="header"]').keyup(function(){
var str = $(this).val();
IsImageValid(str, "#post-game-img-header");
});
$(document).on('paste','form#post-game :input[name="header"]',function(e) {
var str = $('form#post-game :input[name="header"]').val();
IsImageValid(str, "#post-game-img-header"); // there is a console log
in this function
});
The keyup works fine, But the paste does not.

Saving Expression Tree to a File

Saving Expression Tree to a File

I want to debug an expression and save the expression tree to a file:
var generator = DebugInfoGenerator.CreatePdbGenerator();
var document = Expression.SymbolDocument(fileName: "MyDebug.txt");
var debugInfo = Expression.DebugInfo(document, 6, 9, 6, 22);
var expressionBlock = Expression.Block(debugInfo, fooExpression);
var lambda = Expression.Lambda(expressionBlock, parameters);
lambda.CompileToMethod(method, generator);
var bakedType = type.CreateType();
return (type)bakedType.GetMethod(method.Name).Invoke(null, parameters);
How can I find or save "MyDebug.txt"?

angularjs custom directives value change

angularjs custom directives value change

I have the following code (it does not work on jsfiddle but it does if you
save it as index.html)
<!DOCTYPE html>
<html ng-app="app">
<head>
<script type="text/javascript"
src="http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.5/angular.min.js"></script>
<script>
var photos = [
{"url":"http://archive.vetknowledge.com/files/images/guinea-pig---tan.jpg"},
{"url":"http://www.rfadventures.com/images/Animals/Mammals/guinea%20pig.jpg"}
];
angular.module('app', [])
.directive('ngBackground', function(){
return function(scope, element, attrs){
var url = attrs.ngBackground;
element.css({
'background-image': 'url(' + url + ')',
'background-size' : 'cover'
});
};
})
.controller('PhotosCtrl', function($scope){
$scope.photos = photos;
$scope.flags = {
modalOpen: false,
imgSrc: null
};
$scope.doModal = function(url){
if(url != false) {
$scope.flags.imgSrc = url;
$scope.flags.modalOpen = true;
} else $scope.flags.modalOpen = false;
};
$scope.sourcifier = function(url){
var temp = document.createElement('a');
temp.href = url;
if(temp.hostname.substring(0, 4) == 'www.')
return temp.hostname.substring(4);
else return temp.hostname;
};
});
</script>
</head>
<body>
<div ng-controller="PhotosCtrl">
<div ng-repeat="photo in photos" class="item">
<img ng-src="{{photo.url}}" ng-click="doModal(photo.url)">
<p><a ng-href="{{photo.url}}"
target="_blank">{{sourcifier(photo.url)}}</a></p>
</div>
<div ng-show="flags.modalOpen" ng-click="doModal(false)">
<div ng-background="{{flags.imgSrc}}">my background should be of
the clicked image</div>
</div>
</div>
</body>
</html>
That basically loads the images form the array "photos" and displays them.
What I am trying to achieve is to use a custom created ng-background
directive to change the background image of a div to the clicked image
src.
It does not work at all! Now, I amsure that flags.imgSrc is correct, since
if I use ng-src on an img tag, it does work. It seems more like that the
custom directive ng-background does not "refresh" the value of that flag.
Any ideas why and how this could be fixed? Thanks in advance.

Switching two activities

Switching two activities

I am new to Android apps development. I have a question on switching two
activities. I followed a youtube for switching two activities:
http://www.youtube.com/watch?v=0wz0bM-xy3M
But when I enter those code as shown in the bottom for my next class
NextActivity.java,
I noticed that I have three mistakes.......
protected void onCreate(Bundle savedInstanceState) - The method
onCreate(Bundle) of type NextActivity must override or implement a
supertype method
super.onCreate(savedInstanceState)-The method onCreate() in the type
Application is not applicable for the arguments (Bundle)
setContentView(R.layout.next) - The method setContentView(int) is
undefined for the type NextActivity
What's mistakes do I make? Thanks a lot!
package gorilla3d.activitytutorial;
import android.app.Application;
import android.os.Bundle;
public class NextActivity extends Application {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.next);
}
}

Saturday, 14 September 2013

Need part of my content moving left

Need part of my content moving left

once selected which type of bet they have done, then number of winners,
the actual calculator is center of the screen.
I need this shifting slightly to the left to it is more in line with the
buttons themselves.
http://freebetoffersonline.com/bet-calc.php

Save cropped area as image

Save cropped area as image

I have code that allows me to obtain four coordinates:
initial_x initial_y final_x final_y
This coords form a rectangle which allows to crop the body of a website
(all the area within the rectangle). My question is how can you save this
cropped area as a file (export it to the machine likewise .jpeg for
example) or just allocate memory from the browser to perform this task
temporarily? This runs on javascript html and css

How programming block in java?

How programming block in java?

I try copy data from file to file but each 32 bytes for one translate also
the copy shuld be integer number translate like the following
byte[] block = new byte[32];
FileInputStream fis = new FileInputStream(clearmsg);
FileOutputStream fcs = new FileOutputStream(ciphermsg);
int i;
while ((i = fis.read(block)) != -1) {
BigInteger M2 = new BigInteger(block);
byte[] block2=new byte[32] ;
block2 = M2.toString().getBytes();
fos.write(block2, 0, i);
}
fos.close();
but when run this part and take M2.bitLength() it give me 255 bits Why any
suggest

Qt: QMenu does not work on Linux

Qt: QMenu does not work on Linux

I have added a QMenu to QMainWindow like this:
boost::scoped_ptr<QMenu> file_menu;
file_menu.reset(menuBar()->addMenu("&File"));
file_menu->addAction(my_action1.get());
file_menu->addAction(my_action2.get());
...
And it works perfectly on Windows but not on Linux. The "File" menu
appears on the window but nothing happens if I click it.
The Qt version is 4.7.3 and I use Ubuntu 11.04 via VirtualBox 4.1.2.

Create Case in MS CRM 2011 from post on Facebook page

Create Case in MS CRM 2011 from post on Facebook page

Goal: Create case from post on facebook page
Is it possible to create records in CRM when people post on facebook page ?

Using the move method part of the Point-Java

Using the move method part of the Point-Java

So I am using the move method part of the Point. I was wonder how I would
move the point with out changing the angle or the length. Could I get
examples of how I would do this.

Friday, 13 September 2013

Get max and min of object values from JavaScript array

Get max and min of object values from JavaScript array

What is the best way to get the maximum and minimum values from a
JavaScript array of objects?
Given:
var a = [{x:1,y:0},{x:-1,y:10},{x:12,y:20},{x:61,y:10}];
var minX = Infinity, maxX = -Infinity;
for( var x in a ){
if( minX > a[x].x )
minX = a[x].x;
if( minX < a[x].x )
maxX = a[x].x;
}
Seems a bit clumsy. Is there a more elegant way, perhaps using dojo?

MySQL WRITE hangs on spring hibernate application

MySQL WRITE hangs on spring hibernate application

not sure where to start in my research.
Recently I have moved my hard drives to a new server. My old server used
to be one core just 4GB RAM. Now I am running 8 cores 32GB RAM. MySQL
version 5.0.77. I have SPring Hibernate setup. Here is a configuration
file
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
primary="true">
<property name="driverClass" value="com.mysql.jdbc.Driver"/>
<property name="jdbcUrl" value="jdbc:mysql://host:port"/>
<property name="user" value="xxx"/>
<property name="password" value="xxx"/>
<property name="minPoolSize" value="2"/>
<property name="maxPoolSize" value="50"/>
<property name="maxIdleTime" value="3600"/>
<property name="maxStatements" value="500"/>
<property name="automaticTestTable" value="pool_test"/>
<property name="idleConnectionTestPeriod" value="120"/>
So everything seems to be fine, however recently I started to get strange
issue. When I login into the website, its all working, but when I try to
SAVE stuff it hangs. I am looking at the Java Melody monitoring and it
shows me lots of hanged current requests. Looking at the my sql
connections, all of them are SLEEP.
Can it be maybe the MySQL server has to be update? THis is never happened
before on the old server. Any clue where I can start looking ? Thanks in a
advance

iPython Notebook does not appear after upgrading to 1.0/1.1

iPython Notebook does not appear after upgrading to 1.0/1.1

iPython notebook worked fine with python(x,y) installation which includes
ipython 0.13.2-2. After upgrading to 1.0 and now 1.1, the notebook opens a
blank page in the browser with backend messages like the following:
2013-09-13 18:10:04.236 [tornado.access] WARNING | 404 GET
/static/components/jq uery-ui/themes/smoothness/jquery-ui.min.css
(127.0.0.1) 0.00ms WARNING:tornado.access:404 GET
/static/components/jquery-ui/themes/smoothness/jq uery-ui.min.css
(127.0.0.1) 0.00ms 2013-09-13 18:10:04.236 [tornado.access] WARNING | 404
GET /static/components/re quirejs/require.js (127.0.0.1) 0.00ms
WARNING:tornado.access:404 GET /static/components/requirejs/require.js
(127.0.0. 1) 0.00ms 2013-09-13 18:10:04.252 [tornado.access] WARNING | 404
GET /static/components/jq uery-ui/ui/minified/jquery-ui.min.js (127.0.0.1)
0.00ms WARNING:tornado.access:404 GET
/static/components/jquery-ui/ui/minified/jquery-u i.min.js (127.0.0.1)
0.00ms 2013-09-13 18:10:04.252 [tornado.access] WARNING | 404 GET
/static/components/bo otstrap/bootstrap/js/bootstrap.min.js (127.0.0.1)
0.00ms ...
I first tried to install from a local git repository for python 1.0 that I
copied over. Because this is a corporate machine, I am somewhat strapped
on installation flexibility. I came back to the issue when 1.1 was
released and attempted to install from the 1.1 zip for windows. Same
result in both cases.
What do these message imply?

PHP password_hash() maximum password length?

PHP password_hash() maximum password length?

What is the maximum password length I can use with PHP 5.5 password_hash() ?

i just need a div to be shown when on submit of form errors arise just like yahoo login

i just need a div to be shown when on submit of form errors arise just
like yahoo login

i want the to be displayed when i didnt find any record in the databaase
<div id="error">Record not found in the database</div>
<form action="login.php" method="get">
<div id="block">
<label id="user" for="name">p</label>
<input type="text" name="username" id="name"
placeholder="Username" required/>
<label id="pass" for="password">k</label>
<input type="password" name="password" id="password"
placeholder="Password" required />
<input type="submit" id="submit" name="submit" value="a"/>
</div>
</form>`enter code here`

Regex to match MAC address and also extract it's values

Regex to match MAC address and also extract it's values

I'm trying to first check if a string confirms the format of a MAC
address, and if it does I would like to extract all the byte values out of
the string.
So far I wrote this, and it successfully matches if the format of a mac
address is correct or not:
mac_regx = re.compile(r'^([0-9A-F]{1,2})(\:[0-9A-F]{1,2}){5}$',
re.IGNORECASE)
But when I use this regex to extract the byte values, I'm only getting the
first and the last one:
(Pdb) print(mac_regx.findall('aa:bb:cc:dd:ee:ff'))
[('aa', ':ff')]
I know I could simply split by : and that would do the job. I was just
hoping to be able to do both, the matching and value extraction, in only
one step with one regex.

html special symbols is displayed as characters

html special symbols is displayed as characters

I've been trying to set content of a text input dynamically using JS, the
problem I encountered is I can not have the browser render the special
symbols rather than chars so for example
document.getElementById("textField").value = "nbsp";
Instead of displaying a space it displays &nbsp, anybody got any idea?
Thanks a lot

Thursday, 12 September 2013

smtp Error in code igniter

smtp Error in code igniter

I am trying to send a password reset link to user using the smtp in
codeigniter with following configurations
$config = Array('protocol' => 'smtp',
'smtp_host' => 'my-host',
'smtp_user' => 'user',
'smtp_port' =>25,
'smtp_pass' => '********',
'_smtp_auth'=>TRUE,
'mailtype' => 'text',
'charset'=> 'iso-8859-1'
);
$this->load->library('email',$config);
$this->email->to($address);
$this->email->from($from);
$this->email->subject($subject);
$this->email->message($message);
$res=$this->email->send();
echo $this->email->print_debugger();
but following error are print by debugger.I am not getting what the actual
problem is.
220-vps.hostjinniwebhosting.com ESMTP Exim 4.80.1 #2 Fri, 13 Sep 2013
09:48:37 +0530
220-We do not authorize the use of this system to transport unsolicited,
220 and/or bulk e-mail.
<br /><pre>hello: 250-vps.hostjinniwebhosting.com Hello tv100.info
[66.225.213.151]
250-SIZE 52428800
250-8BITMIME
250-PIPELINING
250-AUTH PLAIN LOGIN
250-STARTTLS
250 HELP
</pre><pre>from: 250 OK
</pre><pre>to: 501 <>: missing or malformed local part
</pre>The following SMTP error was encountered: 501 <>: missing or
malformed local part
<br /><pre>data: 503-All RCPT commands were rejected with this error:
503-501 <>: missing or malformed local part
503 Valid RCPT command must precede DATA
</pre>The following SMTP error was encountered: 503-All RCPT commands were
rejected with this error:
503-501 <>: missing or malformed local part
503 Valid RCPT command must precede DATA
<br />500 unrecognized command
<br />The following SMTP error was encountered: 500 unrecognized command
<br />Unable to send email using PHP SMTP. Your server might not be
configured to send mail using this method.<br /><pre>User-Agent:
CodeIgniter
Date: Thu, 12 Sep 2013 23:18:37 -0500
From: &lt;tv100@tv100.com&gt;
Return-Path: &lt;tv100@tv100.com&gt;
Subject: =?iso-8859-1?Q?Reset_your_password?=
Reply-To: &quot;tv100@tv100.com&quot; &lt;tv100@tv100.com&gt;
X-Sender: tv100@tv100.com
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: &lt;5232921db117e@tv100.com&gt;
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
please someone tell me whats wrong with this...

getting values from column in database

getting values from column in database

I am getting values from the column "threadid" in the database.Problem is
that it gets the value from the previous record/row. and when I try to get
the first record my app crashes,, How to tackle this problem and whats the
issue?
long id;
long threadid = datasource.getthreadid(id);
Toast.makeText(getActivity(), String.valueOf(threadid),
Toast.LENGTH_SHORT).show();
public long getthreadid(long id)
{
String ide=String.valueOf(id);
String queryz = "SELECT " + MySQLiteHelper.COLUMN_THREADID
+ " FROM " + MySQLiteHelper.TABLE_NAME
+ " WHERE " + MySQLiteHelper.COLUMN_ID + "=" + ide;
Cursor cursor = database.rawQuery(queryz, null);
cursor.moveToFirst();
// cursor.moveToPosition(Integer.parseInt(String.valueOf(id)));
long threadid= cursor.getLong(cursor.getColumnIndex("threadid"));
cursor.close();
return threadid;
}

Royal Slider Different Color Thumbnails

Royal Slider Different Color Thumbnails

I am trying to change the color of each thumbnail below the slider on the
wordpress royal slider plugin. At the moment they are all the same color.
Here is my HTML markup
<div class="rsTmb">
{{html}}
</div>
And here is the html code from each off my slides
<a class="rsImg" href="imageurl.png" data-
rsVideo="videorul">title goes here</a>
<div class="rsTmb" style="background:#108FD2">title goes here</div>
Can someone help me have set it up so that i have individual colors for
each off the tabs

Firefox 3D transforms and z-index

Firefox 3D transforms and z-index

I created flipping cards that based on CSS transitions and transforms, but
it has a few rendering glitches in various browsers when card is flipping.
Live example
In Firefox the top card which is animates overlaps by the under cards.
In Chrome the card is flickering when animates.
backface-visibility:hidden and transform-style:preserve-3d are specified,
and everything else seems to be okay.
Maybe there's some other CSS/JS hack?
Thanks

How to change the text color of a fadeIn div?

How to change the text color of a fadeIn div?

I have the following working script that run on load.
$("div.fadeinWrapper").fadeIn(3000);
When the fadeIn is completed, I want to use animate function to change the
color of a span inside the div, from #000000 to #FF0000. How I do that?

SIP client register periodically with server

SIP client register periodically with server

I have written a SIP client with a SIP SDK that you can get online.
Classic SIP stuff: you register with SIP server, make calls, get called
... This works all fine, but suppose that the SIP server restarts or for
some other reason loses the registration of your SIP client. Now other
clients can't call you because you are not found on the SIP server.
How is this handled? Do you periodically send another register message
even if you're registered? Every 10 minutes or something like that? Do you
first unregister then (which means for some time in between you're not
reachable, would not be good) and then register or can you call register
when you're already registered without problems?
I've also found register/options keep-alive messaging, but I'm not sure
what its purpose is, can it handle this scenario where the sip server no
longer has your registration? Is it always supported by the sip-servers?

Wednesday, 11 September 2013

Cross Browser issue for ajax file upload

Cross Browser issue for ajax file upload

Here is my jquery method:
function upload_profile_picture() {
$('#profile_image_upload').click();
var fileInput = $('#profile_image_upload');
var fileData = fileInput.prop("files")[0];
var formData = new window.FormData();
formData.append("file", fileData);
var imagePath = '';
$.ajax({
url: '/ImageHandler.ashx',
data: formData,
processData: false,
contentType: false,
type: 'POST',
success: function (data) {
var obj = $.parseJSON(data);
if (obj.StatusCode == "OK") {
imagePath = obj.Path;
log(imagePath);
$('#profile_image').attr('src', '/img/profile/' + imagePath);
} else if (obj.StatusCode == "ERROR") {
log("Unsuccesful profile picture upload. Message: " +
obj.Message);
}
},
error: function (errorData) {
log("Unsuccesful profile picture upload. " + errorData);
}
});
}
When user clicks on an image, I'm calling the javascript function above.
But it behaves different in Internet Explorer and Chrome (latest
versions). In Internet Explorer when the following line executed:
$('#profile_image_upload').click();
the following hidden input opens the dialog to choose the file to upload.
<input id="profile_image_upload" class="hidden" type="file">
and the rest of the function is not being executed until user selects a
file or cancels the dialog.
Inversely in chrome, I see that the lines after the first one are being
executed before users selects the file.
What do I have to do to fix this?
Thanks in advance,

Regex: characters following a slash and ending before a hyphen

Regex: characters following a slash and ending before a hyphen

I've been playing around with regex for a bit and regex visualizations,
but have had no luck in generating something that will match a section of
a url that is text of variable length preceeded by a forward slash and
terminated by a hyphen. What expression would do this?
www.lamp.com/;alskfjdlkfja;sdlkfjasldfj-209
but not
www.lamp.com/a;slkfja;sdlkfjas;dflkj
because that doesn't contain a hyphen

BasePage in ASP.Net

BasePage in ASP.Net

i want to create a base class page that has all the scripts, link, and
icon in it and i have this so far
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace VGD.Client
{
public class BasePage : Page
{
public new string Title { get; set; }
protected override void FrameworkInitialize()
{
Controls.Add(ParseControl("<!DOCTYPE html>"));
Controls.Add(ParseControl("<html lang='en'>"));
Controls.Add(ParseControl(head()));
Controls.Add(ParseControl(upperBody()));
base.FrameworkInitialize();
}
protected override void OnPreRender(EventArgs e)
{
Controls.Add(ParseControl(lowerBody()));
base.OnPreRender(e);
}
private string head()
{
string _retVal = @"<head id='Head1' runat='server'>
<title>" + Title + @"</title>
</head>";
return _retVal;
}
private string upperBody()
{
string _retVal = @"<body>
<form runat='server'>";
return _retVal;
}
private string lowerBody()
{
string _retVal = @"</form>
</body>
</html>";
return _retVal;
}
}
}
but upon the initialize, it throws an error that Unexpected end of file
looking for </form> tag.
i separated the upperBody() and lowerBody() so that the content of
Home.aspx will be added in between the upperBody() and lowerBody() upon
creating the page.
any help please.

Wordpress: Can I trigger the previews autosave?

Wordpress: Can I trigger the previews autosave?

I guess a fairly straight forward question:
For my current assignment, I had to hijack wordpress's preview button (on
the edit post page). That I resolved and have my code working. The problem
is, to keep wordpress from popping up its newview window, I had to
interrupt all the javascript originally hooked to the preview button.
Of course, this also means when the preview button is pushed now, autosave
isn't triggering. I'd like for the save to still happen so the preview
shows the latest data. Any advice? I can copy my code in to help sort it
out.