Daily Archives

Articles indexed Wednesday May 26 2010

Page 24/118 | < Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >

  • How to calculate change in ANSI SQL

    - by morpheous
    I have a table that contains sales data. The data is stored in a table that looks like this: CREATE table sales_data ( sales_time timestamp , sales_amt double ) I need to write parameterized queries that will allow me to do the following: Return the change in sales_amt between times t2 and t1, where t2 and t1 are separated by a time interval (integer) of N. This query will allow for querying for weekly changes in sales (for example). Return the change in change of sales_amt between times t2 and t1, and time t3 and t4. Thats is to calculate the value (val(t2)-val(t1)) - (val(t4)-val(t3)). where t2 and t1 are separated by the same time interval (interval N) as the interval between t4 and t3. This query will allow for querying for changes in weekly changes in sales (for example).

    Read the article

  • Perl classes like stuff

    - by user350571
    Hello, lovers of the camel. I'm new to perl and it's blessing stuff to imitate class like functionality made me feel strange I even had to go to the bathroom. Now, please tell me: what do you don't like, find wrong or strange with this code: sub Person { my $age = shift || 15; return { printAge => sub { print "Age -> $age\n"; }, changeAge => sub { $age = shift } } } my $p = Person(); my $p2 = Person(27); $p->{printAge}->(); $p->{changeAge}->(30); $p->{printAge}->(); $p2->{printAge}->(); I'm going to walk my dog, hope to get responses when I'm back. Thanks in advance. Cheers. Be back soon. Thanks again.

    Read the article

  • Heterogeneous queries require the ANSI_NULLS

    - by Dezigo
    I wrote a trigger. USE [TEST] GO /****** Object: Trigger [dbo].[TR_POSTGRESQL_UPDATE_YC] Script Date: 05/26/2010 08:54:03 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER TRIGGER [dbo].[TR_POSTGRESQL_UPDATE_YC] ON [dbo].[BCT_CNTR_EVENTS] FOR INSERT AS BEGIN DECLARE @MOVE_TIME varchar(14); DECLARE @MOVE_TIME_FORMATED varchar(20); DECLARE @RELEASE_NOTE varchar(32); DECLARE @CMR_NUMBER varchar(15); DECLARE @MOVE_TYPE varchar(2); SELECT @MOVE_TIME = inserted.move_time ,@MOVE_TYPE = inserted.move_type ,@RELEASE_NOTE = inserted.release_note ,@CMR_NUMBER = inserted.cmr_number FROM inserted IF(@MOVE_TYPE = 'YC') BEGIN SET @MOVE_TIME_FORMATED = SUBSTRING(@MOVE_TIME,1,4) + '-' + SUBSTRING(@MOVE_TIME,5,2) + '-' + SUBSTRING(@MOVE_TIME,7,2) + ' 00:00:00' --UPDATE OpenQuery(POSTGRESQL_SERV,'SELECT visit_cmr,visit_timestamp,visit_pin FROM VISIT') -- SET visit_cmr = @RELEASE_NOTE -- WHERE visit_timestamp = @MOVE_TIME_FORMATED -- AND visit_pin = right(@CMR_NUMBER,5) -- AND visit_cmr IS NULL END SET NOCOUNT ON; END When I have inserted a row,I have get an error **Heterogeneous queries require the ANSI_NULLS and ANSI_WARNINGS options to be set for the connection. This ensures consistent query semantics. Enable these options and then reissue your query.** Then I ofcourse SET SET ANSI_WARNINGS is ON but it`s not work for me. (trigger fo linked server postgresql) I have restarted a server. not work again.

    Read the article

  • Control Sysinternals Suite & NirSoft Utilities with a Single Interface

    - by Asian Angel
    Sysinternals and NirSoft both provide helpful utilities for your Windows system but may not be very convenient to access. Using the Windows System Control Center you can easily access everything through a single UI front end. Setup The first thing to do is set up three new folders in Program Files (or Program Files (x86) if you are using a 64bit system) with the following names (the first two need to exactly match what is shown here): Sysinternals Suite NirSoft Utilities (create this folder only if you have any of these apps downloaded) Windows System Control Center (or WSCC depending on your preferences) Unzip the contents of the Sysinternals Suite into its’ folder. Then unzip any individual NirSoft Utilities programs that you have downloaded into the NirSoft folder. All that is left to do is to unzip the WSCC software into its’ folder and create a shortcut. WSCC in Action When you start WSCC up for the first time you will see the following message with a brief explanation about the software. Next the options window will appear providing you an opportunity to look around and make any desired changes. WSCC can access utilities for both suites using a live connection if needed (utilities accessed live are not downloaded). Note: This occurs on the first run only. This is the main WSCC window…you can choose the utility that you want to use by sorting through an all items list or based on category. Note: WSCC may occasionally experience a problem downloading a particular utility if using the live service. We conducted a quick test by accessing two Sysinternals apps. First PsInfo… Followed by DiskView. Both opened quickly and were ready to go. There were no NirSoft Utilities installed on our test system in order to provide a live access example. Within moments WSCC accessed the CurrProcess utility and had it running on our system. Our recommendation is to download your favorite utilities from both suites (in order to always have easy access to them). Conclusion WSCC provides an easy way to access all of the apps in the Sysinternals Suite and NirSoft Utilities in one place. Note: A PortableApps version is also available. Links Download Windows System Control Center (WSCC) Download Windows Sysinternals Suite Download individual NirSoft Utilities programs Similar Articles Productive Geek Tips How To Get Detailed Information About Your PCAccess and Launch Windows Utilities the Easy WayWhat is svchost.exe And Why Is It Running?How to Clean Up Your Messy Windows Context MenuRemove NVIDIA Control Panel from Desktop Right-Click Menu TouchFreeze Alternative in AutoHotkey The Icy Undertow Desktop Windows Home Server – Backup to LAN The Clear & Clean Desktop Use This Bookmarklet to Easily Get Albums Use AutoHotkey to Assign a Hotkey to a Specific Window Latest Software Reviews Tinyhacker Random Tips CloudBerry Online Backup 1.5 for Windows Home Server Snagit 10 VMware Workstation 7 Acronis Online Backup Ultimate Boot CD can help when disaster strikes Windows Firewall with Advanced Security – How To Guides Sculptris 1.0, 3D Drawing app AceStock, a Tiny Desktop Quote Monitor Gmail Button Addon (Firefox) Hyperwords addon (Firefox)

    Read the article

  • StructureMap Exception Code: 202 No Default Instance defined for PluginFamily

    - by Code Sherpa
    Hi. I am new to StructureMap. I have downloaded and am using version 2.6.1.0. I keep getting the below error: StructureMap Exception Code: 202 No Default Instance defined for PluginFamily Company.ProjectCore.Core.IConfiguration, Company.ProjectCore, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null My Global.asax.cs looks like: protected void Application_Start(object sender, EventArgs e) { var container = new Container(x => { x.For<ICache>().Use<Cache>(); x.For<IEmailService>().Use<EmailService>(); x.For<IUserSession>().Use<UserSession>(); x.For<IRedirector>().Use<Redirector>(); x.For<INavigation>().Use<Navigation>(); }); container.AssertConfigurationIsValid(); } I changed from ObjectFactory.Initialize to "new Container" to debug. When stepping through the AssertConfigurationIsValid() method, Cache works but EmailService fails at the GetInstance method in the following line: private readonly IConfiguration _configuration; public EmailService() { _configuration = ObjectFactory.GetInstance<IConfiguration>(); } If I remove IEmailService, the same 202 error is thrown at IUserSession. Should I be adding something else in Application_Start or in my class files? Thanks in advance...

    Read the article

  • DFS function, can you guys tell me what is the wrong with this code?

    - by danielDhobbs
    can you guys tell me what is the wrong with this code? it is not working with 1 2 1 3 1 4 2 5 2 6 2 7 2 8 3 8 3 9 4 10 1 - 4 - 10 and stop DFS function void Is_Connected(graphType* g, int v){ //function to define the graph is connected or not int i=0; g_node* w; top = NULL; g -> visited[v] = TRUE; push(v); printf("%d", v); while (top != NULL) { w = g -> adjList[v]; while (w) { if (!g -> visited[w -> vertex]) { push(w -> vertex); g -> visited[w -> vertex] = TRUE; printf("->%d", w->vertex); v = w -> vertex; w = g -> adjList[v]; } else { w = w -> link; } } i++; v = pop(); } if (i == (g -> x)-1){ //number of vertices = number of vertetices pass through puts("\nIs_Connected() result : yes"); } else{ puts("\nIs_Connected() result : no"); } }

    Read the article

  • @dynamic property needs setter with multiple behaviors

    - by ambertch
    I have a class that contains multiple user objects and as such has an array of them as an instance variable: NSMutableArray *users; The tricky part is setting it. I am deserializing these objects from a server via Objective Resource, and for backend reasons users can only be returned as a long string of UIDs - what I have locally is a separate dictionary of users keyed to UIDs. Given the string uidString of comma separated UIDs I override the default setter and populate the actual user objects: @dynamic users; - (void)setUsers:(id)uidString { users = [NSMutableArray arrayWithArray: [[User allUsersDictionary] objectsForKeys:[(NSString*)uidString componentsSeparatedByString:@","]]]; } The problem is this: I now serialize these to database using SQLitePO, which stores these as the array of user objects, not the original string. So when I retrieve it from database the setter mistakenly treats this array of user objects as a string! Where I actually want to adjust the setter's behavior when it gets this object from DB vs. over the network. I can't just make the getter serialize back into a string without tearing up large code that reference this array of user objects, and I tried to detect in the setter whether I have a string or an array coming in: if ([uidString respondsToSelector:@selector(addObject)]) { // Already an array, so don't do anything - just assign users = uidString but no success... so I'm kind of stuck - any suggestions? Thanks in advance!

    Read the article

  • How can I get Syslogging to work on the JVM?

    - by Synesso
    I want to do syslogging from Java. There is a log4j appender, but it doesn't seem to work (for me anyway ... though Google results show many others with this issue still unresolved). I'm trying to debug the appender, so I've written the following script based upon RFC3164 It runs, but no logging appears in the syslog. // scala import java.io._ import java.net._ val ds = new DatagramSocket() val fullMsg = "<11>May 26 14:47:22 Hello World" val packet = new DatagramPacket(fullMsg.getBytes("UTF-8"), fullMsg.length, InetAddress.getLocalHost, 514) ds send packet ds.close I also tried using /bin/nc, but it doesn't work either. echo "<14>May 26 15:23:83 Hello world" > nc -u localhost 514 The Ubuntu command /usr/bin/logger does work, however. logger -p user.info hello world # logs: May 26 15:25:10 dsupport2 jem: hello world What could I be doing wrong?

    Read the article

  • I want just the insert query for a temp table.

    - by John Stephen
    Hi..I am using C#.Net and Sql Server ( Windows Application ). I had created a temporary table. When a button is clicked, temporary table (#tmp_emp_details) is created. I am having another button called "insert Values" and also 5 textboxes. The values that are entered in the textbox are used and whenever com.ExecuteNonQuery(); line comes, it throws an error message Invalid object name '#tbl_emp_answer'.. Below is the set of code.. Please give me a solution. Code for insert (in insert value button): private void btninsertvalues_Click(object sender, EventArgs e) { username = txtusername.Text; examloginid = txtexamloginid.Text; question = txtquestion.Text; answer = txtanswer.Text; useranswer = txtanswer.Text; SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=tempdb;Integrated Security=True;"); SqlCommand com = new SqlCommand("Insert into #tbl_emp_answer values('"+username+"','"+examloginid+"','"+question+"','"+answer+"','"+useranswer+"')", con); con.Open(); com.ExecuteNonQuery(); con.Close(); }

    Read the article

  • C# sqlite query results to list<string>

    - by jakesankey
    Guys, I'm struggling. I have query against my db that returns a single column of data and I need to set it as List. Here is what I am working with and I am getting an error about converting void to string. public static void GetImportedFileList() { using (SQLiteConnection connect = new SQLiteConnection(@"Data Source=C:\Documents and Settings\js91162\Desktop\CMMData.db3")) { connect.Open(); using (SQLiteCommand fmd = connect.CreateCommand()) { SQLiteCommand sqlComm = new SQLiteCommand(@"SELECT DISTINCT FileName FROM Import"); SQLiteDataReader r = sqlComm.ExecuteReader(); while (r.Read()) { string FileNames = (string)r["FileName"]; List<string> ImportedFiles = new List<string>(); } connect.Close(); } } } THEN LATER IN THE APPLICATION List<string> ImportedFiles = GetImportedFileList() // Method that gets the list of files from the db foreach (string file in files.Where(fl => !ImportedFiles.Contains(fl)))

    Read the article

  • Reorder inputs before submiting form

    - by Jason
    Is there any way to reorder or manipulate a set of inputs before posting to a script for processing? I'm able to reorder the elements in the DOM no problem, but getting this to happen after the user presses the submit button and before the browser makes the POST is a bit tricky. I'm using the ajaxForm plugin in jQuery. There is a beforeSubmit callback, but this doesn't seem to allow me to reorded the inputs.

    Read the article

  • Ruby: wait for system command to end

    - by Ignace
    Hey all, I'm converting an xls 2 csv with a system(command) in ruby. After the conversion i'm processing this csv files. But the conversion is still going when the program wants to process the files. So at that time they are non existant. Can someone tell me if it's possible to let Ruby wait the right amount of time for the system command to finish? Right now i'm using sleep 20 but if it will take longer once, it isn't right of course... Thanks!

    Read the article

  • Question about implement air widget manager

    - by L.J.W
    Hi all, I have a question about invoking air in air,please give me some advice. I want to use air technology in enterprise business,and I think widget manager(engine) like google desktop,vista sidebar is a good system entrypoint.so I look for a widget manager basing AIR,the widget manager can load air widget, and auto upgrade widget silently ,and have a cool user-interface like google desktop or vista sidebar or yahoo's. Any product existed and recommend?and if I need to implement myself,any idea or advice?How can I embed the widget interface into the manager(engine) interface seamless,how can I invoke the specified window(maybe not the init window) in the widget air application from the manager? Thanks and best regards

    Read the article

  • How to sleep computer via batch file? (Windows 7)

    - by Saebin
    So I want to make a batch file that will sleep my computer after a period of time. The closest thing I have found is placing it in standby, but seems to work differently then the sleep button on my keyboard (longer bootup, doesn't wake on mouse click). Any ideas? Would it be easier in python or c#? The less then ideal technique mentioned above is calling this in the cmd prompt: Rundll32.exe powrprof.dll,SetSuspendState

    Read the article

< Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >