Rankspike

RSS
May
06

How to create custom textbox in AngularJS and wire it with Jquery

So this week, I was task to do a project that requires dynamic input. How do you approach something like this in AngularJS was my question. Now I can use a lot of formatters from AngularJS but I decided to go the easy route, no complication.

So here’s an easy way to create input type=’text’ the Jquery way, then I call the scope (controller) from jquery let’s say $scope.MyFunction. Here’s how it’s done.

First inside your AngularJS once a button is clicked from your html (or cshtml):

on ¬†my html a simple <div id=’myTextBox’></div>

$scope.OnclickCreateTextBox = function (operation,id) {
alert(operation);
//edit or delete resolution
if (operation == 'UPDATE')
{
$('#myTextBox' + id).html('<input type="text" style="width:300px;" id="txtNew1" value="' +
name + '"><i class="glyphicon glyphicon-check" style="color:green" onclick="EditDeleteResolution('+id+')"></i>');
//newTextBoxDiv.appendTo("#TextBoxesGroup");
}
};//on jquery wire it like so:
function EditDeleteResolution(parm1) {
angular.element(document.getElementById('resTextBox' + parm1)).scope().myFunction(parm1);
}

There it is, if you have any question post them below.

 May 6th, 2016  
 Gil Tabasa  
 Angular JS  
 , , ,   
 0 Comment
Sep
01

How to stop a hung service (starting or stopping) status

Sometimes us developer deals with server every now and then, although we are supported by Admin, there will be times that we have to do it on our own.

Here’s a simple way to stop or kill a hung service. When your service status is “stopping” or “starting” you can kill it using following simple command.

On command window : type

> sc queryex servicename

the reason is you want to get the PID to be able to kill it. Sometimes this doesn’t especially if the service name has spaces for instance “My App Service Prod” in that case use the following command to view them.

On command window: type

>tasklist /svc – this is a powershell command that would list or services with corresponding PID.

Once you’ve achieved the PID, here’s the command to kill it.

On command window: type

> taskkill /f /pid [servicepid]

This will force kill the hung service.

This article is brought to you by : First Brand Media LLC

 

 

Mar
30

How to check table size in SQL

Sometimes when you’re having an issue with database timing out or slowdown, it’s always worth to check and investigate the abnormal growth of the table size in your database. Here’s a simple script that may do just that.

USE YourDB
 
SELECT 
    t.NAME AS NameOfTable,
    s.Name AS NameOfSchema,
    p.rows AS RowCounts,
    SUM(a.total_pages) * 8 AS TotalSpaceKB, 
    SUM(a.used_pages) * 8 AS UsedSpaceKB, 
    (SUM(a.total_pages) - SUM(a.used_pages)) * 8 AS UnusedSpaceKB
FROM 
    sys.TABLES t
INNER JOIN      
    sys.indexes i ON t.OBJECT_ID = i.object_id
INNER JOIN 
    sys.partitions p ON i.object_id = p.OBJECT_ID AND i.index_id = p.index_id
INNER JOIN 
    sys.allocation_units a ON p.partition_id = a.container_id
LEFT OUTER JOIN 
    sys.schemas s ON t.schema_id = s.schema_id
WHERE 
    t.NAME NOT LIKE 'dt%' 
    AND t.is_ms_shipped = 0
    AND i.OBJECT_ID > 255 
GROUP BY 
    t.Name, s.Name, p.Rows
ORDER BY 
    t.Name

 

Hope this helps someone who is currently investigating issues related to the Database.

 

This article is brought to you by: First Brand Media LLC

 March 30th, 2015  
 Gil Tabasa  
 SEO  
   
 0 Comment