1 July 2011

Html show hide button

I've set up a new blog where i can post my MSc project user entry system on there. At the moment i have a long way to go. Any way at the moment i have a couple of buttons that are meant to display information on line of code but you can't hide it so i remembered xkcd had the spoiler hide show code but it looked a bit complicated so i searched elsewhere and found this website and it looked amazing and from these two i developed my own version of hide and show tailored to my specs.

<!--my code for info button-->
<button type="button" onclick="if (document.getElementById('PartitionSource Info').style.display !=''){
document.getElementById('PartitionSource Info').style.display='';
document.getElementById('PartitionSource Info').innerHTML='infomation based on button';
}
else{
document.getElementById('PartitionSource Info').style.display='none';
}">
Info
</button>
<p id="PartitionSource Info" style="display: none">
text</p>

And here is the actual button


22 June 2011

Lists using HTML and JavaScript

After browsing the web for ages on trying to work out how to do expansions of lines for excel, I gave up. It seems it is easy to expand rows but to do automatically is not. So I moved on to html. Someone directed me to W3schools as a recommendation, I do recommend it. Anyway lists, I am going to use the same example as last time.


<h2>Physica Module </h2>
<!--Runtime-->
Should the processes be timed and printed at the end of the run?
<form>
<select name="Runtime" id="Physica.Runtime">
<!--default is off-->
<option value="OFF">OFF
<option value="ON">ON
</select>
</form>
<button type="button" onclick="PhysicaModule()">
Submit
</button>
<p id="Runtime Output"> </p>

<script type="text/javascript">
function PhysicaModule()
{
txt=document.getElementById("Physica.Runtime").name+" "+ document.getElementById("Physica.Runtime").value;
document.getElementById("Runtime Output").innerHTML=txt;
}
</script>


the idea is there is dropdown list with two options "ON" and "OFF" and a button underneath called submit. underneath that is a paragraph where we put the results from clicking the button into (at the moment i haven't worked out how to get it into a txt file). Then a bit of javascript that determines what happens when the button is pressed. which hopefully we say "Runtime ON" or "Runtime OFF" depending on what option you choose.


Physica Module


Should the processes be timed and printed at the end of the run?




If the above bit of code doesn't work do it for yourself just remember to put <HTML> at the beginning and </HTML> at the end.

20 June 2011

MSc project

My main goal for my Project was to design a user interface to help create the 'inform' file that can be used for PHYSICA. For this I am deciding whether to use HTML and JavaScript or create it using Excel. So to test it out I am going to create a test case for each that will cover the following critea:
1. Lists. Some lines of code of physica have different options
2. Expansion. This is for if the user wants to specify for example Materials properties and they had multiple materials, space would be required.
3. Write to file. In each case I need to know how easy it is to write to file
4. Read from file. this is for if the user need to change something. this is more tricky.

Now the hard part my knowledge of both is not extensive so hopefully when I learn something new I'll post it on here (I hope).

Starting on Excel 1st.
Lists. From my research from today there are two ways of creating lists.
No Visual basic required

1st thing 1st you need to specify options for your list. My list is commands for a bit of code called 'Runtime' the options are "ON" or "OFF" this I put in column E. For the user I have put a prompt in Cell A2 simply called 'Runtime'


Now select the cell B2 then go to data tab and click Validate.


Although this is a mac version of Excel the options are similar for Windows users. In the drop down option select "list" and then specify what the options are and then your done.


Visual Basic form of a list.
Actually there are multiple ways of creating lists. One option is using a "Combo Box" but since I want it in the cell I'm not going to cover this.

Sub test()
Dim sList As String
Dim N As Integer
Dim dv As Validation

sList = "On,Off"
Set dv = Range("C2").Validation
dv.Delete
'.delete i think will clear the range it has been assigned
dv.Add xlValidateList, xlValidAlertStop, xlBetween, sList
'expression.Modify(Type, AlertStyle, Operator, Formula1, Formula2)
'below is what may have to use for intergers problem
'i tested the word thing if you enter something than not on the list it give a warning box
'website=http://msdn.microsoft.com/en-us/library/bb210323%28v=office.12%29.aspx
End Sub

if you see ' line its a comment.
To be honest I did adapt it from this website

There is another way which is good to use for constraints on variables(from this website).

With Range("e5").Validation
.Add Type:=xlValidateWholeNumber, _
AlertStyle:= xlValidAlertStop, _
Operator:=xlBetween, Formula1:="5", Formula2:="10"
.InputTitle = "Integers"
.ErrorTitle = "Integers"
.InputMessage = "Enter an integer from five to ten"
.ErrorMessage = "You must enter a number from five to ten"
End With


Hope you learned something I know I did.

UPDATE 21/6/2011 09.49AM
Just found out he second bit of code crashes if you run it more than one so it should be:

sub test()
Set dv = Range("B4").Validation
With dv
dv.Delete
.Add Type:=xlValidateDecimal, _
AlertStyle:=xlValidAlertInformation, _
Operator:=xlBetween, Formula1:="0", Formula2:="10"
.InputTitle = "Real"
.ErrorTitle = "Must be Real"
.InputMessage = "Enter an Real from zero to ten"
.ErrorMessage = "You must enter a number from zero to ten"
End With
End Sub

17 May 2011

interesting links 18/4/11 till today

Sorry for the delay I had 2 exams to revise for and i still have 2 courseworks to do before 27th may. I know. lovely!

Maths
#MathMaths 43: mosquitoes, ants & northern hairy-nosed wombats; ethnomathematics; routefinders; new symmetries; & more bit.ly/h3dfLF

how rude, and brilliant. Contradiction - Spiked Math http://t.co/l8MEp5N

Math/Maths 44: Prehistoric Sat-nav is back; @MoMath1 site; $24m book; 911 math help; snow; flu; sex; sport; Glee & more http://bit.ly/fvHeYf

RT @PeterRowlett nice 'optimisation gone wrong' case: Amazon's $23,698,655.93 book about flies http://bit.ly/fzTYlr

OR blogs i found:
ThinkOR http://t.co/WhFi8bO
Michael Trick has a few blogs http://bit.ly/5HNITY

The Movie Math Quiz Part 4 - Spiked Math http://t.co/Z8o2g4H

voting system on @PlusMathsOrg http://bit.ly/ibpAt4 and the wiki article on Arrow's paradox http://bit.ly/aiIO3r

ooh funky science i like BBC - Bang Goes the Theory - Hands-on Science http://t.co/XzBxipt

#MathMaths 45: Will Grigori ever speak to the press again?; AV; blood TSP; time; tombs; evidence-based policy & more bit.ly/iTusAZ

#MathMaths 46: Early Maths Day; Perelman; AV; Han shot 1st!; Paul the Octopus; PvNP; Humanistic Math; circadas; & more http://bit.ly/ilLC3Z

http://www.mathsjam.com/

JOST A MON: Carnival of Mathematics 77 http://t.co/V8bY5Uv

ha ha ha-sex and maths- Math Jokes 4 Mathy Folks http://t.co/I7yOhIS

#MathMaths 47: fave nums; 6/2(2+1); is maths finished? discovered or created?; arts v. science; stereotypes; and more. bit.ly/jcZlwl
Next MathMaths will be streamed live hopefully around saturday 4th June.

Gadgets and tech
Square-the amazing card payment for iphone, very nice http://t.co/L6cX8yL

easter eggs in your mac http://t.co/9NPrg33 via @theappleblog

spotify changes for free account http://t.co/iE6XTGy it's good well it wont affect me much

LiveProfile - blackberry, android and iphone- http://itun.es/i6R3Jh #iTunes #freetexts my cousin told me alright so leave it out- i have to say i may have more free texts/calls apps than people to actually use it with, some people would call it ironic!

blocks website for a certain time frame- may improve my revision....LeechBlock :: Add-ons for Firefox http://t.co/ywoXX71

Spotify download service takes on iTunes by The Gadget Show http://t.co/jSIec12

amazing if it was in the uk, earn money by walking around-Gigwalk in the iTunes App Store http://t.co/jDeNsSp

1st person video game with no video, its an audio experience- 5 stars-Papa Sangre http://t.co/5vvonqI the website http://t.co/ZVdftFV

Random
YouTube - The Axis of Awesome - Lazyeye (007) http://t.co/feTOtZq it made me laugh

RT @Nitrome: Hey Nitromians, Our highly anticipated game "SteamLands" has now been released! http://bit.ly/egc9gn

@Steven_moffat seems like he's starting on Sherlock Holmes

Luv@FirstTweet | Twitter Online Dating, Tweet and Meet, Connect with Singles http://t.co/8hYSLFu

nice pics RT @big_picture: The Royal Wedding http://t.co/O7RMhRd #royalwedding #rw2011

Super 8-shooting movie on iphone, i think its based on a film of the same name which is coming out soon ish http://t.co/d8Af5el

House is renewed for an 8th season

RT @Nitrome: Hi Nitromians! We have released our latest game Test Subject Green! :D check it out here! http://bit.ly/jZg3XJ

just updating my glee spotify playlist http://bit.ly/hdHuoY

18 April 2011

Interesting links 7/4/11 till today

Apple
How To Connect iChat to MSN, Facebook, and More: Apple News, Tips and Reviews « http://t.co/nMYJglO

Guardly Turns iPhone into Personal Security Guard: « http://t.co/P0WNUsK via @theappleblog only catch is it's only available in the US itunes store.

Fahrenheit and celsius app- love how it updates itself, check the pic it's really genius http://t.co/p5g4Fkp via @theappleblog

Gadgets
sell old mobiles, ipods, laptops for money or high street vouchers http://t.co/07A6jC2 via @thegadgetshow

Maths
from @Noelann Interested in simulation? Tip from #yor17, check out http://t.co/8ZrejeJ

The Hidden Science Map | Future Morph http://t.co/rJlBRpE this will be available for 6 months i believe.

RT @PeterRowlett: Remember to listen to @Noelann on the @uniofgreenwich Maths Cafe in this 3 min audio podcast http://bit.ly/mathshe @HESTEM

Video: Benford’s Law - How mathematics can detect fraud! (by singingbanana) http://tumblr.com/xqt21v143m

Greenwich Maths Time: Young Operational Research Society Conference http://t.co/rE4pDKs

Walking Randomly » Carnival of Math #76 http://t.co/Pxk6wiu via @walkingrandomly

#MathMaths 42: guest @mathsinthecity; Pioneer Anomaly; 3D Knight's Tour; @Google grants; FBI crypto; @Mangahigh; & more http://bit.ly/f3Yd5Y

citizen science links- Bang Goes the Theory, Series 4, Episode 5 http://t.co/EO5dQMg

Movies
there is a trailer for Johnny English 2, the trailer does look funny, i want to see it http://t.co/q8c6Os8

7 April 2011

interesting links

unfortunately I didn't realise how much time my MSc would take of my personnel time so this is a short blog on links I have discovered on twitter and blogs I read. Enjoy. since i plan to keep this up weekly (it may not) i am going to look back to 24 march till today.

Maths and Stats
How to write math equations (integrate Latex) in Blogspot/Blogger « Mathematics and Multimedia

apparently this is googles uk magazine website 'think quarterly' with data but i can't seem to get it to work...

a fractal joke, very nice-Math-Frolic http://t.co/qKfGAYQ

Bank note in india £0 http://t.co/cQ5ZW5P

a MATLAB like environment-Scilab WebSite http://t.co/THxwGN7
according to @walkingrandomly 's blog

we're sorry the number you have dialed is imaginary. please rotate your phone 90 degrees and try again MJ4MF maths jokes

cryptology no reward but definitely a challenge-FBI — Help Solve an Open Murder Case, Part 2 http://t.co/uYhhzXv #maths #puzzle via @alexbellos

In America it is Math Awareness Month http://t.co/uOGlvUX link via Math-Frolic

Maths podcast MathMaths http://t.co/dhxD3y3

Math Poems from MJ4MF

Plus podcast on sport engineers or read the article

Film and TV
RT @RottenTomatoes: Captain America: The First Avenger trailer pumps it up. Watch it: http://bit.ly/gC65Rt

Prequel for Doctor who

Hugh Laurie sings http://bit.ly/h71wrA

Gadgets
Android and me

MoxierWallet secure your accounts http://t.co/gGFBNsi

Viper- free calls on iPhone, iPad and iPod link via theappleblog

Plugin for your browser- Tineye find out who is in a picture http://t.co/JuOP1fQ

Video of game on iPad called Slice (knives and blood) http://t.co/PoSHbgx

Social
New And Improved! 62 Movie Twitterers You Should Follow-Empire http://t.co/y4AdcO0

Axis of Awesome-youtube video "Can You Hear the F***ing Music Coming Out of My Car?" http://t.co/aI00IjS

Nitrome game-Knight trap

Glee spotify playlist http://bit.ly/dQlN9d

6 March 2011

iMovie 09 editing: delete video keep audio

I have a lot of video at home, most of them movies. My plan is to convert them to DVD for home use only (no crime has been committed). My first job was to find something to connect my video to my computer, i found something online for £60. Then I had to find wires to connect it up (it didn't come with it), which I had because we had to connect it to the tv somehow. Recording it was fine, but its the edits which is hard. which brings us to iMovie 09.

Editing clips and cutting out segment is easy. Just split the clip into however many segments, now selected the clip you don't want and then delete clip selection. Told you it was easy.

I had a problem on one film, the video paused but the audio just kept on going. My first thought was split the clip and detach the audio and move the audio along. But no, you can move the audio back but not forwards. So I moved another copy of the film over to the project bit (at the end), edited the clip (i.e. listening to the clip), detaching the audio and moving the audio back to where the video froze. Then just to make sure the old audio doesn't get in the way, i went to audio adjustments and used ducking (other track can be reduced in volume) and bingo bango baby it's done.

update- forgot to mention you then delete the video from that clip you imported. Also in case you didn't know if you delete the clip you also delete the audio that goes with it, it's a pain in the arse, I know