Hi,
i'm just starting with the mvvm model in Silverlight.
In step 1 i got a listbox bound to my viewmodel, but now i want to propagate a click in a button and a selecteditemchanged of the listbox back to the viewmodel.
I guess i have to bind the click event of the button and the selecteditemchanged of the listbox to 2 methods in my viewmodel somehow?
For the selecteditemchanged of the listbox i think there must also be a 'return call' possible when the viewmodel tries to set the selecteditem to another value?
i come from a asp.net (mvc) background, but can't figure out how to do it in silverlight.
What I'm trying to do is make a grid of invisible coordinates on the page equally spaced. I then want a <div> to be placed at whatever grid coordinate is closest to the pointer when onclick is triggered. Here's the rough idea:
I have the tracking of the mouse coordinates and the placing of the <div> worked out fine. What I'm stuck with is how to approach the problem of the grid of coordinates.
First of all, should I have all my coordinates in an array which I then compare my onclick coordinate to?
Or seeing as my grid coordinates follow a rule, could I do something like finding out which coordinate that is a multiple of whatever my spacing is is closest to the onclick coordinate?
And then, where do I start with working out which grid point coordinate is closest? What's the best way of going about it?
Thanks!
i need some code which can delete/filter arrays which doesn't contain a specific word
or we can say keep only that contain a specific word and drop all other ones
this compiles
class ex1
{
public int show()
{
try
{ int a=10/10; return 10;}
catch(ArithmeticException e)
{ System.out.println(e); }
finally
{ System.out.println("Finally");}
System.out.println("hello");
return 20;
}
}
on the other hand this doesn't
class ex15
{
public int show()
{
try
{ int a=10/0; return 10;}
catch(ArithmeticException e)
{ System.out.println(e); }
finally
{ System.out.println("Finally"); return 40;}
System.out.println("hello");
return 20;
}
}
why is it so?
What bit of WPF did you
find hardest to understand
or misunderstood for longest
and how did you understand it in the end (please provide links etc).
(I am asking this to guide my learning of WPF)
Possible Duplicate:
What is the easiest language to start with?
Hi, I am trying to change my career to a programmer. I found interest in programming, and also quicker to learn. my confusion started when I have decide which language should I be with? should it be the languages and scripts from MS stable or should it be Java?
Here I have a variable 'response' which is obtained by parsing an XML file.
$url = 'http://xxxxx.xml';
$ch = curl_init($url);
$response = curl_exec($ch);
The url structure is as follows -
<user>
<id>734</id>
<name>Peter Parker</name>
-
<status>
<favorited>false</favorited>
</status>
</user>
How to access each bit of info like id,name,favorited from response?
Here's my XAML code:
<Window x:Class="CarFinder.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Search for cars in TuMomo" Height="480" Width="600">
<DockPanel Margin="8">
<Border CornerRadius="6"
BorderBrush="Gray"
Background="LightGray"
BorderThickness="2"
Padding="8">
<StackPanel Orientation="Horizontal"
DockPanel.Dock="Top"
Height="25">
<TextBlock FontSize="14" Padding="0 0 8 0">
Search:
</TextBlock>
<TextBox x:Name="txtSearchTerm" Width="400" />
<Image Source="/CarFinder;component/Images/Chrysanthemum.jpg" />
</StackPanel>
</Border>
<StackPanel Orientation="Horizontal"
DockPanel.Dock="Top"
Height="25">
</StackPanel>
</DockPanel>
</Window>
The border is set around the entire window. And also, when I create another StackPanel it's added to the right of my previous StackPanel instead of being added under it. What's the reason for this?
Here is my code
<html>
<body>
<?php
echo "<b>Hello World</b> <br />";
?>
</body>
</html>
I have named the file as test.php but I dont get the desired output in my firefox 3.6 browser.
Output
Hello World
"; ?>
I'm new to MATLAB and mrVista.
I'm running Matlab Version 7.8.0.347 (R2009a) 32-bit(win32) from February 12, 2009
OS is Windows 7 Professional
I downloaded the most recent MrVista_hourly.zip and extracted it into my C:\Program_Files_(x86)\MATLAB directory.
I think I need to run mrvInstall, but when I do, I get the following:
EDU>> mrvInstall
Checking VISATSOFT installation.
Windows, 32-bit, installation
Checking and possibly installing .NET framework.
This can take several minutes
Checking for visualization library (.dll) files.
You are missing msvcp70.dll.
So, I'm completely lost at this point. Do I just need to download msvcp70.dll from the net? If so, is there a safe place to download it from? If there's some other way I'm supposed to get mrVista to work from MATLAB, instead of mrvInstall, please let me know that.
Thanks in advance for your help.
EDIT: I've downloaded and installed the dll and still isn't working. I'll go ask on Super User. Thanks for trying to help anyway.
Does code in the constructor add to code in subclass constructors? Or does the subclass's constructor override the superclass? Given this example superclass constructor:
class Car{
function Car(){
trace("CAR")
}
}
...and this subclass constructor:
class FordCar extends Car{
function FordCar(){
trace("FORD")
}
}
When an instance of FordCar is created, will this trace "Car" and "Ford" ??
I am aware that you can initialize an array during instantiation as follows:
String[] names = new String[] {"Ryan", "Julie", "Bob"};
Is there a way to do the same thing with an ArrayList? Or must I add the contents individually with array.add()?
Thanks,
Jonathan
// myClass.h
@interface myClass : NSObject {
int variable1;
}
- (int) addOne: (int)variable1;
//myClass.m
- (int) addOne: (int)variable1{
variable1++;
}
My question is: will [myClass addOne:aNumber] add 1 to aNumber or will it add 1 to the value of the ivar variable1?
I have a bunch of functions which are currently overloaded to operate on int and string:
bool foo(int);
bool foo(string);
bool bar(int);
bool bar(string);
void baz(int p);
void baz(string p);
I then have a bunch of functions taking 1, 2, 3, or 4 arguments of either int or string, which call the aforementioned functions:
void g(int p1) { if(foo(p1)) baz(p1); }
void g(string p1) { if(foo(p1)) baz(p1); }
void g(int p2, int p2) { if(foo(p1)) baz(p1); if(bar(p2)) baz(p2); }
void g(int p2, string p2) { if(foo(p1)) baz(p1); if(bar(p2)) baz(p2); }
void g(string p2, int p2) { if(foo(p1)) baz(p1); if(bar(p2)) baz(p2); }
void g(string p2, string p2) { if(foo(p1)) baz(p1); if(bar(p2)) baz(p2); }
// etc.
(The implementation of the g() family is just a placeholder. actually they are more complicated.)
More types than the current int or string might have to be introduced at any time. The same goes for functions with more arguments than 4. The current number of identical functions is barely manageable. Add one more variant in either dimension and the combinatoric explosion will be so huge, it might blow away the application.
In C++, I'd templatize g() and be done. I understand that .NET generics are different. <sigh> But I have been fighting them for two hours trying to come up with a solution that doesn't involve too much copy&paste of code. To no avail.
Surely, C#/.NET/generics/whatever won't require me to type out identical code for a family of functions taking five arguments of either of three types?
So what am I missing here?
Hello,
I have a cmd command that needs to be executed, when the command starts it starts to fill a progressbar. When the cmd command is done the progressbar needs to fill up to 100.
This is the code i use, but it gives me an error when the progressbar.Value = 100 comes up.
Public Class Form1
Dim teller As Integer
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TimerProgressbar.Tick
teller += 1
ProgressBar1.Value = teller
If ProgressBar1.Value = ProgressBar1.Maximum Then
TimerProgressbar.Stop()
End If
End Sub
This are the tow commands in another private sub where the app is crashing on
ProgressBar1.Value = 100
TimerProgressbar.Stop()
When i debug it and i try it out it crashes on
ProgressBar1.Value = 100
But when i build it under Windows 7 it runs fine without crashing, however a few people reported me it crashes on there Windows xp system.
VB gives me a suggestions about Cross Thread, but i don't know how i could make it work with this.
Hi, I'm really stuck on how to go about programming this. I need to draw a circle within a JFrame with a radius and points around the circumference. i can mathematically calculate how to find the coordinates of the point around the edge but i cant seem to be able to program the circle. I am currently using a Ellipse2D method but that doesn't seem to work and doesn't return a radius, as under my understanding, it doesn't draw the circle from the center rather from a starting coordinate using a height and width. My current code is on a separate frame but i need to add it to my existing frame.
import java.awt.*;
import javax.swing.*;
import java.awt.geom.*;
public class circle extends JFrame {
public circle() {
super("circle");
setSize(410, 435);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Panel sp = new Panel();
Container content = getContentPane();
content.add(sp);
setContentPane(content);
setVisible(true);
}
public static void main (String args[]){
circle sign = new circle();
}
}
class Panel extends JPanel {
public void paintComponent(Graphics comp) {
super.paintComponent(comp);
Graphics2D comp2D = (Graphics2D) comp;
comp2D.setColor(Color.red);
Ellipse2D.Float sign1 = new Ellipse2D.Float(0F, 0F, 350F, 350F);
comp2D.fill(sign1);
}
}
How do I design mailbox in my site ...
I am new to the PHP language ...
And asked me to design mailbox for each member in my site...
As the site contains the members, personal page for each member and the incoming fund that in which he can read private messages as well as send new messages, and also keep the messages sent ..
How do I do that ...????
I just want a guideline for the right way .... How do I start to design ..???
I have been trying to get a simple spider to run with scrapy, but keep getting the error:
Could not find spider for domain:stackexchange.com
when I run the code with the expression scrapy-ctl.py crawl stackexchange.com. The spider is as follow:
from scrapy.spider import BaseSpider
from __future__ import absolute_import
class StackExchangeSpider(BaseSpider):
domain_name = "stackexchange.com"
start_urls = [
"http://www.stackexchange.com/",
]
def parse(self, response):
filename = response.url.split("/")[-2]
open(filename, 'wb').write(response.body)
SPIDER = StackExchangeSpider()`
Another person posted almost the exact same problem months ago but did not say how they fixed it, http://stackoverflow.com/questions/1806990/scrapy-spider-is-not-working
I have been following the turtorial exactly at http://doc.scrapy.org/intro/tutorial.html, and cannot figure out why it is not working.
Hi, how do i order a given set of colors from the rainbow in VIBGYOR order. say i input the seven colors in the following order { red, blue, green, yellow, indigo, violet, orange} and i should print the output as {violet, indigo, blue, green, yellow, orange, red}, irrespective of the order i give the output should be as above. Can someone suggest me about implementing this in java program?
Thanks,
-Vijay
Hi.
I have a text file of URLs, about 14000. Below is a couple of examples:
http://www.domainname.com/pagename?CONTENT_ITEM_ID=100¶m2=123
http://www.domainname.com/images?IMAGE_ID=10
http://www.domainname.com/pagename?CONTENT_ITEM_ID=101¶m2=123
http://www.domainname.com/images?IMAGE_ID=11
http://www.domainname.com/pagename?CONTENT_ITEM_ID=102¶m2=123
I have loaded the text file into a Python list and I am trying to get all the URLs with CONTENT_ITEM_ID separated off into a list of their own. What would be the best way to do this in Python?
Cheers
Hi there,
I think I tried to ask for far too much in my previous question so apologies for that. Let me lay out my situation in as simple a manner as I can this time.
Basically, I've got a bunch of dictionaries that reference my objects, which are in turn mapped using SQLAlchemy. All fine with me. However, I want to make iterative changes to the contents of those dictionaries. The problem is that doing so will change the objects they reference---and using copy.copy() does no good since it only copies the references contained within the dictionary. Thus even if copied something, when I try to, say print the contents of the dictionary, I'll only get the latest updated values for the object.
This is why I wanted to use copy.deepcopy() but that does not work with SQLAlchemy. Now I'm in a dilemma since I need to copy certain attributes of my object before making said iterative changes.
In summary, I need to use SQLAlchemy and at the same time make sure I can have a copy of my object attributes when making changes so I don't change the referenced object itself.
Any advice, help, suggestions, etc.?
So I'm starting an internship as a Flex developer in ~2weeks thanks to a friend of mine. The thing is I know squat about Flex - it is an internship after all so I'm supposed to learn there, but nonetheless I want to have some basic understanding of Flex before I start (eventually I want to become a JEE/Flex dev).
So my question is simple, which book(s) would you recommend me to start with? Are there any "must have" books, like let's say "Thinking in C++" for C++ etc.? I already heard about a few video tutorials and I will surely check them out but I'd also want to get some decent books.