w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
Terminal Restart Updates Rails and Ruby Versions
You probably want to set a default as described here. So it might be something like rvm use 1.8.7@your_gemset_name --default. That will set the ruby and gemset to what you need.

Categories : Ruby On Rails

Preserve a timer through activity restart (orientation change)
One approach would be to move your timers to a setRetainInstance(true) fragment. Such a fragment will not be destroyed on an orientation change. ( btw It is best NOT to update the UI in a retained fragment.)

Categories : Android

How to rotate windows forms in every 20 secs using timer in windows application?
On a 20 second timer you can call 'BringToFront' on each form. http://msdn.microsoft.com/en-us/library/system.windows.forms.control.bringtofront.aspx

Categories : Vb.Net

how do I get windows SCM to restart my service when it fails
The SCM will restart your service if it fails. But all the normal termination modes from a Delphi service do not count as failure. If you could raise an exception from the main service thread that was unhandled, then that would count as a failure. However, I think the simplest way for you to force a process termination that is treated as a failure is to call ExitProcess. You could equally well call the Delphi RTL function Halt which will ultimately call ExitProcess. However, since your process is probably in a bad state I'd be inclined to go straight to ExitProcess. As has already been commented, avoiding the exception in the first place would be the ideal solution.

Categories : Windows

Restart a windows service at specific time
Suppose you want to run each task at 6:30 AM everyday var dtTimeToStartAt = DateTime.Today.AddHours(6).AddMinutes(30); dtTimeToStartAt = DateTime.Now > dtTimeToStartAt ? dtTimeToStartAt.AddDays(1) : dtTimeToStartAt; var timer = new System.Threading.Timer(x => YourCallbackMethod(), new object() /*not much use*/, dtTimeToStartAt.Subtract(DateTime.Now), new TimeSpan(24, 0, 0));

Categories : C#

How do software updates for windows work?
Basically there is a server somewhere on the interwebz that the game knows how to find (via IP address or whatever). When the game loads, it connects to that server and tells it the game's current version information, the server responds with whether or not a new update is available and whatever other info is needed. After that the game display that an update is available and downloads the update from that server. That is the basic idea anyway, without getting too technical. EDIT: To put it in a possibly better perspective, think about how you manually update things. First you open your web browser, then you navigate to a URL that you know. Once the page is open you can see their latest download version and check if your version is up to date, if it isn't then you click the link to

Categories : Dotnet

Editing file restart the server in meteor in windows
Just restart your server. This is very common issue on newer version of Meteor for Windows. Hopefully the Meteor core team will sort it out soon. See https://github.com/meteor/meteor/issues/513.

Categories : Javascript

Check for Updates functionality For Windows application
I don't think there is any facility to add that feature through install shield but there is a software update framework for .NET called NetSparkle. You can try that if you want. If you want to implement something on your own then its better to some other websites like code project that provide startup code or similar projects. Here 's the link for NetSparkle. There is also a similar question on StackOverflow : Code to check for updates, install new version of app

Categories : C#

Realtime Updates from Facebook in Windows Phone
It is not possible for a WP app to receive such updates from Facebook. Because you don't have any such API for the purpose. What about RealTime API ? Well, it is possible to get Realtime updates from facebook using that API, but it requires you to specify a callback Url. In other words, it require you to have a web server with an web application that can accept GET and POST requests from server. After receiving such updates, your webapp can broadcast updates to device using PUSH Notification Service. Any Workaround ? Yes ane workaround can be to use a periodic task that runs and fetch data after regular intervals. But beware of: Amount of Data you send in periodic Task (Battery + Data Consideration). Reliability factor of Periodic Tasks (Thay may not run at all).

Categories : Facebook

Bad timer in Windows service
I would change it to this: protected override void OnStart(string[] args) { timer = new System.Timers.Timer(); timer.Elapsed += new ElapsedEventHandler(getFileList); timer.Interval = 10000; timer.AutoReset = false; timer.Enabled = true; } private void getFileList(object sender, EventArgs e) { List<string> files = new List<string>(); try { FtpWebRequest request = (FtpWebRequest)FtpWebRequest.Create(****); Setting AutoReset to false causes the Timer to fire just once. In other words, it's like an automatic Stop after the first firing of the Timer. So doing that means you don't need to Stop() the Timer in your getFileList method. This is an im

Categories : C#

How to stop the timer in windows 8?
You can write a ticking function. public static void ticking(bool tick) { if(tick) { timerpartAnimation.Interval = TimeSpan.FromMilliseconds(1); } else { timerpartAnimation.Interval = TimeSpan.FromMilliseconds(0); } } so ticking(false); means stop the timer.

Categories : C#

How to create timer in Windows in C++
Yes. The easiest way to create a timed callback to a non-static class method is to use lambda captures. This example is plain C++ (C++11). It works fine with for example Visual Studio 2012 (with the 'CTP November 2012' addition) or gcc 4.7.2 or later. Note that you need to be respect the difficulties of multi-threaded programming since the callback is arriving on 'another' thread. I strongly recommend getting the book C++ Concurrency in Action: Practical Multithreading' by Anthony Williams. #include <future> #include <iostream> #include <chrono> #include <thread> #include <atomic> class C { std::atomic<int> i; public: C(int ini) :i(ini) {} int get_value() const { return i; } void set_value(int ini){ i=ini; } }; int main(){ C

Categories : C++

Should an application that updates Windows Mobile 6.5 to Compact Framework 3.5 be .NET 1.0 or native code?
For Windows CE (Windows Embedded Compact now) it is entirely up to the device manufacturer whether they want to include the CompactFramework. However, for Windows Mobile 6 the CF 2.0 SP2 was preinstalled with the OS (So I believe that 6.5 should have it too). I believe that you can probably write .NET CF 2.0 code for it and have it be expected to run. As far as native code, one thing to keep in mind is that if you have different processor architectures then you cannot have the same native code, for example x86 and ARM. However, again I think Windows Mobile 6 only supports ARM processors, so I'm not sure that would be a problem either. I think you could use either one.

Categories : Misc

Which, if any, recent Windows updates should I uninstall to revivify Silverlight or rectify other problems?
I have had similar problems in the past with updates to Windows and / or VS breaking the Silverlight SDK. Usually, reinstalling the Silverlight SDK will resolve this. Sometimes I have had to reinstall Silverlight and the SDK. This answer on SO has a similar issue regarding that new exception you are seeing. The answer revolves around correcting user permissions.

Categories : Asp Net

Delay windows 8 app countdown timer c#
So presumably you want to update the display every second, to get this countdown? But if I've understood, for some reason you want to delay everything by 3 seconds. If you want things to happen 3 seconds later than they're currently happening, the obvious solution is to program the timer so it calls you when you actually want it to: private DispatcherTimer t = new DispatcherTimer(); private int Counter = 120; public MainPage() { InitializeComponent(); t.Interval = TimeSpan.FromSeconds(4); t.Tick += timer_Tick; t.Start(); } private void timer_Tick(object sender, object o) { t.Interval = TimeSpan.FromSeconds(1); Time.Text = string.Format("{0}:{1}", (Counter / 60), (Counter % 60).ToString().PadLeft(2, ' ')); Counter--; } That makes the first tick take 4 seco

Categories : C#

how to set the timer interval for one day in a windows service
So, couple of things regarding your post: First, it does not state what is the problem! Technically, Timer supports a timer interval of about 25 days. So, your code should work. If you want to exceed 25 days and you are not concerned about thread safety, I suggest you go to System.Threading.Timer. More info here Since, your service runs as a windows based service, i suggest you go to System.Threading.Timer.

Categories : C#

Timer Control in C# windows Form
you make a new timer every keypress, you need to check aTimer before assigning a new timer to it. if(aTimer == null) { aTimer = new System.Timers.Timer(); atimer.Interval = 5000; atimer.AutoReset = false; }

Categories : C#

C# - Windows Service, thread, timer - not run
It is because the timer interval is set to 1 minute. See the below code in PrepareTask myTimer.Interval = 60000; You can set it to any appropriate value. or if you want your code to return once at the start and then after every 60 seconds than you should call it once in OnStart method. Like protected override void OnStart(string[] args) { // Do other initialization stuff... EvalutateChangeConditions (); // Create the thread and tell it what is to be executed. myWorkingThread = new System.Threading.Thread(PrepareTask); // Start the thread. myWorkingThread.Start(); }

Categories : C#

System.Windows.Forms.Timer not firing
The winforms timer is a control and must be used by placing it on a form. You never add it to a control-collection, so I would not expect it to work properly. The documentation says the following Implements a timer that raises an event at user-defined intervals. This timer is optimized for use in Windows Forms applications and must be used in a window. Therefore, I would suggest that you use an instance of the System.Timers.Timer class. This class can be used anywhere. Note that the Tick-event you use above, is called by another name in the System.Timer.Timer class, namely the Elapsed-event.

Categories : C#

Windows Forms App Timer Memory Leak?
No, there is no memory leak, that is the expected behavior of a program in a langauge that uses a garbage collector. The memory will increase until eventually it hits a point where the Garbage Collector cleans up any unneeded objects. Unless you are working with COM objects, Graphics, Bitmaps, Fonts, basically any unmanaged resources that may need disposing, then its not leaking. Have you got a plan B if your app crashes? You might want to consider using the server's in built functions to do this. You can figure out when an application terminates by configuring audit process tracking in Windows. The following links might get you started: Audit process tracking How can I track what programs come and go on my machine? The process tracking will create entries in the Windows even

Categories : C#

Windows Phone: How to keep timer running after exiting an application?
Have a WCF or Web API service embedded within a windows service (windows service timer example), With this WCF / Web API service you can control the behaviour without restarting the service.

Categories : C#

C# Windows Service memory leak timer and ping
You should dispose Ping public bool IsAlive(string server) { bool result = false; try { using (Ping pingSender = new Ping()) { PingOptions options = new PingOptions(); options.DontFragment = true; string data = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; byte[] buffer = Encoding.ASCII.GetBytes(data); int timeout = 120; PingReply reply = pingSender.Send(server, timeout, buffer, options); if (reply.Status == IPStatus.Success) result = true; } } catch { result = false; } return result; }

Categories : C#

Conditional compilation for different versions of Windows
I think what you want is explained here on MSDN. Basically, you #define WINVER to indicate the target operating system. This is the relevant part of that page: Setting WINVER or _WIN32_WINNT You can define these symbols by using the #define statement in each source file, or by specifying the /D compiler option supported by Visual C++. For example, to set WINVER in your source file, use the following statement: #define WINVER 0x0502 To set _WIN32_WINNT in your source file, use the following statement: #define _WIN32_WINNT 0x0502 To set _WIN32_WINNT using the /D compiler option, use the following command: cl -c /D_WIN32_WINNT=0x0502 source.cpp For information on using the /D compiler option, see /D (preprocessor definitions).

Categories : Visual C++

Conditional Windows administrator prompt
You can relaunch your program using ShellExecuteEx with "runas" verb whenever you get E_ACCESSDENIED. Something like this wchar_t szPath[MAX_PATH]; if (GetModuleFileName(NULL, szPath, ARRAYSIZE(szPath))) {`enter code here` // Launch itself as administrator. SHELLEXECUTEINFO sei = { sizeof(sei) }; sei.lpVerb = L"runas"; sei.lpFile = szPath; sei.lpParameters=L"admin"; sei.nShow = SW_NORMAL; if (!ShellExecuteEx(&sei)) { DWORD dwError = GetLastError(); if (dwError == ERROR_CANCELLED) { ExitProcess(0); } } else { ExitProcess(0);

Categories : C++

Creating Pause Button for Windows Phone Stopwatch timer
There are few ways to implement it. The first one is the using of the Stopwatch class to measure time. public partial class MainPage : PhoneApplicationPage { Stopwatch sw = new Stopwatch(); DispatcherTimer newTimer = new DispatcherTimer(); public MainPage() { InitializeComponent(); newTimer.Interval = TimeSpan.FromMilliseconds(1000 / 30); newTimer.Tick += OnTimerTick; } void OnTimerTick(object sender, EventArgs args) { UpdateUI(); } private void Button_Stop(object sender, RoutedEventArgs e) { Stop(); } private void Button_Pause(object sender, RoutedEventArgs e) { Pause(); } private void Button_Start(object sender, RoutedEventArgs e) { Start(); } void Upd

Categories : C#

Replace Thread.Sleep() with System.Windows.Forms.Timer()
You are putting the UI thread to sleep directly. If you want to do what you are asking about, you need to put your while loop into it's own thread and put THAT thread to sleep instead of the UI thread. Either that, or put your entire WindMouse method off into it's own background thread.

Categories : C#

System.Timers.Timer hangs the Windows Forms application in c#
register_Timer.SynchronizingObject = this; This completely defeats the reason for using System.Timers.Timer. It prevents the Elapsed event handler from being raised on a threadpool thread, the property ensures it will run on the UI thread. Which is what you wanted. But you still get all the disadvantages of that Timer class. Particularly its habit for swallowing exceptions without a diagnostic is very ugly. As well as continuing to raise the Elapsed event after the form is closed, ensuring this cannot happen is a very difficult problem to solve, there are two inherent race conditions. .NET 1.0 had some design mistakes related to threading, this was one of them. Just don't do this, use a System.Windows.Forms.Timer instead. It will work exactly like your timer, minus all the d

Categories : C#

Windows 8 - XAML - Conditional background for row in ListView
You can use converter to do conditional formatting of DataTemplate. You need to bind IsAvailable property to background of StackPanel, converter will give appropriate color. Add a class with this definition. using Windows.UI.Xaml.Data; using Windows.UI.Xaml.Media; using Windows.UI; public class AvailabilityToColorConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, string language) { var Availability = (bool)value; var color = Availability ? new SolidColorBrush(Colors.Green) : new SolidColorBrush(Colors.Red); return color; } public object ConvertBack(object value, Type targetType, object parameter, string language) { throw new NotImplementedException(); } } XAML local is the XAML

Categories : Windows

Make a windows forms application that updates data in a SQL Server Express db table work on client machiens
Need to install the same version of SQL Express(Example: 2012) you used for development in client machines. By default sql express will be installed as named instance with name ".sqlexpress" so your connection string need to point to the server as ".sqlexpress" or "(local)sqlexpress". You can change the named instance during installation if needed. Also users can add themself as SQL admin to sql express during installation so if they do that then your application should work fine. This link shows step by step installation of sql express 2012

Categories : Dotnet

How some services start without restart where as some require restart
You shouldn't be directly manipulating the registry to create a service. You should be using the service control manager API's to create and if desired start the service. The registry values are documented but they are still private to the API and only take effect upon reboot. Using the API will take affect immediately and the registry changes are done by the API. If you are using Windows Installer you can let the installer handle all of this for you by using the Windows Installer's ServiceInstall and ServiceControl tables. Some services have dependencies on resources that aren't available until after a reboot. One example might be a locked file that will be overwritten during startup via the Pending Files Rename Operations pattern. Another gotcha is if the service has a dependen

Categories : Sql Server

Why the "Pause" button is not working in this Stopwatch timer? --Windows Phone App Developement
If you're targetting Windows Phone, you're probably using Silverlight rather than .NET 4.5, and that would explain why your Stopwatch class does not have a Restart method. In Silverlight, Stopwatch.Start() will start or resume measuring elapsed time for an interval. The logic in your Start, Stop, Pause and Resume methods looks ok(*), but you only have event handlers for Button_Start, Button_Stop and Button_Pause. There is no Button_Resume. Do you have a resume button? If not, where do you expect your Resume method to be called? Maybe you have hooked up a resume button to the Button_Start handler, which will reset your stopwatch? If you have no Resume button, and you want the Start button to act resume after pausing and restart after stopping, then just change your Start button's click

Categories : C#

Installscript : How to close explorer windows without restart of explorer.exe process?
I'm sure you could call FindWindow and use SendMessage to close the explorer windows but the explorer.exe process will still be running and you'll still have a file lock. Windows Installer can delete locked files on reboot. If you don't want the reboot, you'll have to kill and restart explorer. I know of no other patterns here. FindWindow Example WM_SYSCOMMAND message

Categories : Windows

System.Timers.Timer Elapsed event executing after timer.Stop() is called
This is well known behavior. System.Timers.Timer internally uses ThreadPool for execution. Runtime will queue the Timer in threadpool. It would have already queued before you have called Stop method. It will fire at the elapsed time. To avoid this happening set Timer.AutoReset to false and start the timer back in the elapsed handler if you need one. Setting AutoReset false makes timer to fire only once, so in order to get timer fired on interval manually start timer again. yourTimer.AutoReset = false; private void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { try { // add your logic here } finally { yourTimer.Enabled = true;// or yourTimer.Start(); } }

Categories : C#

creating a jquery timer: timer won't continue counting after manual edit
This is not very obvious but the issue is with the use of timeSec.attr("value", timeSecNum + 1) instead of using timeSec.val(timeSecNum + 1) See this question for a good explanation (assigning attributes vs. properties)

Categories : Jquery

Is Timer accurate enough to not send TimerEvent.TIMER event after delay?
No, it is not exact. Time slicing is a surprisingly complex process. Here's a few resources: http://www.bit-101.com/blog/?p=910 http://www.craftymind.com/tag/elastic-racetrack/ What it all comes down to in a nut shell, is that the AVM tries to juggle between executing system code, user code and frame rendering as fast as possible, but needs to decide on what process gets which priority (and subsequent processing time) and it's these decisions that will influence timer accuracy. I.e sometimes accurate, sometimes not. Basically, the more you throw at it, the less accurate it gets.

Categories : Actionscript

Timer kills task/job if it runs longer than timer interval
t.Interval = intervalMiliseconds; That's indeed the troublemaker. It is pretty unintuitive behavior, one that the MSDN article for Timer.Interval specifically warns about in a Note: If Enabled and AutoReset are both set to false, and the timer has previously been enabled, setting the Interval property causes the Elapsed event to be raised once, as if the Enabled property had been set to true. To set the interval without raising the event, you can temporarily set the AutoReset property to true. It's a fairly silly hack but does work. Just delaying assigning the value is certainly the better way to do it. Doing it early doesn't buy you anything, other than trouble, the timer isn't going tick anyway since you've got AutoReset = false. System.Threading.Timer is the better time

Categories : C#

passing timer through dependency injection and configuring / starting a timer
If your question is, that you want to dependency inject a timer that you can later bind an event to, it should be simple. Just create your Timer class to follow an ITimer interface and create methods on it to do the actions you want. public class Calendar { public Calendar(ITimer timer) { // timer is the dependency injected timer timer.SetEvent(EventReminder, 3600); } public void EventReminder() { Console.Write("Hey, it's time for your appointment!"); } } public interface ITimer { void SetEvent(Action callbackMethod, int interval); } In this case, you have a calendar application, and you want your application to have a timer. But you don't care how the timer works, or even what kind of timer (maybe you want a timer that works on mi

Categories : C#

Use 'javax.swing.Timer' and 'java.util.Timer' in the same project?
Yes, you can but if you are using both in the same java file, you will need to access one of the class by the full package name like java.util.Timer because it will get a conflict if you import both of the classes.

Categories : Java

How do I tell that timer in " timer.stop(); " inside onBackPressed() is the same local variable I used before?
Thread.stop() is deprecated and you should not use that. A better Splashscreen implementation would be using Handler-Runnable something like the below. private Handler handler = new Handler(); private Runnable runnable = new Runnable() { public void run(){ Intent openHome = new Intent(Splash.this, main.class); startActivity(openHome); finish(); } } public void onCreate(Bundle b) { super.onCreate(b); handler.postDelayed(runnable, 4400); } public void onBackPressed(){ handler.removeCallbacks(runnable); super.onBackPressed(); }

Categories : Javascript

I dont understand how to make a timer like apple's countdown timer
You need to keep track of what time was on the timer when you hit back and save it somehow. You can save it through NSUserDefaults which would be the easiest, but since you could have multiple timers it might be cleaner to do a simple CoreData app. The logic (if I understand your problem correctly): 1. User pushes to DetailView and timer starts 2. User wants to pop back 2.1 Save the date the timer started to the task record 3. User wants to go back to same task 3.1 Load the NSDate of when the timer started from disk 3.2 Calculate the offset from then until now 3.3 Add that to the clock 3.4 Start the timer with the offset added Hope that helps.

Categories : Iphone



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.