At my school, tests were frequently split into two parts, a written part and a practical part. Practicals were done on the computers and submitted before the end of the test through our school's homework submission system.
Mono does not support System.Speech, but at this point I've resigned to having to completely change speech recognition engines if I port to another platform (or maybe by like August 2014 it'll support it). Still, thanks for the links! This looks promising.feep, although I've never done it before, if mono supports the speech library (but unity doesn't), then yeah you should be able to do it no problem. .net has a concept of a managed process called an AppDomain. Usually a process has a single appdomain, but you can create other ones, tell it which libraries (.dlls) to load, and you can communicate between appdomains (not as simply as within an appdomain though). I did a cursory googling, and found that you can spawn new appdomains with unity no problem. So I don't see why you couldn't write a mono library that used the speech dll, and load that at runtime in its own appdomain from unity.
Some quick examples of spawning a new appdomain and loading an arbitrary library into it:
http://blogs.msdn.com/b/kirillosenk...applications-in-process-using-appdomains.aspx
http://stackoverflow.com/questions/3843421/how-to-call-a-method-of-a-class-from-another-appdomain
http://msdn.microsoft.com/en-us/library/system.marshalbyrefobject.aspx
Tell me about it. Our first exam also had Java swing, that wasn't fun at all to write on paper.
# Given
def f(s):
assert type(s) == str and len(s) > 0
if len(s) == 1:
return s
else:
return f(f(s[1:])) + s[0]
# what is the output of
print f('mat')
print f('math')
I have no clue. Can't even figure out what it's telling meThis was a question on the first quiz in Intro to Comp Sci (6.00) at MIT (Spring 2011):
Solve it on paper, of course. It's my understanding that the average grade for that quiz was... not very good.
This was a question on the first quiz in Intro to Comp Sci (6.00) at MIT (Spring 2011):
Code:# Given def f(s): assert type(s) == str and len(s) > 0 if len(s) == 1: return s else: return f(f(s[1:])) + s[0] # what is the output of print f('mat') print f('math')
Solve it on paper, of course. It's my understanding that the average grade for that quiz was... not very good.
Step by step. For 'mat':Code:# Given def f(s): assert type(s) == str and len(s) > 0 if len(s) == 1: return s else: return f(f(s[1:])) + s[0] # what is the output of print f('mat') print f('math')
I can only assume it does something regarding changing positions of letters in the string?
Duuno what f(s[1:]) does so... More specifically the s[1:]. But then again I haven't used python all that much (read not at all)
I have no clue. Can't even figure out what it's telling me![]()
string F(string s)
{
if (string.IsNullOrEmpty(s))
throw new ArgumentException("s is not valid");
if (s.Length == 1)
return s;
else
return F(F(s.Substring(1)) + s.Substring(0, 1);
// Substring(1) takes from index 1 to end of string, fyi
}
>>> word[2:] # Everything except the first two characters
'lpA'
Much better, thanks. Guess I should consider learning Python this summer.On the offhand chance you're not familiar with Python, it would be this in C#:
Code:string F(string s) { if (string.IsNullOrEmpty(s)) throw new ArgumentException("s is not valid"); if (s.Length == 1) return s; else return F(F(s.Substring(1)) + s.Substring(0, 1); }
IIRC s[1] refers to a point in the string and : cuts it at that point.
On the offhand chance you're not familiar with Python, it would be this in C#:
Code:string F(string s) { if (string.IsNullOrEmpty(s)) throw new ArgumentException("s is not valid"); if (s.Length == 1) return s; else return F(F(s.Substring(1)) + s.Substring(0, 1); // Substring(1) takes from index 1 to end of string, fyi }
Step by step. For 'mat':
return f(f('at')) + 'm'
return f( f(f('t') + 'a' ) + 'm'
return f('ta') + 'm'
(Trick: sending in 'at' resulted in 'ta', we now know that it reverses a two-letter sequence)
'atm'
(Trick: sending in 'mat' resulted in a transpose to 'atm')
For 'math':
return f(f('ath')) + 'm'
return f('tha') + 'm'
'hatm'
Someone may correct me if I'm wrong.
atm
hatm
This is inefficient! See my example above...once you "solve" for a certain number of letters, you don't need to redo the steps. f('ab') becomes 'ba'. f('abc') becomes 'bca'. f('abcd') becomes 'dbca'.I lost track somewhere around f(f(f(f('em')+'r')+'a') + 'f'
It really depends. I just do pseudo then move to code to cover my bases.Aren't you allowed to use pseud-code when you doe white board stuff? That would seem pretty easy to me.
Easy!
I can't stand these exams, I don't want to read and study any more of these gibberish slides(i don't mean I'm having trouble understanding the concepts, I mean so poorly explained and written that it becomes a sort of code you can only read once you already know what it's supposed to say) I'm pretty sure the algorithm in the slides for 3 colour problem is wrong, and I think the algorithm posted for knapsack is wrong too.
The practice problems can be equally incomprehensible. GAH.
Your class' slides or what are you talking about?
Ugh, fuck recursion
Back to this...because two appdomains spawn inside the same process, I would have to create a new thread to run the voice recognition stuff simultaneously with the main program, right? Should I just use Process.Start() instead, and use pipes for cross-process communication?feep, although I've never done it before, if mono supports the speech library (but unity doesn't), then yeah you should be able to do it no problem. .net has a concept of a managed process called an AppDomain. Usually a process has a single appdomain, but you can create other ones, tell it which libraries (.dlls) to load, and you can communicate between appdomains (not as simply as within an appdomain though). I did a cursory googling, and it seems that you can spawn new appdomains with unity without any issue. So I don't see why you couldn't write a mono library (dll) that used the speech dll, and load that at runtime in its own appdomain from unity. Then you'd have to communicate between the two appdomains and have the library do whatever stuff you need. It's all in-memory, not network communication or anything. Although a lot of resources will recommend network communication between them, but I doubt they need any kind of performance when doing so.
Some quick examples of spawning a new appdomain and loading an arbitrary library into it:
http://blogs.msdn.com/b/kirillosenk...applications-in-process-using-appdomains.aspx
http://stackoverflow.com/questions/3843421/how-to-call-a-method-of-a-class-from-another-appdomain
http://msdn.microsoft.com/en-us/library/system.marshalbyrefobject.aspx
It doesn't have to be in a separate thread. You can call stuff in the second appdomain from the first one, and the calls will be on the executing thread.Back to this...because two appdomains spawn inside the same process, I would have to create a new thread to run the voice recognition stuff simultaneously with the main program, right? Should I just use Process.Start() instead, and use pipes for cross-process communication?
This was a question on the first quiz in Intro to Comp Sci (6.00) at MIT (Spring 2011):
Code:# Given def f(s): assert type(s) == str and len(s) > 0 if len(s) == 1: return s else: return f(f(s[1:])) + s[0] # what is the output of print f('mat') print f('math')
Solve it on paper, of course. It's my understanding that the average grade for that quiz was... not very good.
All programming exams at my university are on paper. I don't know if that's what everyone does, but it sure sucks in any case.
It is for TCAE.I'd love to help you out with this Feep (especially since I assume this is for There Came an Echo?) but I don't think I have the time. Do you just want to call existing functions in the windows SAPI or do you need a more robust interface?
This would make a decent whiteboard question at a job interview. Personally, I'd use something like this to get accustomed to writing/talking through recursive problems.
I haven't tested this, but I believe it's equivalent.Is there some way to translate this to C/C++ or should I just learn C#? Would love to get better at recursion.
#include <iostream>
#include <string>
#include <cassert>
// Given
std::string f(std::string s) {
assert(s.size() > 0);
if(s.size() == 1)
return s;
else
return f(f(s.substr(1))) + s[0];
}
// what is the output of
int main() {
std::cout << f("mat") << std::endl;
std::cout << f("math") << std::endl;
}
I haven't tested this, but I believe it's equivalent.
Code:#include <iostream> #include <string> #include <cassert> // Given std::string f(std::string s) { assert(s.size() > 0); if(s.size() == 1) return s; else return f(f(s.substr(1))) + s[0]; } // what is the output of int main() { std::cout << f("mat") << std::endl; std::cout << f("math") << std::endl; }
I haven't tested this, but I believe it's equivalent.
Code:#include <iostream> #include <string> #include <cassert> // Given std::string f(std::string s) { assert(s.size() > 0); if(s.size() == 1) return s; else return f(f(s.substr(1))) + s[0]; } // what is the output of int main() { std::cout << f("mat") << std::endl; std::cout << f("math") << std::endl; }
Who wants to talk about ruby on rails? Its the only thing I want to work in but at work I have to do .net and C# and my network class is in C. I love ruby.
Who wants to talk about ruby on rails? Its the only thing I want to work in but at work I have to do .net and C# and my network class is in C. I love ruby.
rant: trying to land another job after getting laid off a few weeks back. can't get anything, and only blaming myself. getting frustrated and depressed for being too dumb. thinking i should take a step back and brush up instead of rushing into tech interviews where i've just been fumbling around.
Who wants to talk about ruby on rails? Its the only thing I want to work in but at work I have to do .net and C# and my network class is in C. I love ruby.
rant: trying to land another job after getting laid off a few weeks back. can't get anything, and only blaming myself. getting frustrated and depressed for being too dumb. thinking i should take a step back and brush up instead of rushing into tech interviews where i've just been fumbling around.
Get a whiteboard if possible and practice practice practice. If that's not possible, pen and paper practice. Think of any possible interviewer questions you can, also search on-line.
Good luck.
Yeah new milestone in minor project.
Homogeneous line clipping took way more work to implement a good enough working version. And it still has some bordercases where it falls short
/sucks at math and reading![]()
Wanted to share an interesting exercise I saw at data structure and algorithms class: create a class Queue<T> (in Java) that only uses (the minimum possible amount of) stacks in it's implementation (that is, you can't have any other variables). Implement the methods: add(T element), remove(), isEmpty(). Once you figure it out it's very easy.
I've been thinking about signing up to one of the Ruby on Rails classes there are out there. It's what all the cool kids are doing nowadays and from what I've seen, can be utilised to produce powerful applications.
I'm fairly good with PHP but I could do with learning something new. May give it a shot just as soon as my exams are over.
I'm a software engineering student, and almost my classes/projects are in C or Java, but last semester I did an 8-month co-op in a startup on a Rails app. It's so hard going back to Java (I have a JEE course this semester, so Rails only more verbose and uglier and slower to code) after Ruby.
It spoiled me. I can't go back to anything else now. Even Python looks ugly to me (but I can handle it).
I like Python but I can see where it looks uglier. They are both useful I just really enjoy the breadth and depth of ruby. Its just fun to use.
Yeah new milestone in minor project.
Homogeneous line clipping took way more work to implement a good enough working version. And it still has some bordercases where it falls short
/sucks at math and reading![]()
Ruby's awesome, and Rails is quite useful. I don't think there's an easier way to build a unique, custom web application without it. I guess you should try to check out C#'s MVC and Entity stuff though.Who wants to talk about ruby on rails? Its the only thing I want to work in but at work I have to do .net and C# and my network class is in C. I love ruby.
Been messing around with PHP and Ruby since asp.net has been giving me fits when it comes to RESTful stuff (400/401 errors everywhere :<)
They are pretty cool though, I'm thinking of continuing to use them on my own to build up my skills with them. Is there anything like Code Academy for PHP? The Ruby stuff has seemed alright so far.
Looks interesting, are you learning Direct3D/OpenGL by any chance?
Edit:
Wanted to share an interesting exercise I saw at data structure and algorithms class: create a class Queue<T> (in Java) that only uses (the minimum possible amount of) stacks in it's implementation (that is, you can't have any other variables). Implement the methods: add(T element), remove(), isEmpty(). Once you figure it out it's very easy.