Pages

Monday, October 17, 2016

.Net CF 3.5: Unable to read project file, Microsoft.CompactFramework.CSharp.targets was not found

Below is the screenshot of the error message shown in Visual Studio:
error
To get rid of this error you must install the .Net Compact Framework PowerToys into your Windows 10 OS!!

Thursday, July 7, 2016

Crystal Reports shows blank page

Copy the folders under "\inetpub\wwwroot\aspnet_client\" and paste them under the  root of the custom web site

 Add the following to the application web.config file:

<configSections>

    <sectionGroup name="businessObjects">
      <sectionGroup name="crystalReports">
        <section name="crystalReportViewer" type="System.Configuration.NameValueSectionHandler"/>
      </sectionGroup>
    </sectionGroup>
  </configSections>

  <businessObjects>
    <crystalReports>
      <crystalReportViewer>
        <add key="UseBrowserLocale" value="true"/>
        <add key="resourceURI" value="~/aspnet_client/system_web/4_0_30319/crystalreportviewers13" />
      </crystalReportViewer>
    </crystalReports>
  </businessObjects>

Monday, June 6, 2016

Traditonal Yoga - Breath Meditation



Lord Buddha also says that “he knows, ‘I am breathing….’” “Knows” means that it is a matter of conscious experience, of intentional awareness of the breath. But perhaps even more important is the Buddha’s assertion that the practicer will know “I am breathing.” This has more than one significant truth for us.

The first one is supremely practical: Breathing is not utterly automatic, nor is it a purely physical function. A friend told me that in his first conversation with a great yogi, the yogi asked him: “How do the lungs breathe, the heart beat, and the cells divide?” When he replied that they were activities of the involuntary nervous system, the yogi told him: “Then get busy and know that which is behind the involuntary nervous system, for that is the root of life. That is what you really are–not the shallow phantom of your conscious mind.” Buddha’s declaration assures us that through anapanasati the subconscious becomes conscious, that we become aware of The Breather.

Secondly, the Buddha’s statement that we will know: “I am breathing” informs us that although we are watching the breath and letting it be spontaneous, at the same time we are engaging in a subtle act of will (or: feeling, imagining, intending, sensing or thinking) for the breath to move at/in the nosetip during our inhalations and exhalations. It is not a matter of forcing or of intense will, but it is a subtle “setting of the sails” to ensure that the breath and awareness of the breath will continually be centered in the tip of the nose. It is something that we are doing, though in the subtlest possible way.

Thirdly, Buddha is saying that by means of Breath Meditation we shall come to know the true nature of our “I;” that by observing the breath we come to be aware of the observer, the “who” of us that is separate from and untouched by the duality that is embodied in the breath process, that full awareness of the dual breath leads us to the non-dual consciousness which both produces and perceives the breath. We breathe, and we know we breathe, and we come to know who we are. This is the purpose of Breath Meditation. - See more at: http://breathmeditation.org/the-buddhist-tradition-of-breath-meditation#sthash.vGnI2roP.dpuf

http://www.daviddarling.info/encyclopedia/B/Big_Bang.html
Universe - Big Bang theory

http://www.crystalinks.com/multiverse.html
Multi Universe

https://www.youtube.com/watch?v=qyPWvg9dxD4
Sceience vs Patanjali yoga (check from 14 mints after)

https://www.youtube.com/watch?v=DfPeprQ7oGc
Double Slit Experiment

https://www.youtube.com/watch?v=DsxA7OU7fR0
Explaination of double slit experiment



Thursday, June 2, 2016

Crystal Report Viewer bobj is undefined

Web.config.

<configSections>
    <sectionGroup name="businessObjects">
      <sectionGroup name="crystalReports">
        <section name="crystalReportViewer" type="System.Configuration.NameValueSectionHandler" />
      </sectionGroup>
    </sectionGroup>
  </configSections>
  <businessObjects>
    <crystalReports>
      <crystalReportViewer>
        <add key="resourceURI" value="~/crystalreportviewers13" />
      </crystalReportViewer>
    </crystalReports>
  </businessObjects>

Following are the solutions :
  1. Copy the folder "crystalreportviewers12" from “C:Inetpubwwwrootsystem_web2_0_50727" under “Default Website” to the “Custom Website” directory in IIS. Or, create a virtual directory pointing ‘aspnet_client’ folder in the custom web site directory.
  2. In the IIS Manger, select the Application Pool and Basic Settings. Under Managed Pipeline Mode, change Integrated Mode to Classic Mode.
  3. The value of resoureURI should be "~/crystalreportviewers12" not "/crystalreportviewers12".
  4. Copy the CrystalReportViewers12 folder from
    "C:Program FilesBusiness ObjectsCommon4.0" and paste it to "C:WindowsMicrosoft.NETFrameworkv3.5ASP.NETClientFiles".
          Note: Framework may vary as per the Visual Studio version used.

Thursday, May 26, 2016

DataGrid extensions for the Compact Framework

DataGrid extensions for the Compact Framework

InfoDabble > Tech Notes > DataGrid extensions for the Compact Framework
By Eric Hartwell -- February 25, 2008
Customized DataGrid control sample showing the ComboBox column in action.
Customized DataGrid control sample showing the ComboBox column in action.
Microsoft says, "The DataGrid class in the .NET Compact Framework provides the core functionality of the Windows Forms DataGrid class in the full .NET Framework." That's a bit like saying a rock provides the core functionality of a nuclear submarine.
The Compact Framework provides a subset of the functionality of the full .NET Framework. That's what makes it compact. Ok, but ...
<rant>did it never occur to anyone at Microsoft that the user interface is even more important in mobile applications than in Windows or web applications?</rant>
To be honest, it's not as bad as it looks. Way back in April, 2006, the Microsoft .NET Compact Framework Team published atech note with samples showing how to customize the DataGrid control, adding such field types as editable, formatted text, checkbox, pulldown lists, a date picker, and an up/down control. Unfortunately there's very little documentation with the sample.
 I've added a C# version of the sample application, updated to target Windows Mobile 5.0. Download it here.

C# code

The SetupTableStyles function must be called in the form's Load event handler rather than the constructor since the data and screen need to be initialized before it will work.
It would be nice to add designer support so the custom grid can be initialized directly from the screen builder. As always, adding designer support to compact framework controls is needlessly painful, but I'll try ...
private void SetupTableStyles()
{
   Color alternatingColor = SystemColors.ControlDark;
   DataTable vehicle = dataSource.Tables[1];
 
   // ID Column 
   DataGridCustomTextBoxColumn dataGridCustomColumn0 = new DataGridCustomTextBoxColumn();
   dataGridCustomColumn0.Owner = this.dataGrid1;
   dataGridCustomColumn0.Format = "0##";
   dataGridCustomColumn0.FormatInfo = null;
   dataGridCustomColumn0.HeaderText = vehicle.Columns[0].ColumnName;
   dataGridCustomColumn0.MappingName = vehicle.Columns[0].ColumnName;
   dataGridCustomColumn0.Width = dataGrid1.Width * 10 / 100;    // 10% of grid size
   dataGridCustomColumn0.AlternatingBackColor = alternatingColor;
   dataGridCustomColumn0.ReadOnly = true;
   dataGridTableStyle1.GridColumnStyles.Add(dataGridCustomColumn0);
 
   // Make column
   DataGridCustomTextBoxColumn dataGridCustomColumn1 = new DataGridCustomTextBoxColumn();
   dataGridCustomColumn1.Owner = this.dataGrid1;
   dataGridCustomColumn1.HeaderText = vehicle.Columns[1].ColumnName;
   dataGridCustomColumn1.MappingName = vehicle.Columns[1].ColumnName;
   dataGridCustomColumn1.NullText = "-Probably Ford-";
   dataGridCustomColumn1.Width = dataGrid1.Width * 40 / 100;     // 40% of grid size
   dataGridCustomColumn1.Alignment = HorizontalAlignment.Right;
   dataGridCustomColumn1.AlternatingBackColor = alternatingColor;
   dataGridTableStyle1.GridColumnStyles.Add(dataGridCustomColumn1);
 
   // Mileage column
   DataGridCustomUpDownColumn dataGridCustomColumn2 = new DataGridCustomUpDownColumn();
   dataGridCustomColumn2.Owner = this.dataGrid1;
   dataGridCustomColumn2.HeaderText = vehicle.Columns[2].ColumnName;
   dataGridCustomColumn2.MappingName = vehicle.Columns[2].ColumnName;
   dataGridCustomColumn2.NullText = "-Unknown-";
   dataGridCustomColumn2.Width = dataGrid1.Width * 20 / 100;     // 20% of grid size
   dataGridCustomColumn2.Alignment = HorizontalAlignment.Left;
   dataGridCustomColumn2.AlternatingBackColor = alternatingColor;
   dataGridTableStyle1.GridColumnStyles.Add(dataGridCustomColumn2);
 
   // Availability column 
   DataGridCustomCheckBoxColumn dataGridCustomColumn3 = new DataGridCustomCheckBoxColumn();
   dataGridCustomColumn3.Owner = this.dataGrid1;
   dataGridCustomColumn3.HeaderText = vehicle.Columns[3].ColumnName;
   dataGridCustomColumn3.MappingName = vehicle.Columns[3].ColumnName;
   dataGridCustomColumn3.NullText = "-Unknown-";
   dataGridCustomColumn3.Width = dataGrid1.Width * 10 / 100;     // 10% of grid size
   dataGridCustomColumn3.Alignment = HorizontalAlignment.Left;
   dataGridCustomColumn3.AlternatingBackColor = alternatingColor;
   dataGridTableStyle1.GridColumnStyles.Add(dataGridCustomColumn3);
 
   // Fuel Level column
   DataGridCustomComboBoxColumn dataGridCustomColumn4 = new DataGridCustomComboBoxColumn();
   dataGridCustomColumn4.Owner = this.dataGrid1;
   dataGridCustomColumn4.HeaderText = vehicle.Columns[4].ColumnName;
   dataGridCustomColumn4.MappingName = vehicle.Columns[4].ColumnName;
   dataGridCustomColumn4.NullText = "-Unknown-";
   dataGridCustomColumn4.Width = dataGrid1.Width * 30 / 100;     // 30% of grid size
   dataGridCustomColumn4.Alignment = HorizontalAlignment.Left;
   dataGridCustomColumn4.AlternatingBackColor = alternatingColor;
   dataGridTableStyle1.GridColumnStyles.Add(dataGridCustomColumn4);
 
   // Last Used column
   DataGridCustomDateTimePickerColumn dataGridCustomColumn5 = new DataGridCustomDateTimePickerColumn();
   dataGridCustomColumn5.Owner = this.dataGrid1;
   dataGridCustomColumn5.HeaderText = vehicle.Columns[5].ColumnName;
   dataGridCustomColumn5.MappingName = vehicle.Columns[5].ColumnName;
   dataGridCustomColumn5.NullText = "-Unknown-";
   dataGridCustomColumn5.Width = dataGrid1.Width * 30 / 100;     // 30% of grid size
   dataGridCustomColumn5.Alignment = HorizontalAlignment.Left;
   dataGridCustomColumn5.AlternatingBackColor = alternatingColor;
   dataGridTableStyle1.GridColumnStyles.Add(dataGridCustomColumn5);
 
   // Grid, mapping
   dataGridTableStyle1.MappingName = vehicle.TableName;                       // Setup table mapping name
   dataGrid1.DataSource = vehicle;         
 
   // Setup grid's data source
   ComboBox cb = (ComboBox)dataGridCustomColumn4.HostedControl;
   DataTable fuel = dataSource.Tables[0];                                                    // Set up data source
   cb.DataSource = fuel;           
 
   // For combo box column
   cb.DisplayMember = fuel.Columns[0].ColumnName;
   cb.ValueMember = fuel.Columns[0].ColumnName;
 
   dataGrid1.CurrentRowIndex = 50;                                                            // Move to the middle of the table
}

Code notes

Note the funky cast when setting up the combo box's data source. This is because the HostedControl is exposed as the base Control class.
ComboBox cb = (ComboBox)dataGridCustomColumn4.HostedControl;

How did they do that?

The Compact Framework 2.0 Service Pack 1 introduced the following extensions to provide better data formatting and custom cell drawing:
  • DataGridColumnStyle
    • PropertyDescriptor descriptor allows access to this column data in the data source so it could be processed as needed.
    • Paint() method is called as cell is drawn. Overriding it allows representing data from data source in any way imaginable. Colors, fonts, formatting, alignment, pictures and more - anything is possible as long as it can be painted. CurrencyManager and row number along with PropertyDescriptor allows fetching data from data source to convert and format the way you want.
  • DataGridTextBoxColumn
    • Format string to be used to format data in the column. To be used the same way as on desktop or in simple data binding.
    • IFormatProvider FormatInfo Format provider to be used to format data in the column. To be used the same way as on desktop or in simple data binding.

Links

Friday, May 20, 2016

Android Phone Screen on PC debug

It's likely that the device is no longer authorized on ADB for whatever reason.
ADB path C:\Users\LoggedinUser\AppData\Local\Android\sdk\platform-tools
1. Check if authorized:
<ANDROID_SDK_HOME>\platform-tools>adb devices
List of devices attached
4df798d76f98cf6d        unauthorized
2. Revoke USB Debugging on phone
If the device is shown as unauthorized, go to the developer options on the phone and click "Revoke USB debugging authorization" (tested with JellyBean & Samsung GalaxyIII).
3. Restart ADB Server:
Then restarted adb server
adb kill-server
adb start-server
4. Reconnect the device
The device will ask if you are agree to connect the computer id. You need to confirm it.
5. Now Check the device
It is now authorized!
adb devices
<ANDROID_SDK_HOME>\platform-tools>adb devices
List of devices attached
4df798d76f98cf6d        device

Wednesday, January 28, 2015

ITextSharp PDF editing

In any case, you need a font that knows how to display Arabic glyphs:
BaseFont bf = BaseFont.CreateFont(ARIALUNI_TFF, BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
Font f = new Font(bf, 12);
For Adding text
  Dim oldFile As String = "D:\PdfGenerator_VB\nf.pdf"
        Dim newFile As String = "D:\PdfGenerator_VB\newnf.pdf"

        ' open the reader
        Dim reader As New PdfReader(oldFile)
        Dim size As Rectangle = reader.GetPageSizeWithRotation(1)
        Dim document As New Document(size)

        ' open the writer
        Dim fs As New FileStream(newFile, FileMode.Create, FileAccess.Write)
        Dim writer As PdfWriter = PdfWriter.GetInstance(document, fs)
        document.Open()

        ' the pdf content
        Dim cb As PdfContentByte = writer.DirectContent

        ' select the font properties
        Dim bf As BaseFont = BaseFont.CreateFont("C:\Windows\Fonts\Arial.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)
        cb.SetColorFill(BaseColor.DARK_GRAY)
        cb.SetFontAndSize(bf, 8)
      
        Dim f As New Font(bf, 8)
        Dim ct As New ColumnText(writer.DirectContent)
        ct.RunDirection = PdfWriter.RUN_DIRECTION_RTL
        ct.SetSimpleColumn(50, 50, 480, 270, 24, Element.ALIGN_RIGHT)
        Dim chunk = New Chunk("الأربعاء", f)
        ct.AddElement(chunk)
        ct.Go()


        cb.BeginText()
        text = "28"
        ' put the alignment and coordinates here
        cb.ShowTextAligned(2, text, 405, 260, 0)
        cb.EndText()

        cb.BeginText()
        text = "01"
        ' put the alignment and coordinates here
        cb.ShowTextAligned(2, text, 390, 260, 0)
        cb.EndText()

        cb.BeginText()
        text = "2015"
        ' put the alignment and coordinates here
        cb.ShowTextAligned(2, text, 370, 260, 0)
        cb.EndText()

        ' create the new page and add it to the pdf
        Dim page As PdfImportedPage = writer.GetImportedPage(reader, 1)
        cb.AddTemplate(page, 0, 0)

        ' close the streams and voilá the file should be changed :)
        document.Close()
        fs.Close()
        writer.Close()
        reader.Close()
For Fields using
  Dim pdfTemplate As String = "D:\PdfGenerator_VB\nf.pdf"

        ' title the form
        Me.Text += " - " + PdfTemplate

        ' create a new PDF reader based on the PDF template document
        Dim pdfReader As PdfReader = New PdfReader(pdfTemplate)

        ' create and populate a string builder with each of the 
        ' field names available in the subject PDF
        Dim sb As New StringBuilder()

        Dim de As New DictionaryEntry
        For Each kvp As KeyValuePair(Of String, AcroFields.Item) In pdfReader.AcroFields.Fields
            sb.Append(kvp.Key.ToString() + Environment.NewLine)
        Next

        ' Write the string builder's content to the form's textbox
        textBox1.Text = sb.ToString()
        textBox1.SelectionStart = 0
  Dim pdfTemplate As String = "D:\PdfGenerator_VB\nf.pdf"
        Dim newFile As String = "D:\PdfGenerator_VB\Final_nf.pdf"

        Dim pdfReader As New PdfReader(pdfTemplate)
        Dim pdfStamper As New PdfStamper(pdfReader, New FileStream( _
                    newFile, FileMode.Create))

        Dim pdfFormFields As AcroFields = pdfStamper.AcroFields

        ' set form pdfFormFields

        ' The first worksheet and W-4 form
        pdfFormFields.SetField("untitled1", "1")
        pdfFormFields.SetField("untitled2", "2")
        pdfFormFields.SetField("f1_03(0)", "1")
     ' report by reading values from completed PDF
        Dim sTmp As String = "W-4 Completed for " + pdfFormFields.GetField("f1_09(0)") + " " + _
        pdfFormFields.GetField("f1_10(0)")
        MessageBox.Show(sTmp, "Finished")

        ' flatten the form to remove editting options, set it to false
        ' to leave the form open to subsequent manual edits
        pdfStamper.FormFlattening = True

        ' close the pdf
        pdfStamper.Close()
http://www.dotnettips.info/Post/582/%D9%81%D8%A7%D8%B1%D8%B3%D9%89-%D9%86%D9%88%DB%8C%D8%B3%D9%89-%D9%88-itextsharp

How to Create a PDF with Editable Fields

PDFescape

http://smallbusiness.chron.com/create-pdf-editable-fields-55640.html