Here is a method from msdn to provide data to an autocomplete extender / textbox:
<System.Web.Services.WebMethodAttribute(), System.Web.Script.Services.ScriptMethodAttribute()> _
Public Shared Function GetCompletionList(ByVal prefixText As String, ByVal count As Integer, ByVal contextKey As String) As String()
' Create array of movies
Dim movies() As String = {"Star Wars", "Star Trek", "Superman", "Memento", "Shrek", "Shrek II"}
' Return matching movies
Return From m In movies(6) Where _
(m.StartsWith(prefixText, StringComparison.CurrentCultureIgnoreCase))
Select m).Take(count).ToArray()
End Function
The errors are:
m.StartsWith - ('Startswith' is not a member of 'Char')
Select m - ('Select Case' must end with a matching end select)
.Take(count).ToArray() - (End of statement expected)
Can you please let me know how to get this function working? Thanks
Hello,
I have a demo site where anyone can login and test a management interface.
Every hour I would like to flush all the data in the SQL 2008 Database and restore it from the original.
Rae Gate sql has some awesome tools for this, however they are beyond my budget right now.
Could I simply make a backup copy of the database's data file, then have a c# console app that deletes it and copies over the original. Then I can have a windows schedule task to run the .exe every hour.
It's simple and free... would this work?
I'm using SQL Server 2008 R2 Web edition
I understand that red gate is technically better because I can set it to analyze the db and only update the records that were altered, and the approach I have above is like a "sledge hammer".
My team currently has a development web/database server and a live deployment web server and a live database server. We use SVN with the repository stored on the development server but the problem is our deployment process.
Currently when we need to deploy an update to the live application we simply use SFTP to transfer from the repository to the live web server and then amend the database on the live server to reflect the development database. This is a really slow process as we also minify all javascript and CSS files.
I have used Capistrano for Ruby and Cruise Control for java but I have never used anything for PHP. I'd rather not have to build our own if something already existed. Does anyone know of anything?
I have roughly 12 computers that each have the same script on them. This script merely pings all the other machines, and prints out whether the machine is "reachable" or "unreachable". However, it is inefficient to login to each machine manually using ssh to execute this script.
Suppose I'm logged into node 1. Is there any way to for me to login to node 2-12 automatically using SSH, execute the ping script, pipe the results to a file, logout and proceed to the next machine? Some kind of bash shell script?
I'm afraid I'm at a loss here since I haven't had experience with shell-scripting before.
I have a abstract class:
public abstract class MySuperControl : UserControl
{
protected void Page_PreRender(object sender, EventArgs e)
{
// do something in super
}
}
and a class that is code-behind for a designed UserControl:
public partial class MyControl : MySuperControl
{
protected void Page_PreRender(object sender, EventArgs e)
{
// do something in class
}
}
how do declare both of them to nest automated call?
Hi,
I've added a date time picker to a form. Initially its value is set to the DB sever date and time. Once its value is set, I need it to automatically update itself so that it always shows the DB server Date and time. How can I do this?
Do I have to develop a custom control?
Thanks in advance!
Hi,
I have a method which returns an array of fixed type objects (let's say MyObject).
The method creates a new empty Stack<MyObject>. Then, it does some work and pushes some number of MyObjects to the end of the Stack. Finally, it returns the Stack.ToArray().
It does not change already added items or their properties, nor remove them. The number of elements to add will cost performance. There is no need to sort/order the elements.
Is Stack a best thing to use? Or must I switch to Collection or List to ensure better performance and/or lower memory cost?
I am running a self-hosted WCF service. In the service configuration, I am using localhost in my BaseAddresses that I hook my endpoints to. When trying to connect to an endpoint using the WCF test client, I have no problem connecting to the endpoint and getting the metadata using the machine's name. The problem that I run into is that the client that is generated from metadata uses localhost in the endpoint URLs it wants to connect to. I'm assuming that this is because localhost is the endpoint URL published by metadata. As a result, any calls to the methods on the service will fail since localhost on the calling machine isn't running the service.
What I would like to figure out is if it is possible for the service metadata to publish the proper URL to a client depending on the client who is calling it. For example, if I was requesting the service metadata from a machine on the same network as the server the endpoint should be net.tcp://MYSERVER:1234/MyEndpoint. If I was requesting it from a machine outside the network, the URL should be net.tcp://MYSERVER.mydomain.com:1234/MyEndpoint. And obviously if the client was on the same machine, THEN the URL could be net.tcp://localhost:1234/MyEndpoint.
Is this just a flaw in the default IMetadataExchange contract? Is there some reason the metadata needs to publish the information in a non-contextual way? Is there another way I should be configuring my BaseAddresses in order to get the functionality I want?
Thanks,
Mike
When i run the code above the frame's menu bar come up when the mouse moves to the upper part of the window. The problem is when i open the menu but do not select any item and move out the mouse the menu bar get invisible but the items stay on screen.
public class Test extends JFrame {
public Test() {
setLayout(new BorderLayout());
setSize(300, 300);
JMenuBar mb = new JMenuBar();
setJMenuBar(mb);
mb.setVisible(false);
JMenu menu = new JMenu("File");
mb.add(menu);
menu.add(new JMenuItem("Item-1"));
menu.add(new JMenuItem("Item-2"));
addMouseMotionListener(new MouseAdapter() {
@Override
public void mouseMoved(MouseEvent e) {
getJMenuBar().setVisible(e.getY() < 50);
}
});
}
public static void main(String args[]) {
new Test().setVisible(true);
}
}
My client likes programs like Microsoft OneNote where changes are saved automatically, and he can choose to discard when he explicitly wants to do so. I will have to implement some undo functionality, but I'll figure that out some other time.
With NHibernate, I suppose I can call ISession.Update on every single property / binding change, but I can see real pain with this approach down the road. I am not a fan of timers, but maybe a 5 second timer that starts on property / binding change and at timer end use BackgroundWorker thread to save to db.
What do you think?
If the user manually clicks the 'submit' button, i use this code:
if (isset($_POST['submit_findall'])) { ...
But what what code should I use if I want to activate this from within a script ?
Thanks!
I'm going through exercises of a C++ book. For each exercise I want to minimize the boilerplate code I have to write. I've set up my project a certain way but it doesn't seem right, and requires too many changes.
Right now I have a single main.cpp file with the following:
#include "e0614.h"
int main()
{
E0614 ex;
ex.solve();
}
Each time I create a new class from an exercise, I have to come and modify this file to change the name of the included header as well as the class i'm instantiating.
So my questions are:
Can I include all headers in the directory so at least I don't have to change the #include line?
Better yet, can I rewrite my solution so that I don't even have to touch main.cpp, without having one file with all the code for every exercise in it?
I have the following code:
[SetUp]
public void SetMeUp()
{
Mapper.CreateMap<SourceObject, DestinationObject>();
}
[Test]
public void Testing()
{
var source = new SourceObject {Id = 123};
var destination1 = Mapper.Map<SourceObject, DestinationObject>(source);
var destination2 = Mapper.Map<ObjectBase, ObjectBase>(source);
//Works
Assert.That(destination1.Id == source.Id);
//Fails, gives the same object back
Assert.That(destination2 is DestinationObject);
}
public class ObjectBase
{
public int Id { get; set; }
}
public class SourceObject : ObjectBase { }
public class DestinationObject : ObjectBase { }
So basically, I want AutoMapper to automatically resolve the destination type to "DestinationObject" based on the existing Maps set up in AutoMapper. Is there a way to achieve this?
I have been toiling with a problem and any help would be appreciated.
Problem: I have a paragraph and I want to replace a variable which appears several times (Variable = @Variable). This is the easy part, but the portion which I am having difficulty is trying to replace the variable with different values.
I need for each occurrence to have a different value. For instance, I have a function that does a calculation for each variable. What I have thus far is below:
private string SetVariables(string input, string pattern){
Regex rx = new Regex(pattern);
MatchCollection matches = rx.Matches(input);
int i = 1;
if(matches.Count > 0)
{
foreach(Match match in matches)
{
rx.Replace(match.ToString(), getReplacementNumber(i));
i++
}
}
I am able to replace each variable that I need to with the number returned from getReplacementNumber(i) function, but how to I put it back into my original input with the replaced values, in the same order found in the match collection?
Thanks in advance!
Marcus
I am having a problem with some div's
The outer div has a min-height, but the inner divs are all varying heights. Because the inner divs are absolute positioned, they do not affect the outer divs height. Is there a way to make these inner divs affect the height of the outer div?
The reason I am styling these divs with position:absolute is so that they all start at the top of the container div.
Hi Folks,
I'm a beginner in silverlight so i hope i can get an answer that brings me some more light in the measure process of silverlight.
I found an interessting flap out control from silverlight slide control
and now I try to use it in my project. So that the slide out is working proper, I have to place the user control on a canvas. The user control then uses for itself the height of its content. I just wanna change that behavior so that the height is set to the available space from the parent canvas.
You see the uxBorder where the height is set. How can I measure the actual height and set it to the border?
I tried it with Height={Binding ElementName=notificationCanvas, Path=ActualHeight} but this dependency property has no callback, so the actualHeight is never set.
What I want to achieve is a usercontrol like the tweetboard per example on Jesse Liberty's blog
Sorry for my English writing, I hope you understand my question.
<Canvas x:Name="notificationCanvas" Background="Red">
<SlideEffectEx:SimpleSlideControl GripWidth="20" GripTitle="Task" GripHeight="100">
<Border x:Name="uxBorder"
BorderThickness="2"
CornerRadius="5"
BorderBrush="DarkGray"
Background="DarkGray"
Padding="5" Width="300"
Height="700"
>
<StackPanel>
<TextBlock Text="Tasks"></TextBlock>
<Button x:Name="btn1" Margin="5" Content="{Binding ElementName=MainBorder, Path=Height}"></Button>
<Button x:Name="btn2" Margin="5" Content="Second Button"></Button>
<Button x:Name="btn3" Margin="5" Content="Third Button"></Button>
<Button x:Name="btn1_Copy" Margin="5" Content="First Button"/>
<Button x:Name="btn1_Copy1" Margin="5" Content="First Button"/>
<Button x:Name="btn1_Copy2" Margin="5" Content="First Button"/>
<Button x:Name="btn1_Copy3" Margin="5" Content="First Button"/>
<Button x:Name="btn1_Copy4" Margin="5" Content="First Button"/>
<Button x:Name="btn1_Copy5" Margin="5" Content="First Button"/>
<Button x:Name="btn1_Copy6" Margin="5" Content="First Button"/>
</StackPanel>
</Border>
</SlideEffectEx:SimpleSlideControl>
I've created a form that posts to a cfm file. When running a script onLoad that fills in the form values and tries to submit...The site takes me back to the login screen.
function f()
{
document.getElementById("email").value = "[email protected]";
document.getElementById("password").value = "asdf";
document.getElementById("form1").submit();
}
Please help!
I need to be able to post to the wall of my page, i have given offline_permissions and I got it to post to my profile wall but I need it to post to my pages wall.
Anyone know how to do this, where does my code need changing? thanks
<?php session_start();
$fb_page_id = 106502962712016;
$fb_access_token = '121247121254761|588e45312b074a0ec3dd62c39-1727154049|L0VGSJsCBrsSj5H4w1LwobRGeRc';
$url = 'https://graph.facebook.com/'.$fb_page_id.'/feed';
$attachment = array(
'access_token' => $fb_access_token,
'message' => 'message text',
'name' => 'name text',
'link' => 'http://domain.com/',
'description' => 'Description Text',
'picture'=>'http://domain.com/logo.jpg',
);
// set the target url
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $attachment);
curl_setopt($ch, CURLOPT_HEADER,0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$go = curl_exec($ch);
curl_close ($ch);
?
I've been trying to get a silverlight 3 application to automatically resize when rows are added to datagrids.
I've tried
this example
but I just get a System.ExecutionEngineException with a null inner exeception. I think this is aimed at silverlight 2 only.
Can anyone tell me how to do this in silverlight 3?
Any help on this would be much appreciated.
I'm working on a PHP collaboration software project. I have a page that shows the latest updates from other users who are adding content to the database, but also has a form input to allow the user to enter text. I am currently using this code to refresh the page automatically every 30 seconds:
header('Refresh: 30');
The problem is that the header code refreshes the entire page, and not just what is pulled from the database. Is there any PHP code that will just pull any new data from the database without refreshing the entire page?
If someone could point me in the right direction I'd appreciate it.
In Drupal 6 - Our default select box is the "Ajax - autosuggest" variation. This shows up in Location and Views modules amoung other places.
Is there a place where we can set this to the regular select-dropdown type of select box?