|
Hi all
I want to make a very basic rythm game in c#. What would be the best way to get the grahics to run in time with a music file? Some basic ideas of how it could be done would be great to get me started.
thanx
|
|
|
|
|
The easiest and most accurate would be to simply use known music and store the time offset and duration of the beats for each song.
To use it with any music, you would typically do fourier analysis of the music waveform to detect patterns in the intensity at different frequencies.
---
single minded; short sighted; long gone;
|
|
|
|
|
You obviously know what your talking about but sadly i had no idea ... any chance you could break it down a bit for me (which music file is best to use?, how do i find the beat durations? etc.)
I was thinking of having an editor and plotting the notes on a timeline ... saying that I dont think there would be another way to do it!
Thanks for your response
|
|
|
|
|
select names from employee
and the query returns names
aa
bb
cc
dd
ee
how can i store this values into array
|
|
|
|
|
Create an array with the same length as the number of records. Loop through the records and copy the values into the array.
How you loop through the records depends entirely on how you fetch the records from the database.
---
single minded; short sighted; long gone;
|
|
|
|
|
this is the function written in javascript to load pictures.
function loadPics()
{
pic0=new Image();
pic0.src="1.jpg";
pic1=new Image();
pic1.src="2.jpg";
pic2=new Image();
pic2.src="3.jpg";
pic3=new Image();
pic3.src="4.jpg";
pict=new Array();
pict[0]=pic0.src;
pict[1]=pic1.src;
pict[2]=pic2.src;
pict[3]=pic3.src;
}
i retrive the image src from database and stored it in the array like this..
try
{
if (con.State != ConnectionState.Open) con.Open();
cmd.Connection = con;
cmd.CommandText = "select varImageSrc from mtblGallery";
dt.Clear();
ada.SelectCommand = cmd;
ada.Fill(dt);
recCount = dt.Rows.Count;
string[] imgArray = new string[recCount];
for (i = 0; i < recCount; i++)
{
imgArray[i] = (dt.Rows[i][0].ToString());
}
if (con.State != ConnectionState.Closed) con.Close();
}
and now my problem is how can i load the imagesrc from this imgArray to the javascript function to make the loadPics() function dynamically load the images.
can anyone help.. its urgent.
thanks in advance
|
|
|
|
|
Hi All,
I am facing two problems while accessing the Sharepoint server URL using HttpWebRequest/HttpWebResponse.
Sample Code:
try
{
string Url = "http://<sharepoint server>/<site>/<docment library>;
Uri destUri = new Uri(Url);
HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(destUri);
CredentialCache cache = new CredentialCache();
cache.Add(req.RequestUri, "Negotiate", new NetworkCredential(strUserName, strPassword, strDomain));
cache.Add(req.RequestUri, "NTLM", new NetworkCredential(strUserName, strPassword, strDomain));
req.Credentials = cache;
HttpWebResponse ores = (HttpWebResponse)req.GetResponse();
ores.Close();
if(ores.StatusDescription.ToLower() == "ok")
{
MessageBox.Show("Success");
}
else
{
MessageBox.Show(ores.StatusDescription);
}
}
catch (WebException we)
{
MessageBox.Show("Web Exception : " + we.Message);
}
catch (Exception ex)
{
MessageBox.Show("General Exception : " + ex.Message);
}
Issue #1:
I have created the folder inside a folder under sharepoint document library(ex: DocumentLibrary\Folder1\Folder2)
Using the above code I am testing the connection, it returns Success up to Folder1(ex: http://<server>/<site>/DocumentLibrary/Folder1)
I am trying the add the Folder2 in URL, It returns web exception UnAuthorized for the same credential.(eg: http://<server>/<site>/DocumentLibrary/Folder1/Folder2)
Issue #2: If there is any space in document library name, it returns web exception "Bad URL"
(eg: http://<server>/<site>/Shared Documents)
Can any one know how to fix these problems?
Thanks
Ram
-- modified at 16:03 Saturday 8th September, 2007
|
|
|
|
|
hi
My application is related to sockets and I m using threads in it.I closed sockets as well as threads but now still
Y I m getting this exception and how to remove this error
"
Unhandled exception at 0x7c81eb33 in Playback1.exe: 0xE0434F4D: 0xe0434f4d."
plz help me out as soon as possible
B!Z
|
|
|
|
|
Please if someone can explain if this can be done/how it is done :
I want my program to automatically click a link for a website and then save the file with the defualt program that is assigned to it.(not my program)
For example, if the user writes "nero", I enter a search site that I choosed before, and I want it to click the first result that comes from the website's search engine, and afterwards to click open. (for example in my computer if I click open it will be downloaded with flashget/azuereus depends)
simply go for the defualt.
|
|
|
|
|
You may want to use winapi calls to simulate user clicks, but it will be very strongly coupled with the browser you choose. Why don't you just open a connection with the search engine you are using, and talk to it as though you are the browser. That way, all the data will pass through your code with no middleman. Then if you want to display what you found, you can open a third party application at that time with the file you saved to the hard drive.
Jeff
|
|
|
|
|
How can I do that? I'm new to this stuff and I'm still learning.
How can I simulate user clicks?
and more important how can I open connection with search engines??
|
|
|
|
|
Here is an example to Simulating User Clicks. Just use the methods "GetWindowHandleWhoseTitleStartsWith" and "SimulateClick". The problem with this approach is that the external application must be active (I think) and visible (I think). Also, you develop a hard dependency between the location of buttons in your application and the third-party software, which is terrible practice. The alternative method I suggested is DEFINITELY the preferable way to do it, but I cannot give you an example because I have not used sockets or HTML communication in C#. Basically, the idea is that you would open a socket connection on the standard html port at the destination (probably some call like Socket s = new Socket("http:\\www.google.com", 54), send an html request to get the search page (probably like s.SendMessage(new HTMLRequest("http:\\www.google.com#searchstrings"))), then parse the return HTML to get the first link (see xmldocument or htmldocument), and finally load the data from that link into your own HTML browser. You will have to do some work to figure that out, but it will ALWAYS work and does not depend on third-party software (other than the search engine). Sorry I couldn't be more help in that arena.
private IntPtr m_Handle = IntPtr.Zero;
public delegate bool EnumWindowsProc(IntPtr handle, object data);
[DllImport("user32.dll")]
public extern bool EnumWindows(EnumWindowsProc proc, object data);
[DllImport("user32.dll")]
public extern int GetWindowText(IntPtr handle, StringBuilder title, int maxSize);
[DllImport("user32.dll")]
public static extern IntPtr SendMessage(IntPtr handle, uint op, uint keys, Point point);
public IntPtr GetWindowHandleWhoseTitleStartsWith(string title) {
m_Handle = IntPtr.Zero;
EnumWindows(myEnumWindowsProc, title);
return m_Handle;
}
private bool myEnumWindowsProc(IntPtr handle, object data) {
string searchTitle = data as string;
if (searchTitle == null)
return true;
StringBuilder title = new StringBuilder();
GetWindowText(handle, title, searchTitle.Length + 1);
if (title.ToString() != searchTitle)
return true;
m_Handle = handle;
return false;
}
public void SimulateClick(Point pos, IntPtr handle) {
SendMessage(handle, (uint)WM_MOUSEDOWN, 0, pos);
SendMessage(handle, (uint)WM_MOUSEUP, 0, pos);
}
Jeff
|
|
|
|
|
Ever have this problem with Oracle 9i+ when opening the connection
ps. It's working just fine with 8i!
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Hi
I want to use a Windows Service to call certain stored procedures once a day.
It needs to pass the DateTime.Now as a variable to these stored procedures.
If someone could please help me out as to how i implement a timer and call stored procedures and pass the current datetime to the stored procedures.
Thanks
|
|
|
|
|
You can initialize a variable of System.Threading.Timer in the OnStart method as set up event handler for Elapsed event. In the event handler call the stored procedure using sqlcommand object and pass the parameter by adding it to Parameters collection
|
|
|
|
|
hi all.i use twain.net image scanner and i want set resolution within code wiyhout using twain.interface but i can't please send me sample with C#
|
|
|
|
|
chehreghany wrote: i want set resolution within code wiyhout using twain.interface
The only method you have to use is the TWAIN interface...
Or if you don't want to use TWAIN, you might be able to find an SDK for the scanner you're using. In which case, you'll have to use it's interface to set the resolution.
There is no "generic" .NET or Win32 API method to do this.
|
|
|
|
|
I want to copy one listview.item and change name on subitem[1] by +1 if that exists add+1 and futher
Dictionary<string, int32=""> list = new Dictionary<string, int="">();
if (listView2.SelectedItems.Count > 0)
{
foreach (ListViewItem lvi in listView2.Items)
{
int number = Convert.ToInt32(lvi.SubItems[1]);
bool alreadyExists = true;
while (alreadyExists)
{
alreadyExists = false;
foreach (int existingNumber in listView2.Items)
{
if (existingNumber == number)
{
alreadyExists = true;
break;
}
}
if (alreadyExists)
{
number = number + 1;
}
}
}
}
it says: Unable to cast object of type 'ListViewSubItem' to type 'System.IConvertible'?
what should i do? sigh
tnx mates
|
|
|
|
|
andredani wrote: int number = Convert.ToInt32(lvi.SubItems[1]);
You can't convert a ListViewSubItem control to an integer. If you want the contents of the item, use the Text property.
---
single minded; short sighted; long gone;
|
|
|
|
|
have search in internet the hole day after this.. can you help me....
|
|
|
|
|
Did you read my post? If there is something that you don't understand, say what it is instead of just pretending that I didn't write it.
---
single minded; short sighted; long gone;
|
|
|
|
|
no.. i meant that i haved googled on text property and listview property..
But i did´t find the awnser..
I have come as far as this:
if (listView2.SelectedItems.Count > 0)
{
int number = 0;
foreach (ListViewItem lvi in listView2.Items)
{
bool alreadyExists = true;
while (alreadyExists)
{
alreadyExists = false;
foreach (int existingNumber in lvi.SubItems[1].Text)
{
if (existingNumber == number)
{
alreadyExists = true;
break;
}
}
if (alreadyExists)
{
number = number + 1;
}
}
this.listView2.Items.Add(number.ToString());
}
}
changed a little bit but (i only get 0 in my listview, its beacause int number = 0;)
-- modified at 19:01 Saturday 8th September, 2007
|
|
|
|
|
I don't understand what nodes you want duplicated, you might need to post an example of the input and output. There is not much point in doing a foreach over a single item like you have done in the inner loop.
Here is an example that duplicates each node in the listview and increments the subitem. This only adjusts SubItems[1] other subitems are not changed. It also does no checking if SubItems[1].Text is an number or not.
e.g
Before:
A 1
B 1
C 1
After:
A 1
B 1
C 1
A 2
B 2
C 2
foreach (ListViewItem item in listView1.Items)
{
int value = int.Parse(item.SubItems[1].Text);
ListViewItem newItem = (ListViewItem)item.Clone();
newItem.SubItems[1].Text = (value + 1).ToString();
listView1.Items.Add(newItem);
}
|
|
|
|
|
it´s gonna work like this:
before:
a k111
b k111
a k112
after a click on a k111:
a k111
b k111
a k112
a k113 (this is the copy)
|
|
|
|
|
What are you trying to do really? The text of a SubItem is a string, and a string doesn't contain any integers, it only contains characters.
If you use foreach on a string, it will loop through the characters in the string, and casting each character to int means that you get the unicode character codes for the characters in the string. You won't find any characters in the string with the character code 0.
What does the SubItems contain? If it is the string representation of a number, you have to parse the string if you want to get the number. Use the int.Parse method.
---
single minded; short sighted; long gone;
|
|
|
|