Search Results

Search found 19688 results on 788 pages for 'con current'.

Page 13/788 | < Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >

  • get the current time in C

    - by Antrromet
    I want to get the current time of my system. For that i'm using the following code in C. time_t now; struct tm *mytime = localtime(&now); if ( strftime(buffer, sizeof buffer, "%X", mytime) ) { printf("time1 = \"%s\"\n", buffer); } But the problem of this code is that its giving some random time.Also the random time is different all the time.I want the current time of my system. Can anyone please tell me how to solve this issue?

    Read the article

  • Can the current date be inserted into output through XSLT v1.0

    - by Randy
    I have an incoming data stream that is being converted with XSLT v1.0 that incoming data does not contain any date information. what i would like, is a nice way of getting the current date to become part of the resulting output stream. I am aware of the 2.0 current-date() type functions - unfortunately those are not available to this environment... any thoughts/hacks/alternatives? tia

    Read the article

  • Add 'Current' property to ASP.NET control

    - by Alex
    Hi! I have some control. I add one instance of this control to every Page in OnInit event and I want to access this control in other places in this way: Sample.Current public class Sample : Control { public static Sample Current { get { // ??? } } } Can you tell me what is the best way to do this property implementation?

    Read the article

  • Codeigniter Current Logged in user

    - by KierenT
    In Codeigniter, I have a login/registration form all set up, working perfectly, however how can I output the current users username, i.e. When the user has logged in it would say "Welcome, [username]". I also need to know this, to be able to output from the database the record based on the current users ID, how can I do that? I've browsed the docs on codeigniter but couldn't find what i was looking for. I'm using active record btw. Thanks

    Read the article

  • Center current record in DataGridView

    - by Max
    When programmatically changing the current record in the DataGridView is it possible to make it in such way that this record would be centered (vertically) in the grid? When I change the current record it is shown either as the top row or as the bottom row. I'd like it to be in the middle. Would this be possible/simpler in WPF?

    Read the article

  • How to define a current user?

    - by ie
    Is it possible to define a current user? I found a stored procedure 'sp_mgGetConnectedUsers'. It returns a result set with the only unique field 'Address'. How could I associate an executing query with such 'Address'. Please advice. Note: As far as I understand, another way to get the current user is to set a unique application Id for each connection, but I don't like this way much.

    Read the article

  • Get current URL in Python

    - by Alex
    How would i get the current URL with Python, I need to grab the current URL so i can check it for query strings e.g requested_url = "URL_HERE" url = urlparse(requested_url) if url[4]: params = dict([part.split('=') for part in url[4].split('&')]) also this is running in Google App Engine

    Read the article

  • wpf datagrid current item binding

    - by tk
    I want to bind a content of Label to the selected item of a datagrid. I thought the 'current item' binding expression would work, but it is not. My xaml code and code-behind c# is like below. <Window x:Class="WpfApplication2.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="512" Width="847"> <DockPanel LastChildFill="True"> <Label Content="{Binding Data/colA}" DockPanel.Dock="Top" Height="30"/> <DataGrid ItemsSource="{Binding Data}"></DataGrid> </DockPanel> </Window> namespace WpfApplication2 { public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); this.DataContext = new MyData(); } } public class MyData { DataTable data; public MyData() { data = new DataTable(); data.Columns.Add("colA"); data.Columns.Add("colB"); data.Rows.Add("aa", 1); data.Rows.Add("bb", 2); } public DataTable Data { get { return data; } } } } The label shows the first item of the DataTable, and does not change when i select other items on the datagrid. It seems the current item of dataview does not change. What should i do to bind it to the current selected item of datagrid?

    Read the article

  • [NSLocale currentLocale] always returns "en_US" not user's current language

    - by Prairiedogg
    I'm in the processes of internationalizing an iPhone app - I need to make programmatic changes to certain views based on what the user's current locale is. I'm going nuts because no matter what the language preference on the iPhone simulator or actual hardware are, locale always evaluates to "en_US": NSString *locale = [[NSLocale currentLocale] localeIdentifier]; NSLog(@"current locale: %@", locale); The crazy thing is that the rest of the application behaves as expected. The correct strings are selected from the Localization.strings file and used in the interface, and the correct .xib files for the selected locale are used. I have also tried the following, to no avail and with the same result: NSString *locale = [[NSLocale autoupdatingCurrentLocale] localeIdentifier]; NSLog(@"current locale: %@", locale); Is there something simple I'm missing? A preference or an import perhaps? Update: As Darren's answer suggests, the preference I'm looking for is not in NSLocale, rather it is here: NSUserDefaults* defs = [NSUserDefaults standardUserDefaults]; NSArray* languages = [defs objectForKey:@"AppleLanguages"]; NSString* preferredLang = [languages objectAtIndex:0]; NSLog(@"preferredLang: %@", preferredLang);

    Read the article

  • Getting the current EnvDTE or IServiceProvider when NOT coding an Addin

    - by Vaccano
    I am coding up some design time code. I want to use this snippet: (Found here) var dte = (EnvDTE.DTE) GetService(typeof(EnvDTE.DTE)); if (dte != null) { var solution = dte.Solution; if (solution != null) { string baseDir = Path.GetDirectoryName(solution.FullName); } } Problem is that this does not compile. (GetService is not a known method call) I tried adding Microsoft.VisualStudio.Shell (and Microsoft.VisualStudio.Shell.10.0) but it did not help. In looking around on the internet I found that you need a IServiceProvider to call this. But all the examples that show how to get an IServiceProvider use a EnvDTE. So, to get the current EnvDTE I need IServiceProvider. But to get an IServiceProvider I need an EnvDTE. (There is a hole in my bucket...) So, here is my question: In a normal WPF Application, how can I get the current instance of EnvDTE? NOTE: I am not looking for any old instance of EnvDTE. I need the one for my current Visual Studio instance (I run 3-4 instances of Visual Studio at a time.)

    Read the article

  • WCF MessageHeaders in OperationContext.Current

    - by Nate Bross
    If I use code like this [just below] to add Message Headers to my OperationContext, will all future out-going messages contain that data on any new ClientProxy defined from the same "run" of my application? The objective, is to pass a parameter or two to each OpeartionContract w/out messing with the signature of the OperationContract, since the parameters being passed will be consistant for all requests for a given run of my client application. public void DoSomeStuff() { var proxy = new MyServiceClient(); Guid myToken = Guid.NewGuid(); MessageHeader<Guid> mhg = new MessageHeader<Guid>(myToken); MessageHeader untyped = mhg.GetUntypedHeader("token", "ns"); OperationContext.Current.OutgoingMessageHeaders.Add(untyped); proxy.DoOperation(...); } public void DoSomeOTHERStuff() { var proxy = new MyServiceClient(); Guid myToken = Guid.NewGuid(); MessageHeader<Guid> mhg = new MessageHeader<Guid>(myToken); MessageHeader untyped = mhg.GetUntypedHeader("token", "ns"); OperationContext.Current.OutgoingMessageHeaders.Add(untyped); proxy.DoOtherOperation(...); } In other words, is it safe to refactor the above code like this? bool isSetup = false; public void SetupMessageHeader() { if(isSetup) { return; } Guid myToken = Guid.NewGuid(); MessageHeader<Guid> mhg = new MessageHeader<Guid>(myToken); MessageHeader untyped = mhg.GetUntypedHeader("token", "ns"); OperationContext.Current.OutgoingMessageHeaders.Add(untyped); isSetup = true; } public void DoSomeStuff() { var proxy = new MyServiceClient(); SetupMessageHeader(); proxy.DoOperation(...); } public void DoSomeOTHERStuff() { var proxy = new MyServiceClient(); SetupMessageHeader(); proxy.DoOtherOperation(...); } Since I don't really understand what's happening there, I don't want to cargo cult it and just change it and let it fly if it works, I'd like to hear your thoughts on if it is OK or not.

    Read the article

  • asp mvc unit test HttpContext.Current.Cache?

    - by Paul Creasey
    Here is the first part of my controller code: public class ControlMController : Controller { IControlMService _controlMservice; public IList<User> Users { get { if (System.Web.HttpContext.Current.Cache["users"] == null) { System.Web.HttpContext.Current.Cache["users"] = _controlMservice.GetUsers(); } return (IList<User>)System.Web.HttpContext.Current.Cache["users"]; } } public ControlMController(IControlMService controlMservice) { this._controlMservice = controlMservice; var users = Users; ViewData["Users"] = users; ViewData["jqSelectUsers"] = string.Join(";", users.Select(x => x.UserID + ":" + x.Name).ToArray()); } I'm trying to test it, and because i'm caching using the HttpContext, i'm struggling with null reference exceptions. I've tried using MvcContrib.TestHelper; here is my sample test... [TestMethod] public void EventDetails_Returns_view_with_correct_event() { var builder = new TestControllerBuilder(); var controller = builder.CreateController<ControlMController>( new ControlMService( new MockControlMRepository() )); var view = (controller.EventDetails(1) as ViewResult); Assert.AreEqual(1, (view.ViewData.Model as Event).EventId); } (I haven't quite got round to using DI for my tests! I'm still getting the same null reference exception when the code hits the httpcontext: Error 1 TestCase 'SupportTool.Tests.Services.ControlM.ControlMControllerTests.EventDetails_Returns_view_with_correct_event' failed: System.NullReferenceException: Object reference not set to an instance of an object. at SupportTool.web.Controllers.ControlMController.get_Users() Any ideas?

    Read the article

  • Obtaining Current Fiscal Year from Hierarchy with MDX

    - by Robert Iver
    I'm building a report in Reporting Services 2005 based on a SSAS 2005 cube. The basic idea of the report is that they want to see sales for this fiscal year to date vs. last year sales year to date. It sounds simple, but being that this is my first "real" report based on SSAS, I'm having a hell of a time. First, how would one calculate the current fiscal year, quarter, or month. I have a Fiscal Date Hierarchy with all that information in it, but I can't figure out how to say: "Based on today's date, find the current fiscal year, quarter, and month." My second, but slightly smaller problem, is getting last years sales vs. this years sales. I have seen MANY examples on how to do this, but they all assume that you select the date manually. Since this is a report and will run pretty much on it's own, I need a way to insert the "current" fiscal year, quarter, and month into the PERIODSTODATE or PARALLELPERIOD functions to get what I want. So, I'm begging for your help on this one. I have to have this report done by tomorrow monring and I'm beginning to freak out a bit. Thanks in advance.

    Read the article

  • Determine if the current thread has low I/O priority

    - by Magnus Hoff
    I have a background thread that does some I/O-intensive background type work. To please the other threads and processes running, I set the thread priority to "background mode" using SetThreadPriority, like this: SetThreadPriority(GetCurrentThread(), THREAD_MODE_BACKGROUND_BEGIN); However, THREAD_MODE_BACKGROUND_BEGIN is only available in Windows Server 2008 or newer, as well as Windows Vista and newer, but the program needs to work well on Windows Server 2003 and XP as well. So the real code is more like this: if (!SetThreadPriority(GetCurrentThread(), THREAD_MODE_BACKGROUND_BEGIN)) { SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_LOWEST); } The problem with this is that on Windows XP it will totally disrupt the system by using too much I/O. I have a plan for a ugly and shameful way of mitigating this problem, but that depends on me being able to determine if the current thread has low I/O priority or not. Now, I know I can store which thread priority I ended up setting, but the control flow in the program is not really well suited for this. I would rather like to be able to test later whether or not the current thread has low I/O priority -- if it is in "background mode". GetThreadPriority does not seem to give me this information. Is there any way to determine if the current thread has low I/O priority?

    Read the article

  • How to calculate the current index?

    - by niko
    Hi, I have written an algorithm which iteratively solves the problem. The first iteration consists of 6 steps and all the following iterations consist of 5 steps (first step is skipped). What I want to calculate is the current (local) step in the iteration from current global step. For example if there are 41 steps in total which means there are 8 iterations: indices from 1 to 6 belong to 1st iteration indices from 7 to 11 belong to second iteration ... For calculating the current iteration I have written the following code: if(currentStep <= 6) iteration = 1; else iteration = floor((currentStep - 7)/5) + 2; end The problem remains in calculating local steps. in first iteration the performed steps are: 1, 2, 3, 4, 5, 6 in all the following iterations the performing steps are 2, 3, 4, 5, 6 So what has to be done is to transform the array of global steps [1 2 3 4 5 6 7 8 9 10 11 12 13 ... 41] into array of local steps [1 2 3 4 5 6 2 3 4 5 6 2 3 ... 6]. I would appreciate if anyone could help in finding the solution to a given problem. Thank you!

    Read the article

  • error CS0177: The out parameter 'Wx' must be assigned to before control leaves the current method

    - by sonny5
    using System; using System.Drawing; using System.Drawing.Drawing2D; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; public class Form1 : System.Windows.Forms.Form { public static float WXmin; public static float WYmin; public static float WXmax; public static float WYmax; public static int VXmin; public static int VYmin; public static int VXmax; public static int VYmax; public static float Vx; public static float Vy; public Form1() { InitializeComponent(); } private void InitializeComponent() { //this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(400, 300); this.Text="Pass Args"; this.Paint += new System.Windows.Forms.PaintEventHandler(this.doLine); } static void Main() { Application.Run(new Form1()); } private void doLine(object sender, System.Windows.Forms.PaintEventArgs e) { Graphics g = e.Graphics; g.FillRectangle(Brushes.White, this.ClientRectangle); Pen p = new Pen(Color.Black); g.DrawLine(p, 0, 0, 100, 100); p.Dispose(); } private void eachCornerPix (object sender, PaintEventArgs e, out float Wx, out float Wy, out float Vx, out float Vy) { Graphics g = this.CreateGraphics(); Pen penBlu = new Pen(Color.Blue, 2); SolidBrush redBrush = new SolidBrush(Color.Red); int width = 2; // 1 pixel wide in x int height = 2; float [] Wxc = {0.100f, 5.900f, 5.900f, 0.100f}; float [] Wyc = {0.100f, 0.100f, 3.900f, 3.900f}; for (int i = 0; i<3; i++) { Wx = Wxc[i]; Wy = Wyc[i]; Vx = ((Wx - WXmin)*((VXmax-VXmin)+VXmin)/(WXmax-WXmin)); Vy = ((Wy - WYmin)*(VYmax-VYmin)/(WYmax-WYmin)+VYmin); Console.WriteLine("eachCornerPix Vx= {0}", Vx); Console.WriteLine("eachCornerPix Vy= {0}", Vy); g.FillRectangle(redBrush, Vx, Vy, width, height); g.Dispose(); } // Desired effect: Use the array values (Wxc, Wyc) and re-assign them to Wx and Wy. Then use // Wx and Wy as components to calculate Vx and Vy. // My end goal...once compile issues are resolved, is to pass each array value listed // using this method. This should allow 4 xy point pairs to be plotted. // Errors: // pass1.cs(51,18): error CS0177: The out parameter 'Wx' must be assigned to before // control leaves the current method // pass1.cs(51,18): error CS0177: The out parameter 'Wy' must be assigned to before // control leaves the current method // pass1.cs(51,18): error CS0177: The out parameter 'Vx' must be assigned to before // control leaves the current method // pass1.cs(51,18): error CS0177: The out parameter 'Vy' must be assigned to before // control leaves the current method } }

    Read the article

  • Current Motherboard Tech Overview

    - by Ian
    Welp, computer died. Time to get a new motherboard. I haven't been paying attention to the latest motherboard technology and associated models and chipsets. Can someone point me at an overview of what is currently available? I'm primarily interested in the Intel / nvidia side of things.

    Read the article

  • My current iptable configuration doesn't work [on hold]

    - by Brad
    sudo chkconfig iptables off /etc/init.d/iptables on ### Clear/flush iptables sudo iptables -F sudo iptables -P INPUT ACCEPT sudo iptables -P OUTPUT ACCEPT sudo iptables -P FORWARD ACCEPT ### Allow SSH iptables -A INPUT -i eth0 -p tcp --dport 22 -m state --state NEW,ESTABLISHED -j ACCEPT iptables -A OUTPUT -o eth0 -p tcp --sport 22 -m state --state ESTABLISHED -j ACCEPT ### Allow YUM updates sudo iptables -A OUTPUT -o eth0 -p tcp --dport 80 --match owner --uid-owner 0 --state NEW,ESTABLISHED -j ACCEPT sudo iptables -A OUTPUT -o eth0 -p tcp --dport 443 --match owner --uid-owner 0 --state NEW,ESTABLISHED -j ACCEPT ### Add your rules form the link above, here # ftp,smtp,imap,http,https,pop3,imaps,pop3s sudo iptables -A INPUT -i eth0 -p tcp -m multiport --dports 21,25,143,80,443,110,993,995 -m state --state NEW,ESTABLISHED -j ACCEPT sudo iptables -A OUTPUT -o eth0 -p tcp -m multiport --sports 21,25,143,80,110,443,993,995 -m state --state NEW,ESTABLISHED -j ACCEPT ## allow dns sudo iptables -A OUTPUT -p udp -o eth0 --dport 53 -j ACCEPT && sudo iptables -A INPUT -p udp -i eth0 --sport 53 -j ACCEPT # handling pings sudo iptables -A INPUT -p icmp --icmp-type echo-request -j ACCEPT && sudo iptables -A OUTPUT -p icmp --icmp-type echo-reply -j ACCEPT sudo iptables -A OUTPUT -p icmp --icmp-type echo-request -j ACCEPT && sudo iptables -A INPUT -p icmp --icmp-type echo-reply -j ACCEPT # manage ddos attacks sudo iptables -A INPUT -p tcp --dport 80 -m limit --limit 25/minute --limit-burst 100 -j ACCEPT ## Implement some logging so that we know what's getting dropped sudo iptables -N LOGGING sudo iptables -A INPUT -j LOGGING sudo iptables -A LOGGING -m limit --limit 2/min -j LOG --log-prefix "IPTables Packet Dropped: " --log-level 7 sudo iptables -A LOGGING -j DROP # once a rule affects traffic then it is no longer managed # so if the traffic has not been accepted, block it sudo iptables -A INPUT -j DROP sudo iptables -I INPUT 1 -i lo -j ACCEPT sudo iptables -A OUTPUT -j DROP # allow only internal port forwarding sudo iptables -A FORWARD -i eth0 -o eth1 -j ACCEPT sudo iptables -P FORWARD DROP # create an iptables config file sudo iptables-save > /root/dsl.fw ### Append the following to the rc.local file sudo nano /etc/rc.local ####--- /sbin/iptables-restore < sudo /root/dsl.fw ####--- /etc/init.d/iptables save ## check to see if this setting is working great. sudo service iptables restart ## log out/in testing sudo chkconfig iptables on What is the problem with this setup? If I restart the server it doesn't allow me back in SSH, and there may be a problem with Yum Original source of information: https://gist.github.com/Jonathonbyrd/1274837#file-instructions

    Read the article

  • Get a user's current IP address from Skype

    - by Jonathan.
    This is assuming that you (/police/ISP) can get the [rough] location of a laptop based on IP address. If your laptop is stolen, and the thief unwittingly connects it to the Internet, and you have Skype on the laptop could you get the public IP address of the laptop and then go to the police and get it tracked? Or activate the webcam to see the surroundings, but without having Skype ring/notify the user?

    Read the article

< Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >