power function in blackberry - blackberry

I desperately need a solution for this... I m using Blackberry JDE 5.0. In documentation it shows net.rim.device.api.util.MathUtilities.pow ( double double ) is added form 4.6. But i couldnt get pow function when i use Math.pow().
I need to get this value...float fSecondFactor=(float) (Math.pow(1+fRatePerMonth,fNumberofMonths)-1);
Can anyone tell me how to achieve this...Plzz....

i blogged about this a while ago- posted a link there to a good article on it
http://bryanallott.net/blog/2010/01/to-the-power-of-by-hand.html

Thanks MAX for ur support.... as you said, MathUtilities.pow, instead of Math.pow worked...

Related

What is use of each folder in System.Environment.SpecialFolder in iOS Xamarin

Can anyone please explain the structure of the folder structure for all the below mentioned SpecialFolder in Xamarin iOS?
Environment.SpecialFolder.AdminTools
Environment.SpecialFolder.ApplicationData
Environment.SpecialFolder.CDBurning
Environment.SpecialFolder.CommonAdminTools
Environment.SpecialFolder.CommonApplicationData
Environment.SpecialFolder.CommonDesktopDirectory
Environment.SpecialFolder.CommonDocuments
Environment.SpecialFolder.CommonMusic
Environment.SpecialFolder.CommonOemLinks
Environment.SpecialFolder.CommonPictures
Environment.SpecialFolder.CommonProgramFiles
Environment.SpecialFolder.CommonProgramFilesX86
Environment.SpecialFolder.CommonPrograms
Environment.SpecialFolder.CommonStartMenu
Environment.SpecialFolder.CommonStartup
Environment.SpecialFolder.CommonTemplates
Environment.SpecialFolder.CommonVideos
Environment.SpecialFolder.Cookies Environment.SpecialFolder.Desktop
Environment.SpecialFolder.DesktopDirectory
Environment.SpecialFolder.Favorites Environment.SpecialFolder.Fonts
Environment.SpecialFolder.History
Environment.SpecialFolder.InternetCache
Environment.SpecialFolder.LocalApplicationData
Environment.SpecialFolder.LocalizedResources
Environment.SpecialFolder.MyComputer
Environment.SpecialFolder.MyMusic
Environment.SpecialFolder.MyPictures
Environment.SpecialFolder.MyVideos
Environment.SpecialFolder.NetworkShortcuts
Environment.SpecialFolder.Personal
Environment.SpecialFolder.PrinterShortcuts
Environment.SpecialFolder.ProgramFiles
Environment.SpecialFolder.ProgramFilesX86
Environment.SpecialFolder.Programs Environment.SpecialFolder.Recent
Environment.SpecialFolder.Resources Environment.SpecialFolder.SendTo
Environment.SpecialFolder.StartMenu
Environment.SpecialFolder.Startup Environment.SpecialFolder.System
Environment.SpecialFolder.SystemX86
Environment.SpecialFolder.Templates
Environment.SpecialFolder.UserProfile
Environment.SpecialFolder.Windows
Environment.SpecialFolder.MyDocuments
Thanks
It appears the Xamarin API documentation is missing for this enum.
Here are a few of the values but not all:
Environment.SpecialFolder.ApplicationData is $HOME/.config, which is /data/data/#PACKAGE_NAME#/files/.config.
Environment.SpecialFolder.LocalApplicationData is $HOME/.local/share, which is /data/data/#PACKAGE_NAME#/files/.local/share.
Environment.SpecialFolder.Personal is $HOME, which is /data/data/#PACKAGE_NAME#/files.
Xamarin Forum Link

How to use HMAC in Lua - Lightroom plugin

First thing I have to mention is I'm really really new to Lua and please be patient if you think my question is too dumb
Here is my requirement
I need to use HMAC-sha256 for Lightroom plugin development as I'm using that for security.
I was trying to use this but with no luck
https://code.google.com/p/lua-files/wiki/hmac
These are the steps I followed
Got the code of
https://code.google.com/p/lua-files/source/browse/hmac.lua and saved
as 'hmac.lua' file in my plugin directory
Got the code from this
https://code.google.com/p/lua-files/source/browse/sha2.lua and saved
as 'sha2.lua' file
Now in the file I use it like this
local hmac = require'hmac'
local sha2 = require'sha2'
--somewhere doend the line inside a function
local hashvalue = hmac.sha2('key', 'message')
but unfortunately this does not work and I'm not sure what I'm doing wrong.
Can anyone advice me what I'm doing wrong here? Or is there an easier and better way of doing this with a good example.
EDIT:
I'm doing this to get the result. When I include that code the plugin does stops working. I cannot get the output string when I do this
hashvalue = hmac.sha2('key', 'message')
local LrLogger = import 'LrLogger'
myLogger = LrLogger('FlaggedFiles')
myLogger:enable("logfile")
myLogger:trace ("=========================================\n")
myLogger:trace ('Winter is coming, ' .. hashvalue)
myLogger:trace ("=========================================\n")
and the Lightroom refuses to load the plugin and there is nothing on the log as well
Thank you very much for your help
I'd first make sure your code works outside of Lightroom. It seems that HMAC module you referenced has some other dependencies: it requires "glue", "bit", and "ffi" modules. Of these, bit and ffi are binary modules and I'm not sure you will be able to load them into Lightroom (unless they are already available there). In any case, you probably won't be able to make it run in LR if you don't have required modules and can't make it run without issues outside of LR.
If you just need to get SHA256 hash there is a way to do it Lightroom
I posted my question here and was able to get an answer. But there there was no reference of this on SDK documentation (Lightroom SDK)
local sha = import 'LrDigest'
d = sha.SHA256.digest ("Hello world")
but unfortunately there was no HMAC so I decided to use md5 with a salt because this was taking too much of my time
Spent quite some time trying to find a solution :-/
LrDigest is not documented, thanks Adobe!
Solution:
local LrDigest = import "LrDigest"
LrDigest.HMAC.digest(string, 'SHA256', key)

Fixedpoints examples in z3-4.0 do not work because of missing buddy/fdd.h and buddy/bdd.h

I want to try the example in fixedpoints of z3 (path Z3-4.0/examples/fixedpoints), but the source files are not compilable because of missing buddy/fdd.h and buddy/bdd.h (defined in bdd_table.h). Could you guys please tell me where I can find these files?. Thank
Yes, BuDDy is not developed by us.
It was created by Jorn Lind.
You can download BuDDy from: http://sourceforge.net/projects/buddy/

Can an XNA Game use IsolatedStorageSettings for WP7?

I've been trying to port some Windows Phone 7 code between Silverlight to XNA which relies on IsolatedStorageSettings but I can't get Visual Studio to resolve it. When I have a look at what Intellisense is resolving under System.IO.IsolatedStorage & it lists IsolatedStorageFile, IsolatedStorageException & IsolatedStorageStream.
The documentation says that the supported version is for Silverlight but I don't understand why I am seeing the difference because of the project types.
http://msdn.microsoft.com/query/dev10.query?appId=Dev10IDEF1&l=EN-US&k=k(SYSTEM.IO.ISOLATEDSTORAGE.ISOLATEDSTORAGESETTINGS);k(ISOLATEDSTORAGESETTINGS);k(TargetFrameworkMoniker-%22SILVERLIGHT,VERSION%3dV4.0%22);k(DevLang-CSHARP)&rd=true
Thanks
The following work for me in an XNA project with no extra project references:
using (var store = IsolatedStorageFile.GetUserStoreForApplication())
{
store.CreateFile("folder/file.ext");
}
After adding a reference to System.Windows.dll I can then do:
var settings = IsolatedStorageSettings.ApplicationSettings;
settings.Add("something", "myValue");
settings.Save();
If you can't get the above working, can you post an example of what you're trying.

OpenOffice automation translate basic code to Delphi

Hello please help to translate the next line of basic code to Delphi for the OOoTools.pas interface.
oChart.Diagram.SymbolType = com.sun.star.chart.ChartSymbolType.SYMBOL1
I know that the SYMBOL1 part is an enumeration and I think I have to use the MakePropertyValue fumction but how?
Have you tried the simpler: oChart.Diagram.SymbolType := SYMBOL1;Just my first shot, btw.

Resources