www.nuneworld.net Sign for quality web surfing.

March 23, 2017

Javascript url

Filed under: Software — sage @ 3:50 pm
alert("Url  ="+document.location);
alert("PathName  ="+ window.location.pathname);// Returns path only
alert("url  ="+window.location.href);// Returns full URL

Javascript to loacal time zone, and display PM AM

Filed under: Software — sage @ 1:57 pm

var d = new Date(datum);
d.toLocaleString([], { hour12: true });

 

http://stackoverflow.com/questions/17003202/how-to-get-am-or-pm

January 16, 2017

E0009 dx control

Filed under: Software — Tags: , — sage @ 12:38 am

Occurs when a component is not initialized for this element. Than you should use time out:

example:

var sbVersion = null;
setTimeout(function () {
sbVersion = $(“#ddVersion”).dxSelectBox(“instance”);
sbVersion.option(‘value’, $scope.copylicSet.VersionId);
// rbRed.repaint();
}, 300);

December 26, 2016

System.IdentityModel.Tokens.Jwt error

Filed under: Software — sage @ 3:41 pm

Could not load type ‘System.IdentityModel.Tokens.TokenValidationParameters’ from assembly ‘System.IdentityModel.Tokens.Jwt, Version=5.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’.

It seems that the version 5 System.IdentityModel.OpenIdConnect.dll is not compatible with the other libraries. I updated to the previous version using these commands and was able to get it to run:

Uninstall-Package System.IdentityModel.Tokens.Jwt –Force

Install-Package System.IdentityModel.Tokens.Jwt -Version 4.0.3.308261200

December 7, 2016

Random number in Sql

Filed under: Software — Tags: , , , — sage @ 2:28 pm

Repetitive calls of RAND() with the same seed value return the same results, but if you use this line of code you will get your random number this will bi from 1 to 88
select FLOOR( RAND(CHECKSUM(NEWID()) ) *(88-1)+1)

December 5, 2016

How can I get the baseurl of site mvc c#?

Filed under: Software — sage @ 11:09 am


Request.Url.OriginalString.Replace(Request.Url.PathAndQuery, "") + Request.ApplicationPath;

  1. Request.Url.OriginalString: return the complete path same as browser showing.
  2. Request.Url.PathAndQuery: return the (complete path) - (domain name + PORT).
  3. Request.ApplicationPath: return "/" on hosted server and "application name" on local IIS deploy.

So if you want to access your domain name do consider to include the application name in case of:

IIS deployment
If your application deployed on the sub-domain.

December 2, 2016

dxDataGrid – Set word wrap per column

Filed under: Software — sage @ 3:24 pm

Set in your css file

.word-wrap {
    white-space: normal;
}

and in your grid colum add

...
                                                     columns: [
                                                         {
                                                             dataField: 'bla bla',
                                                             alignment: 'left',
                                                             caption: 'bla Bli',
                                                             cssClass: 'word-wrap'    
                                                         },

November 22, 2016

dxDataGrid – add number box to grid

Filed under: Software — sage @ 3:22 pm


{
dataField: 'Qty',
alignment: 'left',
caption: 'Qty',
allowEditing: false,
cellTemplate: function(container, options) {
$('

')
.dxNumberBox({
"max": 10,
"min": 1,
"mode": "number",
"showSpinButtons": true
})
.appendTo(container);
}
}

or for more simple use:

{
dataField: 'Qty',
caption: 'Qty',
dataType: 'number',

editorOptions: {
min: 1,
max:10,
showSpinButtons: true
},
validationRules: [{ type: 'required' }, { type: 'numeric' }]
}

dxDataGrid – Formatting date, multiline

Filed under: Software — sage @ 10:18 am
columns: [...
    {
        dataField: 'dateField',
        dataType: 'date'
        format = 'dd/MM/yyyy'
    },
    ...
]

or

columns: [...
    {
        dataField: 'currencyField',
        dataType: 'number',
        customizeText: function(options) {
            if(options.value !== 0) {
                return options.valueText;
           }
       }
    },
    ...
]
]

example for multiline:

                {
                    dataField: 'Created', 
                    alignment: 'center',
                    caption: ' Time uploaded',
                    dataType: 'date',
                    format: 'shortDateShortTime',
                    width: 110,  

//  in    customizeText    you canot do multiline so use cell template as below
                    customizeText: function(options) {
                        if (options.value !== 0) {
                            var parts = options.valueText.split(',');
                            return parts[0] + '\r (' + parts[1].trim() + ')';
                        }
                    }


                    cellTemplate: function (container, options) {

                            if (options.value !== 0) {
                                var parts = options.text.split(',');
                                var test= parts[0] + '
(' + parts[1].trim() + ')'; } $('' + test + '') .appendTo(container); } }, ...

more info

November 17, 2016

Microsoft SQL Server Error: 18456 when trying to connect to with SQL Server Authentication

Filed under: Software — sage @ 4:46 am

if you’re trying to connect using “SQL Server Authentication” then you may want to modify your server authentication ;

Within the Microsoft SQL Server Management Studio in the object explorer:

  • Right click server and click properties
  • go to security page
  • under Server authentication, choose the SQL Server and Windows Authentication mode radio button
  • click OK
  • restart your server

this might help you !

October 27, 2016

dxDataGrid – A row color that is set onRowPrepared

Filed under: Software — sage @ 10:35 am
$("#container").dxDataGrid({
   dataSource: generateData(5),
           columnFixing: {
               enabled: true
           },
           editing: {
               editEnabled: false,
               editMode: 'batch',
               insertEnabled: false,
               removeEnabled: true
           },
            onRowPrepared: function (e) {
                if (e.rowType === "data") {
                      // if row data isDeleted is true than  color of the text will be red
                    if (e.data.IsDeleted === true) {
                           // if you want to change text color
                        e.rowElement.css('color', 'red');
                             // if you like to change cell color
                         e.rowElement.css('background', '#E5F7FF');
                    }
                }
            }
});

June 7, 2016

How to reload or re-render the entire page using AngularJS

Filed under: Software — sage @ 11:38 am

For the record, to force angular to re-render the current page, you can use:

$route.reload();

$route.reload() will reinitialise the controllers but not the services. If you want to reset the whole state of your application you can use:

$window.location.reload();

May 21, 2016

Jar mismatch and found 2 versions of android-support-v4.jar error?

Filed under: Mobile — Tags: , , — sage @ 11:25 pm
  1. Right Click the project
  2. Go To “Android Tools” > “Add Support Library”
  3. Approve the permissions and let it update the library
  4. Repeat this process for the project App Library
  5. Clean  project

March 29, 2016

The transaction log for database is full due to LOG_BACKUP

Filed under: Software — sage @ 8:26 am

Solution

You can truncate the transaction log file size using below SQL command sequence in SQL 2012.
Login in database server.
Select the database
Click on new query
Execute following SQL commands (replace the ‘databasename’ with your database name at all places in below commands.

ALTER DATABASE [databasename] SET RECOVERY SIMPLE
GO
DBCC SHRINKFILE ([databasename_Log], 5)
GO
ALTER DATABASE [databasename] SET RECOVERY FULL
GO

March 18, 2016

ROBOCOPY network UserName/Password

Filed under: Software — sage @ 8:55 am

If you need to copy something using robocopy to remote host where additional authentication is required you should send username/password somehow. Robocopy.exe does not provide network authentication by itself. So to provide username and password for robocopy.exe we can use NET USE to open IPC$ share to destination host and execute our robocopy code.
Note: There is UNC path used, so keep in mind to have source and destination folders shared.


NET USE \\RemoteServerName\IPC$ /u:server\user *password*
robocopy \\Source\ \\RemoteServerName\DestinationDir\ /XD * /Z /MIR /LOG+:c:\temp\log.log
NET USE \\RemoteServerName\IPC$ /D

Older Posts »

Powered by WordPress