Sunday, 29 April 2012

IIS - Can't view site from another PC

In Windows7 ensure you turn off firewall rule on the hosting computer. Check your "inbound rules" > World Wide Web Services (HTTP Traffic-In), this is on port 80. If you specify your site to run on another port you'll need to adjust your firewall accordingly.

Wednesday, 4 April 2012

Illustrator - missing save as dialog

Illustrator save as dialog box disappears off-screen:

The fix, you'll need to move the dialog back by using your keyboard.

Hold down Alt+Space, then hit enter, which selects the move option.
Use your keyboard cursor to move the dialog back to desktop.

Illustrator - Automate export of objects to PNG files

Automate export of illustrator objects to individual PNG files.

Save the following script into a new js file.
Open you illustrator file, then goto File > Scripts > Other Scripts or hit F12


var msg =""
if(app.documents.length > 0)
{
var pgItems = app.activeDocument.pageItems;
tot_obj=pgItems.length ;
alert("Total Object are " + tot_obj);
if( pgItems.length > 0 )
{
  var msg = "Items are ";

  for( var i =0; i
  {
 
   pgItems[i].hidden =true;
   //msg   = pgItems[i].visible
  }
for( var i =0; i
  {
   pgItems[i].hidden =false;
   var exportOptions = new ExportOptionsPNG24();
   var type = ExportType.PNG24;
   var fileSpec = new File(i+"sample.png");
   exportOptions.antiAliasing = false;
   exportOptions.transparency = true;
   exportOptions.saveAsHTML = false;
   app.activeDocument.exportFile( fileSpec, type, exportOptions );
   pgItems[i].hidden =true;

  }
}
else
{
  msg = "No document Open";
}
alert(msg);
}

Tuesday, 21 February 2012

SharePoint: How to programmatically submit your form to document library?

How to programmatically submit your form to document library?
First create a new data connection in Infotpath 2010 as a Submit and To a Document Library on a SharePoint site. Don't't worry in entering any SharePoint Server's url and destination document library, because this values can be overridden in code. Once you have created the new Data Connection, name it as SharePoint Library Submit.
infopath2
Now add a simple button, and in the buttons propery windows select Action= Submit, press Submit Options and check Perform Custom action using  Code and finally press Edit Code.
infopath3
Add the following code in the FormEvents_Submit event
public void FormEvents_Submit(object sender, SubmitEventArgs e)
{
    try
    {
        FileSubmitConnection spConn = DataConnections["SharePoint Library Submit"] as FileSubmitConnection;
        spConn.FolderUrl = "http://yourServer/yourDestinationDocLibUrl/"l;
        spConn.Filename.SetStringValue("YourFileName.xml");
        spConn.Execute();
        e.CancelableArgs.Cancel = false;
    }
    catch (Exception ex)
    {
        e.CancelableArgs.Cancel = true;
    }
}
Reference: http://www.dev4side.com/community/technical-articles/sharepoint-2010/what-should-you-know-before-development-in-infopath-2010-.aspx