Wednesday, August 4, 2010
understanding physics 01: derivation of fundamental linear motion equations
i'm tutoring someone in physics again and i was thinking about how to explain why conservation of energy is so fundamental in physics but specifically in classical mechanics while driving to work this morning. one of the reasons i love physics more than other sciences is that it conceptual understanding doesn't require excessive blind memorization of symbols, constants, tables, taxonomic ranks, etc. If you can remember Newton's laws, understand that energy is conserved, know how work relates to force, distance and direction, you pretty much just need two equations and basic calculus to solve any problem through intermediate mechanics: F=ma and v=dx/dt. there are numerous equations you could memorize to solve problems involving linear and angular motion, but all of them are derived from v=dx/dt (i guess you also need to know that there are 2pi radians in a circle for angular motion problems). i remember that at the start of every exam, i would derive the equations for distance, velocity, acceleration and time and, for whatever reason, this would always calm me down. i've decided to see if i can still do it and will post my notes when i finish or give up
Monday, August 2, 2010
jailbreak the iphone 3GS OS 4.01
if you made the terrible, terrible mistake of upgrading your iphone 3GS to OS 4.0 before a jailbreak was released, the day of salvation has arrived. an ingenious 17 year old has released the first OTA (over the air) jailbreak for the iphone which will finally give freedom back to the poor souls on OS 4.0. backup your iphone and then open safari and navigate to http://jailbreakme.com. note that it took me three tries before the download started so don't give up if it doesn't appear to work the first time. a progress bar and status message will inform you when the download is complete and then once the jailbreak is complete and cydia is installed. if you have not already done so, allow cydia to store your ECID
Friday, May 14, 2010
jailbreak the ipad or iphone 3G/S OS 3.1.3
it is again possible to jailbreak your iphone if you made the mistake of upgrading the OS to 3.1.3 (or broke your phone and had to buy a new one that already had the damn thing on there). spirit is a small (4,464 KB), free application that jailbreaks your iphone with the click of one button in ~30 seconds including the reboot. it will also jailbreak your ipad but i won't know the amount of time that it takes until mine arrives next week :) (edit: ipad jailbreak ~15 seconds)
recommended applications once your device is free from the controlling, icy grips of apple:
- infinidock - dock as many applications as you please (well worth the $.99 cents)
- five column springboard - five columns of apps on every screen instead of four (free) (edit: note - do not install this on an ipad. it will add a fifth column but all of your icons will squish together)
- sbsettings - bossprefs 2.0. slide your finger across the top of the screen to access all of your phone information and change configure any setting you can imagine (free)
- backgrounder - run applications in the background. from experience, this is much more useful if you have a 3GS that can handle it (free)
- mxtube - save youtube videos to your phone (free)
- yourtube - like mxtube but integrated with existing youtube app ($2.00)
- lockdock - launch applications from your lock screen ($2.00)
- installous -don't feel like paying for that appstore application? get it for free using installous (free)
- appsync -include cracked applications when you backup/restore your iphone (free)
the latter two apps require you to first add the hackulo repository (from cydia: manage -> sources -> edit -> add, enter cydia.hackulo.us and click 'add source')
Wednesday, July 1, 2009
jailbreak the iphone 3G OS 3.0
jailbreaking an iphone is a process that allows you to install applications without having apple approve them first - it's your phone, you should be able to put whatever you want on it. having said that, the freedom you gain by jailbreaking comes at the cost of being kicked out of the nest and out from under the protective wing of apple. i don't know but doubt there are possible legal ramifications for jailbreaking but i can guarantee that shiny icare protection plan you bought isn't worth the cardboard it came in if you send in a hacked phone and ask apple to please fix the booboo. get the facts, weigh the pros and cons and know why you are doing this before you start.
...or you could be reckless and cavalier like me and just do it because it sounds cool
i used the information found here as a guide and highly recommend it; however, if you understand what you're about to do and/or you've been reading about the experiences of others, you should realize that jailbreaking doesn't always go as planned. i you didn't realize that, you should and you do now, but you should also realize that as long as you don't freak out or at least refrain from physically stopping the process (e.g. disconnecting the pc power cord or turning off your laptop, disconnecting the phone from the pc, formatting your hard drive during the jailbreak, etc.), at worst you should have your phone back to where it was before you started toying with it in an hour or two. here is my interpretation of the information presented in the link above and how i'd walk someone through the jailbreak (draft one since work is calling):
...or you could be reckless and cavalier like me and just do it because it sounds cool
i used the information found here as a guide and highly recommend it; however, if you understand what you're about to do and/or you've been reading about the experiences of others, you should realize that jailbreaking doesn't always go as planned. i you didn't realize that, you should and you do now, but you should also realize that as long as you don't freak out or at least refrain from physically stopping the process (e.g. disconnecting the pc power cord or turning off your laptop, disconnecting the phone from the pc, formatting your hard drive during the jailbreak, etc.), at worst you should have your phone back to where it was before you started toying with it in an hour or two. here is my interpretation of the information presented in the link above and how i'd walk someone through the jailbreak (draft one since work is calling):
- connect your iphone to your pc and allow it to fully synchronize. this gives you a point-in-time backup of your phone and later allows you to automatically recover all of your apps/contacts/settings/etc. and keep the jailbreak.
- download the 3.0 installation package manually. you will have one locally if you upgraded to 3.0 through iTunes, but i was unable to get through the first reboot of the jailbreak using this file.
- download and extract redsn0w (i'd do as they say and use the torrent they certify). it doesn't matter where you place or what you name the folder that will contain the extracted files.
- run redsn0w and browse to and select the .ipsw file you downloaded. i don't know if your phone has to be on and attached to your pc at this point but i would assume so since the application appears to verify that the OS version on your phone matches the one from the file.
- (edit: i seem to have issues with redsn0w completing if my phone is password protected. to be on the safe side, i would disable this feature before continuing) do as redsn0w says but don't freak out if you don't time something perfectly. your phone will visibly react to both the initial two second hold of the power button and the following ten second hold of both the power button and the home button; however, it never took more than 13 seconds on the final step of holding just the power button for redsn0w to take over (the screen will flash and display an image and a message stating that installation started). once you see this you can let go of the home button and let redsn0w do the work from there.
- occupy yourself with something else for the next twenty or thirty minutes because the install takes time. if you sit there and stare at it, you run the risk of worrying that it is taking too long and freaking out and doing something stupid and possibly dangerous to your phone.
- once you can get back to your home screen, detach and then reattach your phone to the pc. this will confuse itunes and it will ask you if it should treat the phone as new or if it should restore the phone from a backup. select the backup you created in step 1. and continue. this will likely take longer than the actual jailbreak but you are in the clear at this point.
- after itunes finishes restoring the backup and synchronizing, you will have a phone that does everything you loved before but is no longer under the all-seeing eye of the apple gestapo.
- b. if the phone never comes back from rebooting (i.e. stays powered off), just cancel the jailbreak, detach the phone from the pc (probably optional) and turn it back on - you will see it is perfectly fine and looks exactly like it did before you initiated the jailbreak.
Friday, April 25, 2008
CONDG Presentation
I'm very grateful to all those who attended the presentation Scott and I gave last night. I will be doing a screencast next week of the demo that I was unable to get to due to technical difficulties. I guess I need to clear up something that I said last night because I was asked about this more than anything else:
Johnny Cash was an immensely influential American singer and song writer and is probably the most recognized country musician of all time. His 'calling card' and what most people associate with him was the dark clothing he wore, usually all black, hence the crack on myself before I gave my presentation
Johnny Cash was an immensely influential American singer and song writer and is probably the most recognized country musician of all time. His 'calling card' and what most people associate with him was the dark clothing he wore, usually all black, hence the crack on myself before I gave my presentation
Tuesday, April 15, 2008
.NET Garbage Collection PopQuiz Quick Answers
all credit to Tess for this.
the original quiz can be found here
Tess's answers and further explanation can be found here
1. How many GC threads do we have in a .NET process running the Server version of the GC on a dual-core machine?
A: server version = one thread per logical processor = two threads (four if hyper threaded)
2. What GC mode is used in the web development server (cassini) on a quad proc machine? Why? (you can choose from server, workstation or concurrent-workstation)
A: cassini = windows forms app = user interaction = use concurrent-workstation
3. How many finalizer threads do we have in a .NET process running the Server version of the GC on a quad proc machine?
A: Tess states that the answer is one per process. further investigation only lead to more confusion - server version of GC on a quad proc machine means four GC threads (eight if hyper threaded). i believe the answer is either one or four/eight. i'll keep reading and update this when i find an explanation that makes sense to me
UPDATE: the gentleman walker looked into this and found that, at a given time, there is one per .NET process with a maximum equal to the sum of the number of worker process allocated to each application pool. the process will only show up in taskman if the associated app pool/web site is in use
4. When is an object garbage collected?
A: when the object is no longer referenced and a GC occurs for the generation your object is in
5. What causes an object to move from Generation 0 to Generation 1 or to Generation 2?
A: the object is still referenced when a GC occurs for the generation the object is in
6. If you look at the GC sizes for Generation 0, 1 and 2 in perfmon, why is most of the memory in the process in Gen 2?
A: gen 0 and gen 1 have small sizes (though these sizes are not fixed); gen 2 does not. since GC occurs when gen 0 and gen 1 are nearly 'full', referenced objects will eventually end up in gen 2 where they will remain for the remainder of their life (i.e. until they are no longer referenced and eventually cleaned up)
7. How many heaps will you have at startup on a 4 proc machine running the server GC? How many would you have if the same machine was running the workstation GC? Will the memory used for these show up in private bytes or virtual bytes in perfmon or both?
A: one small object heap and one large object heap per logical processor for server GC; one small object heap and one large object heap in workstation GC. as far as the memory part of the question, this is how i understand it - virtual bytes corresponds to memory reserved by a process, whereas private bytes is the memory actually being used by the process. if all goes smoothly, the graphs for these will follow each other which means the process is allocating memory correctly. at startup, virtual bytes may be a lot larger than private because the reserved memory hasn't been used it, but private bytes should eventually catch up to an extent and both should smooth out in perfmon
8. (Leading question:)) Is the fact that you have mscorwks.dll loaded in the process in 2.0 an indication of that you are running the workstation version of the GC?
A: no; in 2.0, both the server and workstation versions of the GC reside in mscorwks.dll
9. Can you manually switch GC modes for a process? If so, how and under what circumstances?
A: the answer is "yes, but...". i'll leave Tess to explain the restrictions:
a) you can not run the server version on a single proc box, it will default to workstation
b) you can not run concurrent while also running server
c) if the runtime is hosted, the hosts GC mode will override the configuration
10. Name at least 2 ways to make objects survive GC collections unnecessarily.
A: create an unnecessary finalize method. create a objects within a method and then have the method perform some action for a long time, preferably one that causes memory pressure which will trigger a GC and the referenced objects will not be collected
11. Can a .NET application have a *real* memory leak? In the C++ sense where we allocate a chunk of memory and throw away the handle/pointer to it?
A: not in the C++ sense, but leaking memory is quite possible. see Tess lab 6 (which was also covered in my presentation)
12. Why is it important to close database connections and dispose of objects? Doesn't the GC take care of that for me?
A: disposing the objects releases their resources and makes them available for GC immediately (note: calling dispose on an object does not trigger a GC)
the original quiz can be found here
Tess's answers and further explanation can be found here
1. How many GC threads do we have in a .NET process running the Server version of the GC on a dual-core machine?
A: server version = one thread per logical processor = two threads (four if hyper threaded)
2. What GC mode is used in the web development server (cassini) on a quad proc machine? Why? (you can choose from server, workstation or concurrent-workstation)
A: cassini = windows forms app = user interaction = use concurrent-workstation
3. How many finalizer threads do we have in a .NET process running the Server version of the GC on a quad proc machine?
A: Tess states that the answer is one per process. further investigation only lead to more confusion - server version of GC on a quad proc machine means four GC threads (eight if hyper threaded). i believe the answer is either one or four/eight. i'll keep reading and update this when i find an explanation that makes sense to me
UPDATE: the gentleman walker looked into this and found that, at a given time, there is one per .NET process with a maximum equal to the sum of the number of worker process allocated to each application pool. the process will only show up in taskman if the associated app pool/web site is in use
4. When is an object garbage collected?
A: when the object is no longer referenced and a GC occurs for the generation your object is in
5. What causes an object to move from Generation 0 to Generation 1 or to Generation 2?
A: the object is still referenced when a GC occurs for the generation the object is in
6. If you look at the GC sizes for Generation 0, 1 and 2 in perfmon, why is most of the memory in the process in Gen 2?
A: gen 0 and gen 1 have small sizes (though these sizes are not fixed); gen 2 does not. since GC occurs when gen 0 and gen 1 are nearly 'full', referenced objects will eventually end up in gen 2 where they will remain for the remainder of their life (i.e. until they are no longer referenced and eventually cleaned up)
7. How many heaps will you have at startup on a 4 proc machine running the server GC? How many would you have if the same machine was running the workstation GC? Will the memory used for these show up in private bytes or virtual bytes in perfmon or both?
A: one small object heap and one large object heap per logical processor for server GC; one small object heap and one large object heap in workstation GC. as far as the memory part of the question, this is how i understand it - virtual bytes corresponds to memory reserved by a process, whereas private bytes is the memory actually being used by the process. if all goes smoothly, the graphs for these will follow each other which means the process is allocating memory correctly. at startup, virtual bytes may be a lot larger than private because the reserved memory hasn't been used it, but private bytes should eventually catch up to an extent and both should smooth out in perfmon
8. (Leading question:)) Is the fact that you have mscorwks.dll loaded in the process in 2.0 an indication of that you are running the workstation version of the GC?
A: no; in 2.0, both the server and workstation versions of the GC reside in mscorwks.dll
9. Can you manually switch GC modes for a process? If so, how and under what circumstances?
A: the answer is "yes, but...". i'll leave Tess to explain the restrictions:
a) you can not run the server version on a single proc box, it will default to workstation
b) you can not run concurrent while also running server
c) if the runtime is hosted, the hosts GC mode will override the configuration
10. Name at least 2 ways to make objects survive GC collections unnecessarily.
A: create an unnecessary finalize method. create a objects within a method and then have the method perform some action for a long time, preferably one that causes memory pressure which will trigger a GC and the referenced objects will not be collected
11. Can a .NET application have a *real* memory leak? In the C++ sense where we allocate a chunk of memory and throw away the handle/pointer to it?
A: not in the C++ sense, but leaking memory is quite possible. see Tess lab 6 (which was also covered in my presentation)
12. Why is it important to close database connections and dispose of objects? Doesn't the GC take care of that for me?
A: disposing the objects releases their resources and makes them available for GC immediately (note: calling dispose on an object does not trigger a GC)
Wednesday, March 12, 2008
iTunes and QTFairUse
if you're like me and simply prefer the .m4a file extension to the .m4p file extension that hangs from the end of files newly purchased from iTunes, you probably use either QTFairUse (QT) or myFairTunes. to continue to purchase music from the iTunes store, i was forced to upgrade to at least version 7.4. i also noticed earlier that QT was no longer functioning correctly - it would just spit out the name of all the songs on my list preceded by the test 'could not play track'. i figured an upgrade/reinstall wouldn't hurt and may actually solve both problems. the download page for the iTunes installer only allows you to download version 7.6; however, the latest version that QT 2.5 supports (despite the readme file saying that the max is 7.0.2) is 7.5. luckily, i always keep a local copy of the iTunes installer for the latest version supported by QT.
<tangent>
am i the only one to notice a strange correlation between the timing of QT supporting the most current version of iTunes and iTunes prompting me to upgrade to a newer version that contains just fuckloads of new features. ever wonder why iTunes seems to be the only product that doesn't come with a 'what's new' document, or why you can't find any reference to this on their website? that's because, as far as i can tell, nothing new has been added since 6.0 - maybe even somewhere in the 5.x realm. why can't the assholes just admit that the only new feature is a new encryption key to keep the crackers (the computing type, not white people in general) off their tails for a few months?
</tangent>
that was the background, here is the problem: i upgraded to 7.5 and was able to download my music, but QT kept saying it couldn't find my music library. i navigated to my music folder and found an assload of .itl and .xml files with ' - copy (n)' and even some ' - copy (n) copy' appended to the filename, where n went as high as five or six. i assumed these were created by QT since there is an option to backup the current library and this option is selected by default. what i couldn't find was the non-copied version of my library, which is what QT was looking for. i moved all of these .itl and .xml files to a backup folder thinking that iTunes would prompt me for the location of my library and i could just rename my latest copy to the default name and put it back in the original location and everyone would be happy. this didn't happen. iTunes instead created a new .itl and .xml file with ' - copy (x)' (can't remember which it was) in the default location and the application came up with nothing in my music library.
solution: close iTunes, then hold down shift and launch it again. it will prompt you to use an existing library or create a new one. at this point, you can copy one of the backups to the default location, give it the default library name, and you will have all your music back in your library and the ability to strip your songs of evil, evil copyright protection once again
p.s if anyone needs either the installer for iTunes or QT, feel free to contact me.
<tangent>
am i the only one to notice a strange correlation between the timing of QT supporting the most current version of iTunes and iTunes prompting me to upgrade to a newer version that contains just fuckloads of new features. ever wonder why iTunes seems to be the only product that doesn't come with a 'what's new' document, or why you can't find any reference to this on their website? that's because, as far as i can tell, nothing new has been added since 6.0 - maybe even somewhere in the 5.x realm. why can't the assholes just admit that the only new feature is a new encryption key to keep the crackers (the computing type, not white people in general) off their tails for a few months?
</tangent>
that was the background, here is the problem: i upgraded to 7.5 and was able to download my music, but QT kept saying it couldn't find my music library. i navigated to my music folder and found an assload of .itl and .xml files with ' - copy (n)' and even some ' - copy (n) copy' appended to the filename, where n went as high as five or six. i assumed these were created by QT since there is an option to backup the current library and this option is selected by default. what i couldn't find was the non-copied version of my library, which is what QT was looking for. i moved all of these .itl and .xml files to a backup folder thinking that iTunes would prompt me for the location of my library and i could just rename my latest copy to the default name and put it back in the original location and everyone would be happy. this didn't happen. iTunes instead created a new .itl and .xml file with ' - copy (x)' (can't remember which it was) in the default location and the application came up with nothing in my music library.
solution: close iTunes, then hold down shift and launch it again. it will prompt you to use an existing library or create a new one. at this point, you can copy one of the backups to the default location, give it the default library name, and you will have all your music back in your library and the ability to strip your songs of evil, evil copyright protection once again
p.s if anyone needs either the installer for iTunes or QT, feel free to contact me.
Subscribe to:
Posts (Atom)