name pretty much says it all.
i am looking for the sound command to play a wav file. (Shouldn't be to complex )
I am using visual basic 2008 and am programing in .net
I am trying to rewrite my code from basic for ppc which obviously isn't the same
Hi,
I hope this will help:
Option Explicit
Dim strSoundFile, objShell, strCommand
sub PlaySound()
strSoundFile = "C:\Downloads\jad0057a.wav"
Set objShell = CreateObject("Wscript.Shell")
strCommand = "sndrec32 /play /close " & chr(34) & strSoundFile & chr(34)
objShell.Run strCommand, 0, True
End Sub
Do While True
PlaySound
WScript.Echo( "Sleeping ... " )
WScript.Sleep( 1000 )
Loop
Kind Regards
Related
Hello
I am trying to resize images, but i cannot get it work
The Size is adjusted but then I only see the half of the image or it is too small
I do not want to use PictureBox.StretchImage because i want to draw it on a picture without being related to the size of the PictureBox
here my Code:
Code:
Public NeedRefresh As Boolean
Public ObjectHeight As Integer = frmMain.pctDraw.Height / 5
Public BackBufferBitMap As Bitmap
Public BackBuffer As System.Drawing.Graphics
Dim TempBitmap As New Bitmap(32, 32)
Dim TempImage As Image
Public Sub LoadImage()
Dim myGraphics As Bitmap
myGraphics = New Bitmap(AppPath & "\img\test.jpg")
TempBitmap.Dispose()
TempBitmap = Nothing
TempBitmap = New Bitmap(32, 32)
Dim tempGraphics As Graphics = Graphics.FromImage(TempBitmap)
tempGraphics.DrawImage(myGraphics, 0, 0, New Rectangle(0, 0, 32, 32), GraphicsUnit.Pixel)
tempGraphics.Dispose()
myGraphics.Dispose()
End Sub
Thanx
SciLor
Again,
MSDN FORUMS is your friend:
http://social.msdn.microsoft.com/Search/en-US/?Refinement=112&query=resize+image+
MSDN isnt my friend all routines wont work on .net compact framework
but thank you
Resize image?
Hi
Just wonder if you figured out how to do it?
Im trying to do a imageblog application...
/Sebulba_se
Take a look at my ScrollingDemo
http://forum.xda-developers.com/showthread.php?p=3041373
I just use a "ImageList" control to do this without thinking just put it in and get it from there again
another idea would be to do this with LockBits
http://msdn.microsoft.com/en-us/library/5ey6h79d(VS.80).aspx
but I still use the control..
Hi i currently have the WM6.1 in built client working with my SIP server the G711u codec works fine over HSPA but im curious to know if given G.729 would calls over GPRS be possible? Which bring me onto the main point If added to the registry and the codec placed in the approperate directory would this enable G.729 as a codec for the WM6.1 VoIP client:
; Configure ACM_G729 FormatTag
; Note that G729 frame_duration = 20ms in this example [HKEY_LOCAL_MACHINE\Comm\RTC\ACM\G729]
"PayloadType" = dword:12
"FrameDuration" = dword:A
"CodecRank" = dword:1
"Driver" = "g729.acm"
[HKEY_LOCAL_MACHINE\Comm\RTC\ACM\G729\WaveFormat]
"FormatTag" = dword:44
"Channels" = dword:1
"SamplesPerSec" = dword:1F40
"AvgBytesPerSec" = dword:3E8
"BlockAlign" = dword:A
"BitsPerSample" = dword:0
"bSize" = dword:2
; Configure ACM_G729 Prefix
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\CODEC_G729]
"Prefix"="ACM"
"Dll"="g729.acm"
; Cofigure Codec Preference
and for path:
[HKEY_LOCAL_MACHINE\Comm\RTC\Codec]
"PreferredAudioCodec"=dword:12 ; 0=pcmu, 12=729
"UsePreferredCodec"=dword:1
came from: http://msdn.microsoft.com/en-us/library/aa924754.aspx
Thanks
Dphi
dphiance said:
Hi i currently have the WM6.1 in built client working with my SIP server the G711u codec works fine over HSPA but im curious to know if given G.729 would calls over GPRS be possible? Which bring me onto the main point If added to the registry and the codec placed in the approperate directory would this enable G.729 as a codec for the WM6.1 VoIP client:
; Configure ACM_G729 FormatTag
; Note that G729 frame_duration = 20ms in this example [HKEY_LOCAL_MACHINE\Comm\RTC\ACM\G729]
"PayloadType" = dword:12
"FrameDuration" = dword:A
"CodecRank" = dword:1
"Driver" = "g729.acm"
[HKEY_LOCAL_MACHINE\Comm\RTC\ACM\G729\WaveFormat]
"FormatTag" = dword:44
"Channels" = dword:1
"SamplesPerSec" = dword:1F40
"AvgBytesPerSec" = dword:3E8
"BlockAlign" = dword:A
"BitsPerSample" = dword:0
"bSize" = dword:2
; Configure ACM_G729 Prefix
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\CODEC_G729]
"Prefix"="ACM"
"Dll"="g729.acm"
; Cofigure Codec Preference
and for path:
[HKEY_LOCAL_MACHINE\Comm\RTC\Codec]
"PreferredAudioCodec"=dword:12 ; 0=pcmu, 12=729
"UsePreferredCodec"=dword:1
came from: http://msdn.microsoft.com/en-us/library/aa924754.aspx
Thanks
Dphi
Click to expand...
Click to collapse
Maybe, if you have a g729.acm build for ARM/PocketPC. Do you?
hello,
I'm writing a Android App (java) - but I guess this question is pretty general, and isn't java-specific:
so I have an Array of Elements
and I let a random-number-generator pick one array-element randomly and hand it to me.
now I've also built in a "score"-field into each array Element
so what I want to do now, is that the random-number-generator takes the array's "score" in consideration, and gives me the array-elements with the higher/lower scores with a higher/lower probability
I dont want it to ALWAYS/NEVER give me the elements with the highest/lowest score - just with a higher/lower probability
I hope I could describe my problem in a proper way....
does anybody know how to achieve this?
(as I said, i use java, but i guess code in any language - or even pseudo-code would help me out)
*bump*
anybody?
Try this, it's in C# but it's pretty close to Java.
You cannot directly weight the random function so you have to use a different method.
By applying a weight to each item in the array, then using a random function to select using the weighting values, the results of the selection can be swayed.
The weighting values are relative to each other.
Using the values in the code, 'B' should turn up about three times more often than 'A'
The only object that may need some explanation is Random:
http://msdn.microsoft.com/en-us/library/system.random(v=VS.80).aspx
Code:
using System;
namespace RandomWeighting
{
class Program
{
static void Main(string[] args)
{
char[] Select = new char[10] {'A','B','C','D','E','F','G','H','I','J'};
int[] Weight = new int[10] {10,30,25,60,20,70,10,80,20,30};
int[] WeightSum = new int[10];
int i,j,k;
Random Rnd = new Random();
WeightSum[0]=Weight[0];
for (i = 1; i < 10; i++)
WeightSum[i] = WeightSum[i - 1] + Weight[i];
for (j = 0; j < 70; j++)
{
k = Rnd.Next(WeightSum[9]);
for (i = 0; k > WeightSum[i]; i++) ;
Console.Write(Select[i]);
}
Console.WriteLine();
}
}
}
Output:
Code:
HEFIBHHCCFBCAEFFDHACHBEJHHFDFIDFEDFFCHHDJBIDJEHHFHCJJJBHJGBDDGFDDFHHHB
Note the low density of A and G as opposed to H
It is just a sample at random, but 2 'A's and 7 'B's roughly matches the conjecture above, but over a million selections, the distribution is as follows:
Code:
A 30664
B 84187
C 70648
D 168481
E 56529
F 197311
G 28145
H 225764
I 56613
J 81658
If your code changes values in the Weight array then the WeightSum array must be recalculated.
wow, thats a lot!
The only thing I dont understand about the code is this line:
k = Rnd.Next(WeightSum[9]);
for (i = 0; k > WeightSum; i++) ;
what exactly happens here?
what kind of a for-loop is this?
why is there no body?
and strangely, while debugging this line, i noticed that the value of i jumps to some random number in this line - and I have no idea why and how
------
by the way: I've already tried it out, it works pretty good.
although I noticed that the first element always gets picked ALOT, no matter how low the weight.
I think thats a flaw in the algorithm
After the following code:
Code:
for (i = 1; i < 10; i++)
WeightSum[i] = WeightSum[i - 1] + Weight[i];
The WeightSum array contains the following values:
Code:
[0] 10
[1] 40
[2] 65
[3] 125
[4] 145
[5] 215
[6] 225
[7] 305
[8] 325
[9] 355
The Random.Next() function that takes a single integer as an argument is defined as:
-------- Courtesy of MS VS .NET Help ------
public virtual int Next(int maxValue)
Parameters maxValue Type: System.Int32
The exclusive upper bound of the random number to be generated. maxValue must be greater than or equal to zero.
Return Value Type: System.Int32
A 32-bit signed integer greater than or equal to zero, and less than maxValue; that is, the range of return values ordinarily includes zero but not maxValue. However, if maxValue equals zero, maxValue is returned.
-------------- End of Help ----------------
So, we are asking for a random value between 0 and 354,(element WeightSum[9] above). The following code then finds which is the lowest element of WeightSum which holds a value greater than the one we have been given. When this happens 'i' contains the index to use for the selection.
Code:
for (i = 0; k > WeightSum[i]; i++);
The standard construction of a for loop in C is
for(One or more initialisation statements; Do_While_True Condition; One or more iteration statements)
{
loop processing code;
}
If there is nothing to do in the loop body, you don't need it, and you can replace it with the ';' at the end of the for statement. In effect, it is identical to the following code:-
Code:
i=0;
while(k > WeightSum[i])
{
i++;
}
As regards the first element being picked more than the others, have a look at the distribution table in post #3. It is what you would expect for the values given. I assume the difference is either the Random function in Java or some different implementation between C# and Java.
You may have to change some of the code slightly, i.e. change the for() loop to the while() loop above and step though it in the Java debugger to get to the root of the problem.
You can't debug a for loop followed by an immediate ';' The entire for loop is executed to completion when you use debug and try and step through it. To debug it place a dummy statement in the for loop. A breakpoint may now be set on this line.
Code:
int i,z;
for (i = 0; k > WeightSum[i]; i++)
{
z=0;
}
ActionScript and Javascript versions ...
Thanks for the great write-up! In case anyone is interested, I've adapted this into a javascript and ActionScript class. If anyone is interested, I've attached the code. For a more in-depth post, check out blog.teamthinklabs.com.
Cheers!
Kipp Ashford
Art Director
Seven2 Interactive
Hello,
If anyone has the dslreports.com script for:
Saving a random setting on Pbxes.org when there's a trunk outage notification (free account) ,
I would highly appreciate it.
The above website is unavailable currently and am in need of the script so I can use my GV + Callback + Sipdroid. For reference, it was a simple (either JS or VB) script which saved a random setting whenever there was a trunk outage.
Or if there are any other suggestions for someone to route calls pretty much the same way for android 1.6 I would highly appreciate it as well.
Thank you
Also, a new question,
would anyone happen to know if at this date 4/23/12, Verizon charges or back charges people for using Google voice + callback for free calls as well?
thank you for any help
edited in question
..
I created this vbscript a few years ago for the same reason. Works well. I have it set up as a Rule in Outlook, so whenever I get a trunk outage email from PBXes, it runs this script automatically.
dslreports.com/forum/r24908015-PBXes-free-acount-trunk-outtage-quick-fix
I've pasted the script here just in case the dsl reports post gets removed:
Code:
'###########################################
'## PBXes Trunk Outtage Recovery
'## for Free Users
'##
'## Author: atomicrabbit ([email protected])
'## Date: 2010.10.08
'###########################################
'Edit the following variables appropriately
'------- START EDITING HERE ... DO NOT TOUCH ANYTHING BELOW -------
'Setting Page
' Set this to one of the settigs pages of PBXes
pbxes_settingPage = "https://www4.pbxes.com/config.php?display=extensions&extdisplay=100"
'Form Name
' Set this to the form name on the settings page specified above.
' It MUST be relative to the form on the page specified above
pbxes_formName = "addNew"
'PBXes Login Info
pbxes_username = "your_username" 'Your PBXes.com username
pbxes_password = "your_password" 'Your PBXes.com passowrd
'IE Window Visibility
' True - IE window will be visible while processing the code
' False - IE window will be hidden and run the code in the background
pbxes_windowVisible = False
'Browser Timeout
' Set max timeout for browser responsiveness (in seconds)
' Default: 7
pbxes_timeout = 7
'------- STOP EDITING HERE ... DO NOT TOUCH ANYTHING BELOW -------
pbxes_applySettings = pbxes_settingPage + "&clk_reload=true"
pbxes_timeout = pbxes_timeout * 5 'because the iterations are 200ms
pbxes_tCount = 1
'Create IE object
Set objIE = CreateObject("InternetExplorer.Application")
set WshShell = WScript.CreateObject("WScript.Shell")
'Go to PBXes.com Extensions page
objIE.Navigate pbxes_settingPage
objIE.Visible = pbxes_windowVisible
Wscript.Sleep 1000
'Check if not logged in
if not objIE.Document.Forms("login") is nothing then
' Login to PBXes if you're not already
objIE.Document.All.Item("username").Value = pbxes_username
objIE.Document.All.Item("password").Value = pbxes_password
objIE.Document.All.Item("remember").checked = "false"
objIE.Document.All.Item("btnSubmit").click
Wscript.Sleep 2000
'Go to settings page
objIE.Navigate pbxes_settingPage
'Wait for page to load
Do
Wscript.Sleep 200
pbxes_tCount = pbxes_tCount + 1
Loop While objIE.Document.Forms(pbxes_formName) is nothing AND pbxes_tCount < pbxes_timeout
end if
if pbxes_tCount >= pbxes_timeout AND objIE.Document.Forms(pbxes_formName) is nothing Then
MsgBox "Browser timeout. Try running thescript again.", vbOkOnly, "PBXes Trunk Outtage"
'exit script
Elseif not objIE.Document.Forms(pbxes_formName) is nothing Then
'Submit form
call objIE.Document.Forms(pbxes_formName).elements("Submit").click
Wscript.Sleep 2000
'Apply the changes (red bar at top)
objIE.Navigate pbxes_applySettings
Wscript.Sleep 2000
'Close IE
objIE.Quit
MsgBox "Recovered from trunk outtage!", vbOkOnly, "PBXes Trunk Outtage"
Else
MsgBox "Could not find '" & pbxes_formName & "' form on '" & pbxes_settingPage & "'.", vbOkOnly, "PBXes Trunk Outtage"
'exit script
End if
'Clear variables
Set objIE = Nothing
Set pbxes_settingPage = Nothing
Set pbxes_applySettings = Nothing
Set pbxes_username = Nothing
Set pbxes_password = Nothing
Set pbxes_windowVisible = Nothing
Set pbxes_timeout= Nothing
Set pbxes_tCount= Nothing
Wscript.quit
I actually found the script before this but still Thank You for the script as it's been helpful, although I don't know why I seem to receive "false outtage" e-mails in the sense that calls still seem to be routed with not much interruption if any, what's with that?
Thank you!!
This threads will contains extensions for the navigation system based on NNG iGO PRIMO NextGen
Extend the functionality of regular buttons VIApoi remove from the route.
Standard button appears, if you have to route waypoints (VIApoi).
So it stays ... but when you click on it (click) menu appears, listing all VIApoi and
you are free to either tapnut elsewhere and remove the first in the queue
either by the victim ... long tapom remove everything to her ... and her too
Conveniently this is the case when you route with intermediate points and you for some reason "spilled" from it.
Re-start will lead to the fact that the navigator will lead to the first point ... but you have somewhere Intermedia ... here come in handy.
Plant ... in all weather conditions))
debugger
Debugger - debugging tool due to lack of log. You can view the result in ONLINE. You can "ON THE FLY" ... take snapshots directly from the cab.
Debugger You can use one or all of three ways at once.
*#
Call in the right place at the right time ... and save the data
If the variable Global - transferred to the "name", or simply herself. The number of input parameters is not limited.
Example
var1 = "hello"
local var2 = 8
t = {2,5, { "Bonnie Parker", "Clyde Barrow"}}
VW_Debugger ( "-------------------------------",
"Hex (var1)", - var1 must be GLOBAL
var1, var2, "t", "-------------------------------")
The result in the ... / lm_DebugToList.txt:
Variable # 1 = -------------------------------
Variable # 2 = 68 | 65 | 6C | 6C | 6F |
Variable # 2 = h | e | l | l | o |
Variable # 3 = hello
Variable # 4 = 8
t = {
[1] = 2,
[2] = 5,
Table # 3 = {
[1] = Bonnie Parker,
[2] = Clyde Barrow,
}
.
}
Variable # 6 = -------------------------------
*#
Enter code snippet ONLINE
Enter the line of code as you write in the body of the program.
Example
return hex (Help)
The results are on the screen and a file.
*#
Complex. But requires some setup allows to get a snapshot at any time
For this purpose has already been declared a global table VW_Debugger_Table and the following structure is used:
Example:
hook_DebugSnapshot: register (function ()
****UX_Name = "<name of your utilities>" --osoboe attention. Utility field
****VW_Debugger_Table.v_integer = v_integer - your variable
****VW_Debugger_Table.v_char = v_char --Your variable
****VW_Debugger_Table.v_table = v_table --Your variable
end)
It is desirable to place at the end of your utility body.
In other words - you need to put in your section (lua chunk) here such fragments, which will ensure the filling of the table
you desired variables. The process you manage yourself using SnapShot keys
I note that the third method does not require cleaning after the source code debugging. This tool can be left in the body of the program.
It can be activated at any time by pressing the button or VW_Debugger_Get_Snapshot () of the body of the program and does not interfere with the functionality of standard code.
All results are displayed on the screen and are available in /save/profile/01/userlist/lm_DebugToList.txt ... unless of course you do not erase.
CommonRouteWarnings.zip
Utility - informer. The name speaks for itself: CommonRouteWarnings.zip
All sounds and warning match again utverdennomu standard: SetAudioSignal.
Long press - access to the configurator.
Informer as a button in the cockpit. Informs about 12 developments on the route of choice.
They will be "PROKRUCHIVATYA" at one location in the cabin, but with different icons of different information and ... according to the chosen event he or events.
Upper information - the distance to the event, the bottom - time in the scene.
Now click on the icon will get a third of the current screen with an overview of the place, the relevant event, well, or automatically.
On the TMC. Upper infa - distance sobyliya, lower - latency, which makes this event (not to be confused with the overall delay)
Full set here
Hi there. working igo 8 would be interested. samsung s8 phone. I would like a link. Thanks