From the online bar chart guide:
qplot(factor(cyl), data=mtcars, geom="bar", fill=factor(gear))
How do I get 5 to sit on the bottom, 4 above that, and 3 on top?
Hello,
I have two questions regarding Silverlight's SoundPlay action and properties. My scenario is like:
I have two story board:
The first story board has an image and a sound file; when the silverlight application gets loaded, the sound starts to play automatically, but if someone clicks the image,
the sound file will stop and the second storyboard will start with a new sound file.
1) My first question is how to stop the first sound file of first story board when the second story board starts with the second sound file.
2) My second question is how to play a sound file continuously; for example, in Silverlight we can play a story board continuously with RepeatBehavior="Forever"; but I cannot find a way to play my 10 second sound file forever or continuously.
Note: I have attached a small XAML file to show what I am talking about; I am also stating that if instead of an image file, if there were a button, then I can stop the first music file after I click the button and start my second story board with a new sound file, but I would like to use image file instead of a button. Is it possible? If it is, how to do it?
Therefore, please answer my following two questions or give big hint or website tutorial links on
1) How to stop the first sound file of first story board when the second story board starts with the second sound file ( When the clickable element is an image instead of a button)
2) How to play a 10 second sound file continuously?
............Code Snippet......................
XAML
............
<Grid x:Name="LayoutRoot" Background="Red">
<Button HorizontalAlignment="Left" Margin="212,0,0,111" VerticalAlignment="Bottom" Width="75" Content="Button" Click="onClick"/>
<MediaElement x:Name="sound2_mp3" Height="0" HorizontalAlignment="Left" Margin="105,230,0,0" VerticalAlignment="Top" Width="0" Source="/sound2.mp3" Stretch="Fill"/>
<MediaElement x:Name="sound1_mp1" Height="0" HorizontalAlignment="Left" Margin="190,164,0,0" VerticalAlignment="Top" Width="0" Source="/sound1.mp3" Stretch="Fill" AutoPlay="False"/>
</Grid>
.....................................................................................................................................................................................................................
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
namespace testPrj
{
public partial class MainPage : UserControl
{
public MainPage()
{
// Required to initialize variables
InitializeComponent();
}
private void onClick(object sender, System.Windows.RoutedEventArgs e)
{
Storyboard1.Stop();
sound2_mp3.Stop();
sound1_mp1.Play();
}
}
}
...................................................................................................
I need to fill a CImageList with a number of bitmaps which are stored in separate bmp files (rather than as a single bmp with numerous parts). I assume I need to create a CBitmap so I can call the Add method of CImageList. So how might one create a CBitmap object using only MFC Resource IDs?
Im currently trying to create a Scene in WPF where I have around 250 controls on my screen and the user can Pan and Zoom in and out of these controls using the mouse.
I have run the WPF Performance Suite tools on the application when there are a large number of these controls on the screen (i.e. when the user has zoomed right out) the FPS drops down to around 15 which is not very good.
Here is the basic outline of the XAML:
<Window>
<Window.Resources>
<ControlTemplate x:Key="LandTemplate" TargetType="{x:Type local:LandControl}">
<Canvas>
<Path Fill="White" Stretch="Fill" Stroke="Black" StrokeThickness="1" Width="55.5" Height="74.687" Data="M0.5,0.5 L55,0.5 L55,74.187 L0.5,74.187 z"/>
<Canvas x:Name="DetailLevelCanvas" Width="24.5" Height="21" Canvas.Left="15.306" Canvas.Top="23.972">
<TextBlock Width="21" Height="14" Text="712" TextWrapping="Wrap" Foreground="Black"/>
<TextBlock Width="17.5" Height="7" Canvas.Left="7" Canvas.Top="14" Text="614m2" TextWrapping="Wrap" FontSize="5.333" Foreground="Black"/>
</Canvas>
</Canvas>
</ControlTemplate>
</Window.Resources>
...
<local:LandControl Width="55.5" Height="74.552" Canvas.Top="xxx" Template=" {StaticResource LandTemplate}" RenderTransformOrigin="0.5,0.5" Canvas.Left="xxx">
<local:LandControl Width="55.5" Height="74.552" Canvas.Top="xxx" Template=" {StaticResource LandTemplate}" RenderTransformOrigin="0.5,0.5" Canvas.Left="xxx">
<local:LandControl Width="55.5" Height="74.552" Canvas.Top="xxx" Template=" {StaticResource LandTemplate}" RenderTransformOrigin="0.5,0.5" Canvas.Left="xxx">
<local:LandControl Width="55.5" Height="74.552" Canvas.Top="xxx" Template=" {StaticResource LandTemplate}" RenderTransformOrigin="0.5,0.5" Canvas.Left="xxx">
... and so on...
</Window>
Ive tried to minimise the details in the control template and I even did a massive find and replace of the controls to just put their raw elements inline instead of using a template, but with no noticeable performance improvements.
I have seen other SO questions about this and people say to do custom drawing, but I dont really see how that make sense when you have to zoom and pan like I do.
If anyone can help out here, that would be great!
Mark
I found this snippet of code here that allows you to log into a website and get the response from the logged in page. However, I'm having trouble understanding all the part of the code. I've tried my best to fill in whatever I understand so far. Hope you guys can fill in the blanks for me. Thanks
string nick = "mrbean";
string password = "12345";
//this is the query data that is getting posted by the website.
//the query parameters 'nick' and 'password' must match the
//name of the form you're trying to log into. you can find the input names
//by using firebug and inspecting the text field
string postData = "nick=" + nick + "&password=" + password;
// this puts the postData in a byte Array with a specific encoding
//Why must the data be in a byte array?
byte[] data = Encoding.ASCII.GetBytes(postData);
// this basically creates the login page of the site you want to log into
WebRequest request = WebRequest.Create("http://www.mrbeanandme.com/login/");
// im guessing these parameters need to be set but i dont why?
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = data.Length;
// this opens a stream for writing the post variables.
// im not sure what a stream class does. need to do some reading into this.
Stream stream = request.GetRequestStream();
// you write the postData to the website and then close the connection?
stream.Write(data, 0, data.Length);
stream.Close();
// this receives the response after the log in
WebResponse response = request.GetResponse();
stream = response.GetResponseStream();
// i guess you need a stream reader to read a stream?
StreamReader sr = new StreamReader(stream);
// this outputs the code to console and terminates the program
Console.WriteLine(sr.ReadToEnd());
Console.ReadLine();
Hello, I have a column with pipe separated values such as:
'23|12.1| 450|30|9|78|82.5|92.1|120|185|52|11'
I want to parse this column to fill a table with 12 corresponding columns: month1, month2, month3...month12.
So month1 will have the value 23, month2 the value 12.1 etc...
Is there a way to parse it by a loop or delimeter instead of having to separate one value at a time using substr?
Thanks.
Take the following example.
I have a resource
public class HelloWorldResource extends ServerResource {
@Get
public String represent(String arg) {
return "hello, world (from the cloud!)" + arg;
}
}
That is mapped by
router.attach("/hi/{message}", HelloWorldResource.class);
Is it possible to configure the routing such that accessing /hi/somestuffhere will make restlet fill in the arg parameter in the represent method?
We are creating databases on demand and the databases can be created from different templates. All templates have the same structure but different data. The data contained by the templates is small.
What is the fastest way to create a copy of the database:
Backup/Restore
Using T-SQL ?
Using SMO ?
Create a new database from a scripted version of the template and then fill in the little data required ?
Other ?
I am painting a widget and I want to optimize the process. Basically i will be sliding the image in the x direction and I only want to fill the newly exposed area. Is there a way to translate the pixels of a widget without calling update or using paintevent? I know of pixmaps and such but I am wondering If I can for example draw a pixmap once and then translate what I have drawn without having to paint anything else or draw pixmaps anymore.
hi
i am trying to set up a home page with an email form, where i can fill out email address and subject and comments and the php page will run
mail -s [email protected] $comments
how can I do this via php to call the linux command?
thanks in advance
I have a gridview with edit option at the start of the row. Also I maintain a seperate table called Permission where I maintain user permissions. I have three different types of permissions like Admin, Leads, Programmers. These all three will have access to the gridview. Except admin if anyone tries to edit the gridview on clicking the edit option, I need to give an alert like This row has important validation and make sure you make proper changes.
When I edit, the action with happen on table called Application. The table has a column called Comments. Also the alert should happen only when they try to edit rows where the Comments column have these values in them.
ManLog datas
Funding Approved
Exported Applications
My try so far.
public bool IsApplicationUser(string userName)
{
return CheckUser(userName);
}
public static bool CheckUser(string userName)
{
string CS = ConfigurationManager.ConnectionStrings["ConnectionString"].ToString();
DataTable dt = new DataTable();
using (SqlConnection connection = new SqlConnection(CS))
{
SqlCommand command = new SqlCommand();
command.Connection = connection;
string strquery = "select * from Permissions where AppCode='Nest' and UserID = '" + userName + "'";
SqlCommand cmd = new SqlCommand(strquery, connection);
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(dt);
}
if (dt.Rows.Count >= 1)
return true;
else
return true;
}
protected void Details_RowCommand(object sender, GridViewCommandEventArgs e)
{
string currentUser = HttpContext.Current.Request.LogonUserIdentity.Name;
string str = ConfigurationManager.ConnectionStrings["ConnectionString"].ToString();
string[] words = currentUser.Split('\\');
currentUser = words[1];
bool appuser = IsApplicationUser(currentUser);
if (appuser)
{
DataSet ds = new DataSet();
using (SqlConnection connection = new SqlConnection(str))
{
SqlCommand command = new SqlCommand();
command.Connection = connection;
string strquery = "select Role_Cd from User_Role where AppCode='PM' and UserID = '" + currentUser + "'";
SqlCommand cmd = new SqlCommand(strquery, connection);
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds);
}
if (e.CommandName.Equals("Edit") && ds.Tables[0].Rows[0]["Role_Cd"].ToString().Trim() != "ADMIN")
{
int index = Convert.ToInt32(e.CommandArgument);
GridView gvCurrentGrid = (GridView)sender;
GridViewRow row = gvCurrentGrid.Rows[index];
string strID = ((Label)row.FindControl("lblID")).Text;
string strAppName = ((Label)row.FindControl("lblAppName")).Text;
Response.Redirect("AddApplication.aspx?ID=" + strID + "&AppName=" + strAppName + "&Edit=True");
}
}
}
Kindly let me know if I need to add something. Thanks for any suggestions.
What is the best way to fill a template file with variables, which are collected from a Windows Form or Web Page. I want to create a wizard program that collects some data from user, for instance, reportname, reporttype, etc. and I need to create then some xml files (templates) with these variables inserted.
With VIM or Emacs I can put comments in the file that will be VIM's settings for that file:
/*
* Local Variables:
* mode: C
* c-basic-offset: 4
* c-indentation-style: linux
* indent-tabs-mode: nil
* default-tab-width: 8
* fill-column: 125
* End:
*
* vim: et:sw=4:ts=8:si:cindent:cino=\:0,g0,(0:
*/
Can the same be done with Nedit?
I have two tables:
Table1 = Schools
Columns: id(PK), state(nvchar(100)), schoolname
Table2 = Grades
Columns: id(PK), id_schools(FK), Year, Reading, Writing...
I would like to develop a query to find the schoolname which has the highest grade for Reading.
So far I have the following and need help to fill in the blanks:
SELECT Schools.schoolname, Grades.Reading
FROM Schools, Grades
WHERE Schools.id = (* need id_schools for max(Grades.Reading)*)
I have a table fill with cell items.
If I click on a cell item, that cell item is 'linked' or related to other cell items, which need to be highlighted.
If another cell item is clicked, that cell's related cells need to light up.
Is there a jQuery plugin to accomplish something like this? Or would I have to look into writing one myself?
What is the easiest way to automatically fill a datetime column in an SQL data table with the date the row was created? Using SQL Server 2005 if that matters.
Hi,
I think i'm getting senile because I was convinced that to give a name to your application, you had to fill this part of the manifest :
<application android:icon="@drawable/icon" android:label="MyApplicationName">
However for a reason I don't understand, my application gets the name of my first activity, in which I load data, henceforce, It is called "Loading"...(defined as follows in the manifest)
<activity android:name="AccueilSplash" android:label="Loading">
Any idea why that is?
my primay key is user_id which is auto incremant UNSIGNED ZERO FILL, i want to display user_id on a page without leading Zero( means 1 instead of 0000000001 )..
how can we do that in php or in mysql
one more question...
if i delete last record( let user_id=21) wwhich have highest id of that table then can we adjust auto increment value to 21 instead of 22 of that table.
Hi is there a free avaible translation backend with database avaible which can handle multiple users(no login needed), multiple languages (UTF-8) and provides automatic google translation?
I just need this tool to fill a database (preferable mysql) with simple tables like this:
language | label | text
english | _helloworld | Hello World!
german | _helloworld | Hallo Welt!
I don't care about export since this will have to be created anyways..
Thanks it would be a real timesaver if something with an usable UI exists already.
I'm drawing a circle in C# and i have divided it into some parts,i want to fill different parts with different colors,is there anyway to do this? and how?i tried using fillpie() but i couldn't get the arguments to work.
I've never really used PowerShell before, and playing with it a bit, it looks like it uses cmd.exe's style of tab completion (fill in the first likely candidate, and then you can use tab to cycle through other alternatives). I'd much prefer the way e.g. bash works, where if there are multiple candidates, it shows a list of them.
Is there an easy way to turn this on, by any chance?
So, I want to resize images to a FIXED width, but proportional height.
I have been trying a wide range of operators:
380x242#
380x242
380!x242
380x242<
none of them have the desired effect. Any help? I want it to fill or resize to the 380 width, then resize / shrink the height by the same factor it used to shrink or resize the image to 380 wide.
I've read lots of tutorials on how to deserialize a JSON object to an object of a particular using DataContractJsonSerializer. However, I'd like to deserialize my object to a Dictionary consisting of either Strings, Arrays or Dictionaries, such as System.Json does with SilverLight when I say JsonObject.Parse(myJSONstring).
Is there an equivalent to System.Json that I can use in my WPF project?
(just a short background: I'm fetching JSON objects that have way to much info, and I just want to use a little bit to fill out a String array)
Cheers
Nik