yashsingh1/xdaforums huggingface dataset:
[Windows Mobile Software Development] Corwin9S:
Version 0.3

ok. thanks, I will test the editor.

for my formulas, I use this :

'Points Plus
CInt(PointsPlus = Round(protein / div_prot + carbs / div_cal + fat / div_fat - fiber / div_fib, 2))

' Points
CInt(Points = Round(carbs / div_cal + fat / div_fat - fiber / div_fib, 2))

(the rounding options is a choice, see under for changelog)

well... I've read much more on WW formulas and I'm quite wrong with my "Points" formula...

Points = (Calories / 50) + (Fat grams / 12) + min { Fiber grams, 4} / 5)

Points Plus = (Protein / 10.9) +( Carbohydrates / 9.2) + (Fat / 3.9) + (Fiber / 35) (all amounts are in grams).

for the points plus, it's ok... but for the points formula, really not !

If someone can rewrite for me the formula with the four dividers I have (div_prot, div_cal, div_fat, div_fib) (see options page), thanks in advance ! for now, I will let the "Points" calculation as it is now...

=============================================

To Do

- implement other languages

- inspect landscape mode

- rewrite points formula

Done 0.3

- replace items to entirely fit on resolution with at least 320 pixels of height

- rewrite options pages

- modify disclaimer

- change config.xml tags to suit desktop editor (and added rounding tag too)

- adapt size of droplist's text

- visual confirmation for adding personal points

- change way of reseting personnal points. If reseted but clicked on X, no reset. If reseted and clicked on Save, reset is effective.

- modify logo

- check formulas

- rewrite formula of points plus for being more accurate

- add formula détails in options

- add rounding options (1.25 -> 1, 1.5 -> 2, 1.75 -> 2) yes/no

- lighten the .cab file

Pictures

Proper QVGA Version

Download
[Windows Mobile Software Development] Corwin9S:
already great !

some little things

- the mapppled value is not taken (3 p)

- maybe a column for config too ?

- maybe a dynamical load for config too ? I've added the "rounding" option... who knows what will come next...

good job
[Windows Mobile Software Development] Tribulattifather:
@Corwin9S

Also, to let you know, Calories aren't used in the Points + algorithm..

@DeeDee

So you're using M$ Visual Studio 2005? I can't seem to open the project in M$ Visual Studio 2010..
[Windows Mobile Software Development] deedee:
VS 2010 has a free edition, i'll download it at work tomorrow and see if it works for me.

Do you have the Visual Basic part of VS2010?
[Windows Mobile Software Development] Tribulattifather:
Not sure if I do or not. But now I am installing VS2005 and seeing if I can get this working in there.
[Windows Mobile Software Development] Tribulattifather:
Hey, DeeDee, I got it finally to open in VS2005 in the Basic Portion. I see a lot of data here, lol.

I'd be willing to donate to your services and your time if you could make a video tutorial for me. You don't have to make it like a lesson, just basically record yourself recreating your project from scratch. This project in particular:
[Windows Mobile Software Development] Corwin9S:
just to let you know that I'm right making adjustments for adapting the corrects formulas. I've added new field "carbohydrates" and new dividers. News soon, as I will release a version 0.4
[Windows Mobile Software Development] deedee:
OK, i am going to assume the new variable will be nb_carb, and recode accordingly.
[Windows Mobile Software Development] deedee:
If/when I get a chance I will try and do a wee video of recreating the project. Not sure when as there is a cross UK house move for Thurs/Fri.

As for payment, wait and see if its any good. :)
[Windows Mobile Software Development] Tribulattifather:
That would be amazing. You see I am stuck at here:

Don't really know what to do next, lol. ^>^
[Windows Mobile Software Development] deedee:
Errors 4, 5 and 6 are due to you not having all the controls on the form. Please note that I have two controls stacked on top of each other at one point and only show one depending on the selection of the drop down.

Not sure on the others, see if they go away after creating the missing controls.
[Windows Mobile Software Development] Corwin9S:
you have to declare the variables used, like

Dim txtCarb as String

or whatever

... this tell me I really have to migrate to VS2010 !
[Windows Mobile Software Development] Tribulattifather:
Okay. Instead of modifying your project, DeeDee, I started from scratch and adding new private subs using your project as a guide..

What I am stuck on now is how to get each text field to correspond with a sub..
[Windows Mobile Software Development] Corwin9S:
welcome on the great family of dev'

just a question: is it important that I keep developping or not? just asking it because I've a lot to do IRL.
[Windows Mobile Software Development] deedee:
The only subs associated with the text fields is to empty them when they get focus.

The rest of the time I use Val(txtCalories.Text) in the formulas.
[Windows Mobile Software Development] Corwin9S:
Version 0.4

Okay... i'm over with the 0.4 version, with correct formulas now.

Some importants modifications for deedee

.xml files had been updated with new fields.

a. config.xml

added

<nb_carb></nb_carb>
<nb_fat_points></nb_fat_points>
<nb_fiber_points></nb_fiber_points>

example of whole config.xml file

<config><infos>
<date>1/25/11</date>
<filetype>base</filetype>
<nb_calorie>50</nb_calorie>
<nb_protein>10.94</nb_protein>
<nb_fat>3.89</nb_fat>
<nb_fiber>35</nb_fiber>
<nb_carb>9.24</nb_carb>
<nb_fat_points>12</nb_fat_points>
<nb_fiber_points>5</nb_fiber_points>
<autoxml>yes</autoxml>
<sons>yes</sons>
<mapped>120</mapped>
<mapppled>500</mapppled>
<autocalc>yes</autocalc>
<warn>yes</warn>
<rounding>no</rounding>
</infos></config>

b. ingredients.xml

added a new value, for carbohydrates :

<carb>XXXX</carb>

example of an item of ingredients.xml file

<item>
<nom>Carls Jr. - Six Dollar Burger</nom>
<cal>1000</cal>
<fat>62</fat>
<fib>72</fib>
<prot>39</prot>
<carb>900</carb>
</item>

So... I think that now I'm over with this calculator, except if they're errors... please, let'me know if approved or if not, and if it has errors, mistakes,...

=====================================================

To Do

- implement other languages

Done 0.4

- rewrite points formula

- redo options screens

- add more fields in options

- modify .xml files

- add Carbohydrate field on main screen

- increase width of fields on main screen to fit thousands values

- to reset dividers to default values, simply empty all divider's fields

Pictures

Proper QVGA Version

Download
[Windows Mobile Software Development] Tribulattifather:
@Corwin9S

Well done mate. Thank you for all your efforts.

@DeeDee

Thank you.
[Windows Mobile Software Development] deedee:
It's a Combo Box with two values:

see screen shot
[Windows Mobile Software Development] Tribulattifather:
Awesome. Now I have everything set .. sort of..

The app loads and deploys, but no variables post when I put a value into any of the fields..

I'll upload my project, maybe you can tell me what I am missing/doing wrongly.
[Windows Mobile Software Development] deedee:
Really simple one:

You have

TextBox1_TextChanged...Handles Carb.TextChanged

It needs to be

TextBox1_GotFocus... Handles Carb.GotFocus

Your code clears the text in the box the moment it changes. You only want to clear the box on entry to the field.

Also you need to ensure that the combo box is given a default setting and that you assign an action to the Exit Menu.

You're getting there really nicely though.
[Windows Mobile Software Development] Tribulattifather:
Thanks. This is the first time I've tried anything like this ^>^

I'll let you know the outcome.

Edit: YES, lol. It works.

Re-Edit: @DeeDee - Can you help me make an about page?

Maybe you can take a look at it and add to what I have?

Here is my project:
[Windows Mobile Software Development] deedee:
Unfortunately, About screens are not something I have got working in the way expected. So far the best I have managed is to add a second form with a close button and a text box with the words. Open this form from either a menu option or a button. HTH
[Windows Mobile Software Development] deedee:
Amazing how flashes of inspiration strike, sat in the hospital waiting room and it dawned on me that a pop up About box is nothing more than a MessageBox with a large string of text and no buttons.

Just tried it in my test environment and it works as expected.
[Windows Mobile Software Development] Tribulattifather:
Wow. I think i'll try that.

Can you write the code for that here so I can try it?

On a side note - What's wrong? O.o (That you're in a hospital?)

Back on track:

Do you happen to know how to make forms members of other forms?
[Windows Mobile Software Development] DavidTiger:
You don't need the Me. part just the form name and .show()

me. is used for the current form, in your case Form1.
[Windows Mobile Software Development] Corwin9S:
as I've done in 3WM.

You also can add information with the App.XXX, (title, description,...) which takes infos of the properties of your project.

another way to do an about screen is to make a simple frame, with text inside. at the launch of the application, this frame is hidden (visibible = false). You can set it anywhere you want when coding. When clicking on the button (or menu,...), the frame will be placed where you want (for example, top=0, left=0, height=screen.height, width=screen.width) and set to be visible (visible=true). do not forget to manage the z-order too... the frame have to be in front (of course...). I've made like that for the options in 3WM.

So you will not need another form
[Windows Mobile Software Development] Tribulattifather:
I get this when I remove the 'me.'
[Windows Mobile Software Development] DavidTiger:
This will work, for other forms just change the form names..

Dim Form2 As Form2 = New Form2
Form2.Show()
[Windows Mobile Software Development] Tribulattifather:
Wow. That did exactly what I wanted it to. *added you to the about section* lol.
[Windows Mobile Software Development] Tribulattifather:
Thanks again for all three of your guys' help. I really appreciate it.
[Windows Mobile Software Development] DavidTiger:
Great, however on my device I cannot open my keyboard to be able to enter values...

The bar at the bottom is not there to open it :/

I'm guessing because its built on the WM2003 SDK?
[Windows Mobile Software Development] Tribulattifather:
I'll fix ASAP. Thank you for your input.
[Windows Mobile Software Development] Corwin9S:
@deedee

do you think you will finish the editor? in this case, I will do a final .cab with your last ingredients.xml file.

thanks for your job !
[Windows Mobile Software Development] DavidTiger:
The bar is there now but not everything fits on the screen properly..
[Windows Mobile Software Development] Tribulattifather:
Looks like i've got some bugs to still work out :\
[Windows Mobile Software Development] deedee:
I certainly hope to finish the editor, I am in the middle of helping my mother move house, so not getting much else done. It is rather a large move, Newmarket, Suffolk to Coleraine, N Ireland.

I may get some coding done tomorrow on the travels but I am not holding much hope.

New editor hopefully for end of play Monday, assuming everyone can wait. Especially as I need to redo my ingredients import as well now. :)

@Tribulattifather

The hospital was me waiting for someone else to see the physio.
[Windows Mobile Software Development] Tribulattifather:
Can you guys teach me code to make it so the user can save text when they enter data into a textbox on a form?

I have it so there is a File > Save in the main menu..
[Windows Mobile Software Development] deedee:
OK, editor revised but for some reason the resulting file is no longer being recognised in 3WM. Anyone tell me what has screwed up, I can't see it.
[Windows Mobile Software Development] Corwin9S:
hi. tx for the editor !

the file's format is utf-8

i open it with notepad and save it in ansi-ascii format and it's ok.

i will try to find how to handle different format in eVB.

btw, it's Corwin :-)
[Windows Mobile Software Development] deedee:
Thanks, I will change the credit box.

If anyone knows how to get

dsRecords.WriteXml(xmlFilename)

to output ASCII, let me know.

New program added.
[Windows Mobile Software Development] DavidTiger:
To output data in another format you can use "Encoding.[coding format]"

I haven't tested this code but in theory it should work, with some variable names changes for your specific variable names :D

Note: The code is in C# but should be easily translatable to other languages, If you need help just ask :)
[Windows Mobile Software Development] Tribulattifather:
Would you perchance know about Users saving data in a form in a TextBox?
[Windows Mobile Software Development] DavidTiger:
How do you mean? Like saving data from a Textbox into a file ?
[Windows Mobile Software Development] Tribulattifather:
Exactly, but for Windows Mobile.

I've tried a lot of code to try to save to a .txt file on the device, but I get a lot of errors.

So I'm wondering what i have to write for a user to be able to press 'File,' Save' and have it save what is in the textbox1 - textbox27 on the form.

You'll see what I mean - Here's my project:

http://www.megaupload.com/?d=90QG6OBL
[Windows Mobile Software Development] DavidTiger:
You can use a StreamWriter in .NET CF just as you would normal .NET

You cannot save to a resource file, you can but its much easier to create a text file in the root directory (beside the app exe)..

Copy this straight into your project:

Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
Using writer As StreamWriter = New StreamWriter(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) + "\\savedfile.txt")
writer.WriteLine(TextBox1.Text)
writer.WriteLine(TextBox2.Text)
writer.WriteLine(TextBox3.Text)
'And so on until your done saving all textbox data :D
End Using
End Sub

Private Sub btnLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLoad.Click
Dim filepath As String = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) + "\\savedfile.txt"
Dim sr As System.IO.StreamReader
Dim loaded_data As String()
Try
sr = New System.IO.StreamReader(filepath)
loaded_data = System.Text.RegularExpressions.Regex.Split(sr.ReadToEnd, "\r\n")
' (0) is the first line
TextBox1.Text = loaded_data(0).ToString()
TextBox2.Text = loaded_data(1).ToString()
TextBox3.Text = loaded_data(2).ToString()
'And so on until your done loading all texbox data :D
Finally
If Not sr Is Nothing Then sr.Close()
End Try
End Sub

Also add this at the top, above "Public Class Form2"

Imports System.IO

This code will save all the textbox data into a txt file called "savedfile.txt" beside the exe... You can change the filename if you please, just make sure you change both occurances :)

When loading it takes each line of the text file (which each line is a different textbox) and adds it to the array 'Loaded_Data'

You can then simply assign each textbox with its corrosponding line of the text file... TextBox1 being Line 1... Line 1 is array position 0 because thats where the array position starts at

(In short each textbox is the array number of that below the number of the TextBox... e.g TextBox13 would be Array Position 12 :D)

You'll need to add the rest of the textboxes, You can see the pattern to follow :D

Hope that helps, I wouldn't normally just give people full code but it was easier than explaining it at 3:20am lol

Its always good to get help, but as I always thought... Its no use if you just copy and paste someone else's work/code if you don't read it through and understand how it works and what each and every line of code does.

Even if it is the simple "Try" "Finally" "End Try" I used in the above example. I've included it as an easier way to stop the code when you reach the last line of the file, stops errors when the reader reads nothing and tries to use 'nothing' :)
[Windows Mobile Software Development] Tribulattifather:
Thank you very much. I am going to try right now.

Funny thing is is that I am actually learning a lot through all my mistakes I've been making. Learning the functions and why it works. And if it is a mistake, why it's a mistake, etc..

I can't wait to see this in action. I will surely make sure you're mentioned in the Credits.

Also, did you open the project to get to this conclusion or did you just write that off the top of your head. Either way, you're amazing for knowing this language.

It's also funny that I couldn't figure this out, because I am a web-master and have published umpteen amount of sites, hosted my own server once a while back and operated sites for people who've I've created the sites for..

So in short, I am the type that learns tactilely, visually and audibly; I learn hands on the most.

EDIT: Oh wow. It worked like a charm, Thank You Very Much.

I owe you one; I've been at this for about 2 weeks without a solution. I've come close a few times, but not to this extent.

TY TY.

Now to work on verticle scrolling ^>^
[Windows Mobile Software Development] DavidTiger:
I opened the project to see what exactly it was loading and how.. but I know VB like almost as good as english lol I started programming when I was 11 in my first year at high school we used VB6 :D

Now being 7 years later I know a lot of VB and other languages but all others are almost identical its mainly just the syntax that changes and the way things are declared etc..

I prefer to use C# now over VB.. also experimenting with C++ for hopefully bigger projects in the future :)

Good luck with the app, as I have with my first release on the forums. One of many as I think up ideas of apps to make lol

I appreciate the credits aswell, thanks.

As always feel free to PM me with any help you might need on programming related things. I'll continue to help you and others in this thread aswell..

-David
[Windows Mobile Software Development] Tribulattifather:
Impressive @ age 11. I started fabricating sites about 5 years ago; I was 21 o.O.

Oh yeah, I bought ya a beer; It's all I've got this week, but next week it'll be a bit better of a donation.

But, which do you think would be better:

Having a tabbed control (switching tabs to get to another tracker pad) or having the user scroll (creating the tracker pad longer) in the tracker?

EDIT: I used both, lol. I am currently adding new GUI changes and will soon be ready for launch :1
[Windows Mobile Software Development] deedee:
Looks like C# is going to have to be next on my learning curve as all examples are in C#. Pity I am coding in VB. :)

All my searching says to use a filestream, but I cant get it to work.
[Windows Mobile Software Development] DavidTiger:
C# is easy to learn from VB, as I said in my last post about it.. Its mainly just synax changes.. for example:

This VB code:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim somestringvariable As String
If somestringvariable = "Some Random String" Then
MsgBox("Random Message")
Else
'do nothing - this be a comment line
End If
End Sub

Looks like this in C#

private void Form1_Load(object sender, EventArgs e)
{
string somestringvariable;
if (somestringvariable == "Some Random String")
{
MessageBox.Show("Random Message");
}else{
//do nothing - this be a comment line
}
}

You see how simplified VB is :)

You don't need to add ; to the end of every line

You don't need to manually add { or }

Message boxes are not simplified to MsgBox

Statements like AND OR EQUALS (=) change

In VB you can use the words AND (or just use &) and OR and a single =

but C# for AND its && for OR its || and for EQUALS its ==

Things like that, to be honest if you know VB enough its so easy to pickup C# and then C++ :rolleyes:

If its easier for you, I can show you examples you need help with in VB rather than C#.. to save you trying to convert it :D
[Windows Mobile Software Development] deedee:
Fixed it, and it was probably of my own making anyway. After the write of the data set I am reading the xml back in as a string and inserting the date value and then writing it back out.

This is where the utf-8 encoding was getting in the way. The solution is to add the encoding in this last write.

strTemp = "ingredients.xml"
strTemp = My.Computer.FileSystem.ReadAllText(strTemp)
strTemp = strTemp.Replace("<ingredients>", "<ingredients>" & vbCrLf & "<infos>" & DateString & "</infos>")
My.Computer.FileSystem.WriteAllText("ingredients.xml", strTemp, False, System.Text.Encoding.ASCII)
[Windows Mobile Software Development] deedee:
Code on SourceForge

Click Here
[Windows Mobile Software Development] Tribulattifather:
Finally released my project to the public ^>^

(Click Here)
[Windows Mobile Software Development] stephj:
In reply to some of the previous posts about the difference between VB and C# code:-

There is a tool by Redgate, called Reflector, that can read a .NET executable file and list the IL (Intermediate Language) in it.

Not only that, it can reverse engineer the IL back to the VB, C#, or managed C++ code that was used to create it. Delphi and Oxygene (ex Chrome) are also included.

As such, it can be used to convert .NET code from one language to another.

It does not know the names of the original variables, so it calls them num1, num2, StreamWriter1 etc.

If you want to download a copy of it, I would do it pretty soon, as they are going to start charging for it.

http://www.red-gate.com/products/dotnet-development/reflector/
[Windows Mobile Software Development] DavidTiger:
I have used this before, in fact I used it 2 days ago to retrieve a lost source, of a program I made a while back, that I wanted to continue developing...

and for that reason I now obfuscate all my released exe/dll (ones that come without source) :D

Developing in .net for commercial apps or something you want to keep the source private then without obfuscating it, its pretty useless to try and keep the source private..

Obviously it wasn't made to reverse engineer/steal sources but since it can, my guess it that people would at least try to..

For its use you have given, yes its great to convert code from multiple languages into one you know the best

For those who don't know what obfuscating is, here's an example using .NET Reflector with a normal .net exe and an the same (but obfuscated) exe...

Normal Code:

public void GetCellID()
{
CellIDInfo.RILCELLTOWERINFO CellTowerInfo = CellIDInfo.GetCellTowerInfo();
this.cellid = CellTowerInfo.CellID.ToString();
this.lac = CellTowerInfo.LAC.ToString();
this.mcc = CellTowerInfo.MCC.ToString();
this.mnc = CellTowerInfo.MNC.ToString();
this.Label1.Text = "CellID = " + this.cellid;
this.Label2.Text = "LAC = " + this.lac;
this.Label3.Text = "MCC = " + this.mcc;
this.Label4.Text = "MNC = " + this.mnc;
}

Obfuscated Code:

public void GetCellID()
{
CellIDInfo.RILCELLTOWERINFO □ = CellIDInfo.□();
this.□ = □.CellID.ToString();
this.□ = □.LAC.ToString();
this.□ = □.MCC.ToString();
this.□ = □.MNC.ToString();
this.ewdjpey32vjqku59q2y8yha3f8wjthzt().Text = .(-905860397) + this.□;
this.ewdjpey32vjqku59q2y8yha3f8wjthzt().Text = .(-905860317) + this.□;
this.ewdjpey32vjqku59q2y8yha3f8wjthzt().Text = .(-905860304) + this.□;
this.ewdjpey32vjqku59q2y8yha3f8wjthzt().Text = .(-905860347) + this.□;
}

:cool:
[Captivate General] Marty25:
Is this happening to anyone else, noticeably slower and seems to drop several battery %'s every 10min even when idle (just like when I first got the phone originally)
[Droid Incredible Q&A, Help & Troubleshooting] nerogold:
Anyone plz I appreciate any knowledge or experience on this, ok I have a replaced dinc from insurance and rooted just like old one but problem is the power button is behaving crazy short press should turn off display and long press should be reboot options but it doesn't even respond and if the screen shuts off power button doesn't wake phone I need to do battery pull. I've checked all cm 6.1 settings same settings as previous dinc. Any help plz I dread having to send the phone back because I'll have to go back to stock before sending it in thanx