If open yahoo finance chart in IE, the chart will be resized to fit the viewing window, and making the chart viewable without scrolling down. However, this makes the chart become smaller for me. I would like to see original size, which requires me to click the setting bar and change something to make it restore original size. The chart shows original size in Chrome. Is it possible to view original size in IE by passing some parameters in url? I was trying looking into source code but found nothing.
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 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?
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!
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?
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?
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?
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 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 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 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.
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 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!
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 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've written a regular expression that automatically detects URLs in free text that users enter. This is not such a simple task as it may seem at first. Jeff Atwood writes about it in his post.
His regular expression works, but needs extra code after detection is done.
I've managed to write a regular expression that does everything in a single go. This is how it looks like (I've broken it down into separate lines to make it more understandable what it does):
1 (?<outer>\()?
2 (?<scheme>http(?<secure>s)?://)?
3 (?<url>
4 (?(scheme)
5 (?:www\.)?
6 |
7 www\.
8 )
9 [a-z0-9]
10 (?(outer)
11 [-a-z0-9/+&@#/%?=~_()|!:,.;cšžcd]+(?=\))
12 |
13 [-a-z0-9/+&@#/%?=~_()|!:,.;cšžcd]+
14 )
15 )
16 (?<ending>(?(outer)\)))
As you may see, I'm using named capture groups (used later in Regex.Replace()) and I've also included some local characters (cšžcd), that allow our localised URLs to be parsed as well. You can easily omit them if you'd like.
Anyway. Here's what it does (referring to line numbers):
1 - detects if URL starts with open braces (is contained inside braces) and stores it in "outer" named capture group
2 - checks if it starts with URL scheme also detecting whether scheme is SSL or not
3 - start parsing URL itself (will store it in "url" named capture group)
4-8 - if statement that says: if "sheme" was present then www. part is optional, otherwise mandatory for a string to be a link (so this regular expression detects all strings that start with either http or www)
9 - first character after http:// or www. should be either a letter or a number (this can be extended if you'd like to cover even more links, but I've decided not to because I can't think of a link that would start with some obscure character)
10-14 - if statement that says: if "outer" (braces) was present capture everything up to the last closing braces otherwise capture all
15 - closes the named capture group for URL
16 - if open braces were present, capture closing braces as well and store it in "ending" named capture group
First and last line used to have \s* in them as well, so user could also write open braces and put a space inside before pasting link.
Anyway. My code that does link replacement with actual anchor HTML elements looks exactly like this:
value = Regex.Replace(
value,
@"(?<outer>\()?(?<scheme>http(?<secure>s)?://)?(?<url>(?(scheme)(?:www\.)?|www\.)[a-z0-9](?(outer)[-a-z0-9/+&@#/%?=~_()|!:,.;cšžcd]+(?=\))|[-a-z0-9/+&@#/%?=~_()|!:,.;cšžcd]+))(?<ending>(?(outer)\)))",
"${outer}<a href=\"http${secure}://${url}\">http${secure}://${url}</a>${ending}",
RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);
As you can see I'm using named capture groups to replace link with an Anchor tag:
"${outer}<a href=\"http${secure}://${url}\">http${secure}://${url}</a>${ending}"
I could as well omit the http(s) part in anchor display to make links look friendlier, but for now I decided not to.
Question
I would like my links to be replaced with shortenings as well. So when user copies a very long link (for instance if they would copy a link from google maps that usually generates long links) I would like to shorten the visible part of the anchor tag. Link would work, but visible part of an anchor tag would be shortened to some number of characters. I could as well append ellipsis at the end of at all possible (and make things even more perfect).
Does Regex.Replace() method support replacement notations so that I can still use a single call? Something similar as string.Format() method does when you'd like to format values in string format (decimals, dates etc...).
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.
Maybe I'm confused on how SASS/SCSS works within Rails (2.3.8.) but I was under the impression that if I included the option
Sass::Plugin.options[:always_update] = true
that whenever I changed my SCSS file and then hit the page (controller) again, the SCSS would recompile.
I can't seem to get this to work, and can't seem to find a good tutorial / example for it. I've tried setting the above property in the Environment.rb file, but it didn't seem to do anything. I tried putting it in its own initializer with require 'sass' but that doesn't seem to work either.
What am I missing? Or am i just forced to keep a terminal open with a sass --watch command running to be able to rapidly debug / change my styles?
thx
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?
I am trying to map an entity in NHibernate, that should have an Updated column. This should be the DateTime when the entity was last written to the database (either created or updated). I'd like NHibernate to control the update of the column, so I don't need to remember to set a property to the current time before updating.
Is there a built-in feature in NHibernate, that can handle this for me ?