Monday, 2 September 2013

SharePoint app give web project (host web) access to documents

SharePoint app give web project (host web) access to documents

I have a provider hosted SharePoint 2013 app. In this app I have a custom
ribbon action that when clicked goes to the host web (Default.aspx). On
this page I want to create a hash for the selected document in SharePoint
with the following code:
Uri FileUri = new Uri(docUrl);
byte[] hashValue;
using (var Client = new WebClient())
{
hashValue =
SHA256Managed.Create().ComputeHash(Client.OpenRead(FileUri));
}
Label2.Text = BitConverter.ToString(hashValue).Replace("-", String.Empty);
docUrl is a string containing the url to the document in SharePoint. In
AppManifest.xml Web, SiteCollection and List all have FullControl.
When I run this I get the error 403 forbidden. Is this because the host
web does not have access to the document? How can it be fixed?

VBA: how can I extract numbers from text for a basic pigeonhole sort?

VBA: how can I extract numbers from text for a basic pigeonhole sort?

so im trying to code a kind of pigeon hole sorting function thing. I will
be calling it to arrange an array containing the summary of values from a
column. It could contain AHU1, AHU3, AHU2 or EF2, EF1, EF3 or just 3, 1,
2. There will always be a number contained as its is required by the
input. My first attempt is below, this seemes inefficient. For both, Adim
is the size of the number of vlaues in the input array (ArrayToSort) and
TempAry() is a temporary array that will provide the output of the sort
function. i and j are just integers.
For i = ADim To 0
For j = 1 To ADim + 1
If AryToSort(i) = "*" & j Then ''''this doesnt work, im only 2
weeks old to vba so still learning but thought it might work
TempAry(j - 1) = AryToSort(i).Value
End If
Next
Next
Second attempt is below but is just psuedo atm still have the problem that
i cant get a number from the reference in the array. Just 1 for loop this
time. There will never be a case where there is a discontinuos series.
For i = ADim To 0
j = number extracted from AryToSort(i)
TempAry(j - 1) = AryToSort(i).Value
End If
Next
I have looked into using Right(), Mid() and Left() but dont think it will
work, also using split functions. I could do this with split if i allow
another input into the sort function (which currently just pulls in the
array) which would have the length of the text string in the array so i
can use a split function but would prefer to avoid this.
Any ideas, pointers, or complete rethinks?

equivalent of getch() for Android

equivalent of getch() for Android

Is there an equivalent for C's getch() in Android or Java? I want the
execution to stop until the user does some action, like tap on the screen
or maybe press one of the hardware buttons like volume control or whatever
is available. Another option would be to show a modal message box window,
which does not let the program continue until the user presses on OK. Is
it possible to do this in a simple way in Android? What is the simplest
way to get something equivalent to getch() function in android?
I need to be able to use this in a Thread as well

Sunday, 1 September 2013

How to integrate a C# server with C++ business logic

How to integrate a C# server with C++ business logic

I am a C++ developer and want to develop a RESTful service. Since our
business logic is in C++(boost) but want to like to develop server in C#
due to easy deployment and enhancement.. My business logic is fetching
data from Db and applying algorithms on it and producing output. Sometimes
these output is a big array or matrix etc. Looking forward to know the
integration of C++ and C# code here.

XML broken links

XML broken links

I'm having a bit problem and it's been an hour finding a proper solution
online. I have a sitemap.xml file and I need to check it for broken links.
so far most of the tools that I have found are not free others broken and
others are just not working. Would really appreciate it someone would help
me out. Thanks in advance.

AlertDialog.dismiss()?

AlertDialog.dismiss()?

I am new in android and I am learning from developer.android.com site.
Then I came across to AlertDialog.dismiss() where in site it is written
that
This method Dismiss this dialog nad remove it from the screen. This method
can be invoked safely from any thread. Note that you should not override
this method to do cleanup when the dialog is dismissed, instead implement
that in onStop().
But I did not understand the mean of this line-
Note that you should not override this method to do cleanup when the
dialog is dismissed, instead implement that in onStop()
what is the mean of above line?
`.

Multiple HTTP requests in one AsyncTask

Multiple HTTP requests in one AsyncTask

So I have an app that will first make a HTTPPOST request to validate login
details. If the login details are correct it should then further make
another two HTTPGET requests otherwise do nothing.
I know how to right the code to have this done with 3 AsyncTasks but is
there a way to do it from one ? Or is 3 seperate classes correct, coding
style wise ?
If not can someone point me in the right direction/give me an exampl of
how it would be done in one seeing as I have to evaluate the results of
the first HTTPPOST which I do in OnPostExecute and then have another
HTTPGET