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!