How to make the first matrix look like the latter?
The code of the first matrix is:
$$F(x)=\left(
\begin{array}{cc}
\frac{x}{2} & 0 \\
0 & x^2\\
\end{array}\right)$$
string candidates = new string[] {
"Luke_jedi", "Force_unknown",
"Vader_jedi" , "Emperor_human", "r2d2_robot"
};
string[] disregard = new string[] {"_robot", "_jedi"};
//find those that aren't jedi or robots.
var nonJedi = candidates.Where(c=>
c.??? //likely using EndsWith() and Any()
);
How would you implement this solution using LINQ to find all those that do not end with any of the disregards items?
Hello to everybody,
I was trying to output Excel's data to a text file to use them in MySQL, nevertheless i was not able to find an easy solutio because at the end of each row I have to add manually a "TAB" ! Otherwise there are always errors in the MySQL table, is there any special data format to export these data from Excel 2003 ?
Thanx for your help
Alex
I have a simple Ruby script that looks like this
require 'csv'
while line = STDIN.gets
array = CSV.parse_line(line)
puts array[2]
end
But when I try using this script in a Unix pipeline like this, I get 10 lines of output, followed by an error:
ruby lib/myscript.rb < data.csv | head
12080450
12080451
12080517
12081046
12081048
12081050
12081051
12081052
12081054
lib/myscript.rb:4:in `write': Broken pipe - <STDOUT> (Errno::EPIPE)
Is there a way to write the Ruby script in a way that prevents the broken pipe exception from being raised?
I'm working on a project started in VB9 (VS 2008) and now I've migrated to VS2010 (VB10) but on the production server the IDE is still VS 2008. On my developement enviroment the code compiles fine, but sometimes, - let's say - I forget an _ at the end of the line which causes the VB9 compiler to throw an error.
So the question is, how could I build a project with the VS 2010 IDE but VB9 compiler? Or to force the VB10 compiler into VB9 mode?
I have a simple standalone model that doesn't inherit from ActiveRecord or anything else, called SmsSender. As the name suggests, it delivers text messages to an SMS gateway.
I also have an ActiveRecord model called SmsMessage which has an instance method called deliver:
def deliver
SmsSender.deliver_message(self)
self.update_attributes :status => "Sent"
end
The above is returning uninitialized constant SmsSender. I'm sure this is dead simple, but how can I access the SmsSender class from within my model?
I'm trying to remove the carriage returns (\r) from a file with the following command on AIX, but it's also removing my last line. Any suggestions?
sed -e 's/\r\n/\n/g' ./excprule > ./excprule.tst
Command sequence:
dev1: sed -e 's/\r\n/\n/g' ./test_file ./test_file.tst
dev1: diff test_file.tst test_file
diff: 0653-827 Missing newline at the end of file test_file.
26a27
Trailer 25
I have a java web application that has informix DB as it's back end database , now i take a decision to make my app work with SqlServer so i changed all the informix related syntax into SqlServer, and i may take a decision in the future to switch into oracle so the pain will be repeated again and again, as a result i decided to make my application a DataBase independent one that's able to work with any DB vendor smoothly, but i have no idea till now about how to do that, so your ideas is welcomed.
The catch is you have no SNMP access, not even public.
The end vision is locate a PC in building easily even if PC's are moved around.
The MAC address of the PC is known and the software would run as client on each desktop, reporting back which port the PC was plugged into.
Just a guess: I make an attribute and make it's type "binary". But in the end, how would I use that? I guess there is an NSData behind the scenes? So that attribute actually takes an NSData?
The only thing that I found was Manzana but it crashes while I start the test executable. Can someone tell me some library which can I use to copy/delete files from and to iPhone? Or maybe a console tool which I can use as a back-end.
Markup
<ul class="navigation clearfix">
<li class="navigation-top"></li>
<div class="first-holder" style="height:153px;">
<dl class="hold-items clearfix">
<dd class="clearfix with"><a href="http://site.com" title="Protokoll">Protokoll</a></dd>
<dd class="with-hover"><a href="http://site.com" title="Mein/e Unternehmen">Mein/e Unternehmen</a></dd>
<dd class="with"><a class="face-me" href="http://site.com" title="Erweiterte Suche">Erweiterte Suche</a></dd>
<dd class="with"><a href="http://site.com" title="Abmelden">Abmelden</a></dd>
</dl>
</div><!--[end] /.first-holder-->
<li class="navigation-bottom"></li>
</ul><!--[end] /.navigation-->
Css:
.first-holder{height:304px;position:relative;width:178px;overflow:hidden;margin-bottom:0px;padding-bottom: 0px;}
.hold-items{top:0px;position:absolute;}
.navigation dd.with{line-height:38px;background:url('/images/sprite.png') no-repeat -334px -46px;width:162px;height:38px;padding-bottom:0px;overflow: hidden;}
.navigation dd.with a{position:relative;outline:0;display:block;font-weight:bold;color:#3f78c0;padding-left:10px;line-height:38px;}
.with-hover{background:url('/images/sprite.png') no-repeat -505px -47px;width:178px;height:38px;line-height:38px;overflow:none;}
.with-hover a{position:relative;display:block;font-weight:bold;color:#fff;padding-left:10px}
.navigation-top{background:url('/images/sprite.png') no-repeat -694px -46px;width:160px;height:36px;}
.navigation-top a{display:block;outline:0;height:20px;padding-top:18px;padding-left:138px;}
.navigation-top a span{display:block;background:url('/images/sprite.png') no-repeat -212px -65px;width:8px;height:6px;}
.navigation-bottom{background:url('/images/sprite.png') no-repeat -784px -402px;width:160px;height:37px;}
.navigation-bottom a{display:block;outline:0;height:20px;padding-top:18px;padding-left:138px;}
.navigation-bottom a span{display:block;background:url('/images/sprite.png') no-repeat -212px -74px;width:8px;height:6px;}
Also the links, are not clickable, if I click on a link in IE7 it doesn't do the action..it doesn't redirect me to the location.
This is how it looks in IE7:
http://screencast.com/t/MGY4NjljZjc
This is how it look in IE8,Firefox,Chrome and so on
http://screencast.com/t/MzhhMDQ1M
What I'm doing wrong
PS: .navigation-top a span and .navigation-bottom a span I'm using some where else, but that it's ok it works fine.
Does DataMapper provide a convenient way to create a new record when none exists or update an existing one? I couldn't find anything in the API documentation.
This is what I have at the moment which doesn't seem very elegant:
foo = Foo.get(id)
if foo.nil?
foo = Foo.create(#attributes...)
else
foo.update(#attributes...)
end
foo.save
I came accross this:
t = Clamp(t/d, 0, 1)
but I'm not sure how to perform this operation on a vector. What are the steps to clamp a vector if one was writing their own vector implementation?
Thanks
clamp clamping a vector to a minimum and a maximum
ex:
pc = # the point you are coloring now
p0 = # start point
p1 = # end point
v = p1 - p0
d = Length(v)
v = Normalize(v) # or Scale(v, 1/d)
v0 = pc - p0
t = Dot(v0, v)
t = Clamp(t/d, 0, 1)
color = (start_color * t) + (end_color * (1 - t))
say ive got a matrix that looks like:
[[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]
how can i make it on seperate lines:
[[0, 0, 0, 0, 0],
[0, 0, 0, 0, 0],
[0, 0, 0, 0, 0]]
and then remove commas etc:
0 0 0 0 0
And also to make it blank instead of 0's, so that numbers can be put in later, so in the end it will be like:
_ 1 2 _ 1 _ 1
(spaces not underscores)
thanks
Is there any method that will restart the iPhone on call? It can be undocumented method (and probably will end up being since I can not find a method like it in the iPhone SDK reference).
In FarPoint SpreadSheet ver 7 - How to apply .Formula property at SpreadHeader+1 ? .That is second Header of the Spread. We can apply .Formula property at SpreadHeader + 0.That is Top Header. I use the following code,
With fpSpread1
.Row = SpreadHeader + 0
.col = 1
.CellType = CellTypeNumber
.Formula = "SUM(A1:A10)"
End With
If not specifically spelled out in any contract language, who would own the source code and the subsequent program developed?
the programmer
the company employing the programmer
or the company who is the end-user
customer paying for the development
of the program by the company
employing the programmer?
Is it possible to read HTML Web 2.0 Source Code that is dynamically generated ?
The Perl LWP with its agent-response does not pick up any dynamically generated HTML code.
Many websites today are generating dynamic html. If I am shoppping for best prices, and the prices are dynamically fetched and dumped, then I am out of business.
Are we reaching the end of a era?
I'm looking for a Java class with the characteristics of C++ std::map's usual implementation (as I understand it, a self-balancing binary search tree):
O(log n) performance for insertion/removal/search
Each element is composed of a unique key and a mapped value
Keys follow a strict weak ordering
I'm looking for implementations with open source or design documents; I'll probably end up rolling my own support for primitive keys/values.
This question's style is similar to: Java equivalent of std::deque, whose answer was "ArrayDeque from Primitive Collections for Java".
Lets say I have two MySQL databases with some complex table structures. Neither database has the same table name. Lets say these tables contain no rows (they do but I could truncate the tables, the data is not important right now, just testing stuff). Lets say I need these 2 databases merged into one. For instance:
DB1:
cities
states
DB2:
index
subindex
posts
I want to end up with a single DB that contains:
cities
states
index
subindex
posts
Is this possible?
Valgrind tells me function xxx allocated memory which was not freed. Fine. It's proving more difficult than usual to trace however.
To this end I have created numerous:
#ifdef DEBUG
fprintf(stderr, "something happening:%lx\n", (unsigned long)ptr);
#endif
So I just need to match these ptr addresses that are displayed with the addresses of non-freed memory.
How can I get valgrind to tell me the address of each non-freed block of memory?
I am trying to find a way to use the Postful API and I need to post an image in the body of the request. I am trying to use rest-client (but am open to other ways):
This is how I am trying to use it after looking at the restclient.rb file but I'm still not clear:
class ContactPostfulsController < ApplicationController
require 'rest_client'
RestClient.post 'http://www.postful.com/service/upload', 'the actual image...?',
:content_type => 'application/octet-stream'
end
Hi,
I have various Debug.WriteLine messages, I tried to see those messages using export MONO_DEBUG_LEVEL=debug, but I end up getting other irrelevant debug messages which was not outputted by my code.
What should I do to see the debug messages?
I'm using Linux :) Thanks.
I just started using C# and I've got a couple of issues.
Is there any way to code the C# equivalent of the VB.NET Select statement like the following?
Select Object.Name.ToString()
Case "Name1"
'Do something
Case "Name2"
'Do something else
Case Else
'Do the default action
End Select
Any help would be greatly appreciated.