Daily Archives

Articles indexed Friday July 6 2012

Page 8/16 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • Setting parameters after obtaining their values in stored procedures

    - by user1260028
    Right now I have an upload field while uploads files to the server. The prefix is saved so that it can later be obtained for retrieval. For this I need to attach the ID of the form to the prefix. I would like to be able to do this as such: @filePrefix = SCOPE_IDENTITY() + @filePrefix; However I am not so sure this would work because the record has not been created yet. If anything I could call an update function which obtains the ID and then injects it into the row after it has been created. To speed things up, I don't want to do this on the server but rather do this on the database. Regardless of what the approach is, I would still like to know if something like the above is possible (at least for future reference?) So if we replace that with @filePrefix = 5 + @filePrefix; would that be possible? SQL doesn't seem to like the current syntax very much...

    Read the article

  • MySql - only update some rows if the table exists - do not want an error thrown

    - by Pete Oakey
    I want to run an update query. The query will be run against multiple databases - not every database will have the table. I don't want the update to be attempted if the table does not exist. I don't want any error to be thrown - I just want the update to be ignored. Any ideas? EDIT: just to be clear - the query is executed in an automated deployment - no human interaction possible. EDIT2: the logic to say whether the update should run or not will need to be in the MySql query itself. This is not being run through a command prompt or batch or managed code.

    Read the article

  • Character encoding issues?

    - by Santosh
    We had a a clob column in DB. Now when we extract this clob and try to display it (plain text not html), it prints junk some characters on html screen. The character when directly streamed to a file looks like ” (not the usual double quote on regular keyboard) One more observation: System.out.println("”".getBytes()[0]); prints -108. Why a character byte should be in negative range ? Is there any way to display it correctly on a html screen ?

    Read the article

  • Get index of nth occurrence of char in a string

    - by StickFigs
    I'm trying to make a function that returns the index of the Nth occurrence of a given char in a string. Here is my attempt: private int IndexOfNth(string str, char c, int n) { int index = str.IndexOf(c) + 1; if (index >= 0) { string temp = str.Substring(index, str.Length - index); for (int j = 1; j < n; j++) { index = temp.IndexOf(c) + 1; if (index < 0) { return -1; } temp = temp.Substring(index, temp.Length - index); } index = index + (str.Length); } return index; } This should find the first occurrence, chop off that front part of the string, find the first occurrence from the new substring, and on and on until it gets the index of the nth occurrence. However I failed to consider how the index of the final substring is going to be offset from the original actual index in the original string. How do I make this work? Also as a side question, if I want the char to be the tab character do I pass this function '\t' or what?

    Read the article

  • Quartz Thread Execution Parallel or Sequential?

    - by vikas
    We have a quartz based scheduler application which runs about 1000 jobs per minute which are evenly distributed across seconds of each minute i.e. about 16-17 jobs per second. Ideally, these 16-17 jobs should fire at same time, however our first statement, which simply logs the time of execution, of execute method of the job is being called very late. e.g. let us assume we have 1000 jobs scheduled per minute from 05:00 to 05:04. So, ideally the job which is scheduled at 05:03:50 should have logged the first statement of the execute method at 05:03:50, however, it is doing it at about 05:06:38. I have tracked down the time taken by the scheduled job which comes around 15-20 milliseconds. This scheduled job is fast enough because we just send a message on an ActiveMQ queue. We have specified the number of threads of quartz to be 100 and even tried with increasing it to 200 and more, but no gain. One more thing we noticed is that logs from scheduler are coming sequential after first 1 minute i.e. [Quartz_Worker_28] <Some log statement> .. .. [Quartz_Worker_29] <Some log statement> .. .. [Quartz_Worker_30] <Some log statement> .. .. So it suggesting that after some time quartz is running threads almost sequential. May be this is happening due to the time taken in notifying the job completion to persistence store (which is a separate postgres database in this case) and/or context switching. What can be the reason behind this strange behavior? EDIT: More detailed Log [06/07/12 10:08:37:192][QuartzScheduler_Worker-34][INFO] org.quartz.plugins.history.LoggingTriggerHistoryPlugin - Trigger [<trigger_name>] fired job [<job_name>] scheduled at: 06-07-2012 10:08:33.458, next scheduled at: 06-07-2012 10:34:53.000 [06/07/12 10:08:37:192][QuartzScheduler_Worker-34][INFO] <my_package>.scheduler.quartz.ScheduledLocateJob - execute begin--------- ScheduledLocateJob with key: <job_name> started at Fri Jul 06 10:08:37 EDT 2012 [06/07/12 10:08:37:192][QuartzScheduler_Worker-34][INFO] <my_package>.scheduler.quartz.ScheduledLocateJob <some log statement> [06/07/12 10:08:37:192][QuartzScheduler_Worker-34][INFO] <my_package>.scheduler.quartz.ScheduledLocateJob <some log statement> [06/07/12 10:08:37:192][QuartzScheduler_Worker-34][INFO] <my_package>.scheduler.quartz.ScheduledLocateJob <some log statement> [06/07/12 10:08:37:220][QuartzScheduler_Worker-34][INFO] <my_package>.scheduler.quartz.ScheduledLocateJob - execute end--------- ScheduledLocateJob with key: <job_name> ended at Fri Jul 06 10:08:37 EDT 2012 [06/07/12 10:08:37:220][QuartzScheduler_Worker-34][INFO] org.quartz.plugins.history.LoggingTriggerHistoryPlugin - Trigger [<trigger_name>] completed firing job [<job_name>] with resulting trigger instruction code: DO NOTHING. Next scheduled at: 06-07-2012 10:34:53.000 I am doubting on this section of the above log scheduled at: 06-07-2012 10:08:33.458, next scheduled at: 06-07-2012 10:34:53.000 because this job was scheduled for 10:04:53, but it fired at 10:08:33 and still quartz didn't consider it as misfire. Shouldn't it be a misfire?

    Read the article

  • gtk draw "expose-event" and redraw

    - by warem
    I want to use expose-event to draw something then update or redraw. That's to say, there are a drawing area and a button in window. When clicking button, the drawing area will be redrawn accordingly. My problems are Following code worked but it only had a drawing area no button. If I add the button(cancel the comment for button), nothing is drawn. What's the reason? In the following code, if I changed gtk_container_add (GTK_CONTAINER (box), canvas); to gtk_box_pack_start(GTK_BOX(box), canvas, FALSE, FALSE, 0);, nothing is drawn. Usually we use gtk_box_pack_start to add something into box. Why doesn't it work this time? The function build_ACC_axis refreshed drawing area and prepared for new draw. I google it but I didn't know if it worked. Could you please comment on it? If the source file is test.c, then compilation is gcc -o test test.c `pkg-config --cflags --libs gtk+-2.0` The code is below: #include <gtk/gtk.h> #include <glib.h> static void draw (GdkDrawable *d, GdkGC *gc) { /* Draw with GDK */ gdk_draw_line (d, gc, 0, 0, 50, 50); gdk_draw_line (d, gc, 50, 50, 50, 150); gdk_draw_line (d, gc, 50, 150, 0, 200); gdk_draw_line (d, gc, 200, 0, 150, 50); gdk_draw_line (d, gc, 150, 50, 150, 150); gdk_draw_line (d, gc, 150, 150, 200, 200); gdk_draw_line (d, gc, 50, 50, 150, 50); gdk_draw_line (d, gc, 50, 150, 150, 150); } static gboolean expose_cb (GtkWidget *canvas, GdkEventExpose *event, gpointer user_data) { GdkGC *gc; gc = gdk_gc_new (canvas->window); draw (canvas->window, gc); g_object_unref (gc); return FALSE; } void build_ACC_axis (GtkWidget *button, GtkWidget *widget) { GdkRegion *region; GtkWidget *canvas = g_object_get_data(G_OBJECT(widget), "plat_GA_canvas"); region = gdk_drawable_get_visible_region(canvas->window); gdk_window_invalidate_region(canvas->window, region, TRUE); gtk_widget_queue_draw(canvas); /* gdk_window_process_updates(canvas->window, TRUE); */ gdk_region_destroy (region); } int main (int argc, char **argv) { GtkWidget *window; GtkWidget *canvas, *box, *button; gtk_init (&argc, &argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (gtk_main_quit), NULL); box = gtk_vbox_new(FALSE, 0); gtk_container_add (GTK_CONTAINER (window), box); canvas = gtk_drawing_area_new (); g_object_set_data(G_OBJECT(window), "plat_GA_canvas", canvas); /* gtk_box_pack_start(GTK_BOX(box), canvas, FALSE, FALSE, 0); */ gtk_container_add (GTK_CONTAINER (box), canvas); g_signal_connect (G_OBJECT (canvas), "expose-event", G_CALLBACK (expose_cb), NULL); /* button = gtk_button_new_with_label ("ok"); gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 0); |+ gtk_container_add (GTK_CONTAINER (box), button); +| gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(build_ACC_axis), window); */ gtk_widget_show_all (window); gtk_main (); }

    Read the article

  • iOS App with OCMaps crashes when using the phone in chinese Language

    - by Pedro Morte Rolo
    I've been given the task of doing maintenance to a iOS application that uses OCMapView. I have just realized that when using the application in chinese language, it blows up when the selector doClustering is invoked on a OCMapView instance. This is for me a very puzzling behaviour, because I thought that regardless of the environment language, the OCMapView class should allways have the same methods. Am I wrong? Do you have any recomentations about how to find a solution to this problem? Thank you, Pedro

    Read the article

  • Running compiled squid [proxy] on windows

    - by user683595
    I have downloaded latest version of squid and tried to compile squid on windows according to http://www.piececode.com/other/compile-squid-2-7-on-windows/ , I changed c:\squid to c:\squid2, because had a precompiled version in there. When I run c:\squid2\squid.exe , squid.exe -v , squid.exe -i , squid.exe -X , as I tested these parameters, it will be exited quickly without printing anything at all. Why? I found where the system doesn't return 0 and quits, it's in function WIN32_Subsystem_Init . Thanks!

    Read the article

  • not output exception stack trace in EUnit

    - by hpyhacking
    I'm write a test with EUnit, but not anything exception detail output in console. exp_test() -> ?assertEqual(0, 1/0). Run this module:exp_test() in the Erlang Shell output following ** exception error: bad argument in an arithmetic expression in function exp_test:'-exp_test/0-fun-0-'/1 (src/test/eunit/xxx_test.erl, line 8) But in EUnit output following > eunit:test(xxx). > xxx_test: exp_test...*failed* ::badarith EUnit not output anything exception trace info Im trying the verbose config in eunit, but no effect. I want to output some exception detail in eunit test result. Thanks~

    Read the article

  • NHibernate (3.1.0.4000) NullReferenceException using Query<> and NHibernate Facility

    - by TigerShark
    I have a problem with NHibernate, I can't seem to find any solution for. In my project I have a simple entity (Batch), but whenever I try and run the following test, I get an exception. I've triede a couple of different ways to perform a similar query, but almost identical exception for all (it differs in which LINQ method being executed). The first test: [Test] public void QueryLatestBatch() { using (var session = SessionManager.OpenSession()) { var batch = session.Query<Batch>() .FirstOrDefault(); Assert.That(batch, Is.Not.Null); } } The exception: System.NullReferenceException : Object reference not set to an instance of an object. at NHibernate.Linq.NhQueryProvider.PrepareQuery(Expression expression, ref IQuery query, ref NhLinqExpression nhQuery) at NHibernate.Linq.NhQueryProvider.Execute(Expression expression) at System.Linq.Queryable.FirstOrDefault(IQueryable`1 source) The second test: [Test] public void QueryLatestBatch2() { using (var session = SessionManager.OpenSession()) { var batch = session.Query<Batch>() .OrderBy(x => x.Executed) .Take(1) .SingleOrDefault(); Assert.That(batch, Is.Not.Null); } } The exception: System.NullReferenceException : Object reference not set to an instance of an object. at NHibernate.Linq.NhQueryProvider.PrepareQuery(Expression expression, ref IQuery query, ref NhLinqExpression nhQuery) at NHibernate.Linq.NhQueryProvider.Execute(Expression expression) at System.Linq.Queryable.SingleOrDefault(IQueryable`1 source) However, this one is passing (using QueryOver<): [Test] public void QueryOverLatestBatch() { using (var session = SessionManager.OpenSession()) { var batch = session.QueryOver<Batch>() .OrderBy(x => x.Executed).Asc .Take(1) .SingleOrDefault(); Assert.That(batch, Is.Not.Null); Assert.That(batch.Executed, Is.LessThan(DateTime.Now)); } } Using the QueryOver< API is not bad at all, but I'm just kind of baffled that the Query< API isn't working, which is kind of sad, since the First() operation is very concise, and our developers really enjoy LINQ. I really hope there is a solution to this, as it seems strange if these methods are failing such a simple test. EDIT I'm using Oracle 11g, my mappings are done with FluentNHibernate registered through Castle Windsor with the NHibernate Facility. As I wrote, the odd thing is that the query works perfectly with the QueryOver< API, but not through LINQ.

    Read the article

  • NAnt IF task doesn't seem to work

    - by goombaloon
    I'm trying the example from the NAnt documentation for the if task at: http://nant.sourceforge.net/release/0.85/help/tasks/if.html Specifically the following code... <if test="${build.configuration='release'}"> <echo>Build release configuration</echo> </if> where build.configuration has been defined beforehand as <property name="build.configuration" value="debug" overwrite="false" /> When I run it using nant.exe (version 0.91.3881.0), I get the following error: '}' expected Expression: ${build.configuration='release'} ^ I'm guessing I'm missing something simple?

    Read the article

  • Using Fluent NHibernate with Castle Windsor and the NHibernate Facility

    - by Andrew
    Ive managed to get Fluent NHibernate 1.1 playing nicely with Castle Windsor 2.1. This involved me recompiling NHibernate.ByteCode.Castle.dll and it all works fine. Ive managed to do the same thing this time with Castle Windsor 2.5, havent tried it yet but its not complaining which is good enough for me at the moment. However Im also using the Castle NHibernate Facility and that is another story. The version of the NHibernate Facility that is compatible with Castle 2.5 requires a much later version of NHibernate. Is there an easy way to get the NHibernate Facility to work with NHibernate 2.1 and Castle Core 2.5?

    Read the article

  • Java: "implements Runnable" vs. "extends Thread"

    - by user65374
    From what time I've spent with threads in Java, I've found these two ways to write threads. public class ThreadA implements Runnable { public void run() { //Code } } //with a "new Thread(threadA).start()" call public class ThreadB extends Thread { public ThreadB() { super("ThreadB"); } public void run() { //Code } } //with a "threadB.start()" call Is there any significant difference in these two blocks of code?

    Read the article

  • Sonicwall NAT Policy Loopback

    - by John
    I have an issue and am pretty perplexed over it. I have a sonicwall and its setup with NAT polices and reflexive nat for an internal web server. That is, only 2 policies, no loopback policy, and the internal clients can access the web server by public ip no problems. Now, on another connection, another sonicwall, i have the exact same setup for another web server, with exact same policies (obviously different IP's) and the internal clients can't access the internal website by its public IP without creating the loopback policy. Maybe on the first one I've overlooked it, but I don't see any loopback what so ever and its working fine. My question is, does anyone know why the first one works like this but the second one needs the loopback policy? Thanks

    Read the article

  • Office 2010 & Windows 7 - 'File' is currently in use. Try again later

    - by thing2k
    The issue: when saving a document from either Word, Excel or PowerPoint 2010, every so often it will show the message 'file' is currently in use. Try again later. We started our rollout of Windows 7 beginning of this year, and this issue was infrequent, but is now affecting enough people to be a problem. Usually, if you clear the alert, then save again, it works fine, though only in Word or Excel. Annoyingly, PowerPoint has a bad habit of changing the file to read-only after the error. So the only choice is to save to a new file name. The issue seems to only happen to files in the user's My Documents, which is a redirection folder from their HomeShare. The HomeShares are spread across 3 different file servers, 2 Windows 2003 and 1 Windows 2008 R2. Has anyone seen this issue and know how to fix it?

    Read the article

  • Windows VPN not authenticating from ADSL to Wireless link

    - by deanvz
    I have a normal windows VPN on a computer connecting to a 196.201.x.x/24 IP. If this VPN tries to connect from any address in the 41.x.x.x range it cant get there. The server is a normal windows 2008 server, running exchange with a PPPoE IP natted to a public IP on the public gateway of the wireless network as the server is on site and its connectivity is derived from Mikrotik RB's. The computer on the 41 range can traceroute and ping the server, but the VPN does not authenticate. When on the network or any other, the VPN works fine. Is there something that could be configured on the VPN client? All firewall settings of a standard ADSL router have been checked and found to block only ICMP's. Is this a VPN configuration problem or a network issue?

    Read the article

  • SSH equivalent of .profile/.bashrc

    - by Ramon
    I am looking for a way to automatically define some aliases inside my session on any server I ssh to. I can't put them in the .bashrc files on the server because the user accounts I log in with are shared by other people and besides there are dozens of them and maintaining a script on every machine would be painful. I know I could use expect to type the aliases automatically but I was just wondering if OpenSSH has anything built-in that could conceivably be used to achieve this?

    Read the article

  • mongod fork vs nohup

    - by Daniel Kitachewsky
    I'm currently writing process management software. One package we use is mongo. Is there any difference between launching mongo with mongod --fork --logpath=/my/path/mongo.log and nohup mongod >> /my/path/mongo.log 2>&1 < /dev/null & ? My first thought was that --fork could spawn more processes and/or threads, and I was suggested that --fork could be useful for changing the effective user (downgrading privileges). But we run all under the same user (process manager and mongod), so is there any other difference? Thank you

    Read the article

  • debian hang on startup "starting the winbind daemon: winbind"

    - by Bajingan Keparat
    I took a copy of a VM running a debian, just so that I can play around with it. I spin up the copy, but didn't give it any network connection to avoid conflict with the original one. However, when I turn the VM on, it seems to freeze after this startup message Starting Sambe daemons:nmbd smbd Starting PostgreSQL 8.4 database server: main Starting the Winbind daemon: winbind how do i fix this? I never get to the prompt to login. This vm does have a mount point that connects to a windows share folder.

    Read the article

  • Rails with phusion passenger and wordpress

    - by Venu
    We had a site developed using on ruby on rails. It had Website Web services for mobile app Admin panel to manage data. We started using wordpress to manage site content. We have finished development, have to move to production now. This is the current virtual host code for wordpress to work under /wordpress URI. <Location /wordpress> PassengerEnabled off <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /wordpress/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /wordpress/index.php [L] </IfModule> </Location> I want to make phusion passenger work for the /admin and /api URIs. And / to go to wordpress. Can we change the document root based on the URI? or any other better solution?

    Read the article

  • Best practice for scaling a single application source to multiple nodes

    - by Andrew Waters
    I have an application which needs to scale horizontally to cover web and service nodes (at the moment they're all on one) but interact with the same set of databases and source files (both application code and custom assets). Database is no problem, it's handled already with replication in MongoDB. Also, the configuration of the servers are the same (100% linux). This question is literally about sharing a filesystem between machines so that its content is always correct, regardless of the node accessing it. My two thoughts have so far been NFS and SAN - SAN being prohibitively expensive and NFS seeing some performance issues on the second node with regards to glob()ing in PHP. Does anyone have recommended strategies or other techniques that don't involved sharding data across nodes or any potential gotchas in NFS that may cause slow disk seek times? To give you an idea of the scale, the main node initialises it's application modules in ~ 0.01 seconds. The secondary is taking ~2.2 seconds. They're VM's inside a local virtual network in ESXi and ping time between them is ~0.3ms

    Read the article

  • tmux won't run as non root user?

    - by bumbling fool
    If I run tmux as root, it runs normally and fully functional. I created a couple users, and it will not run as any of the users. create session failed: : No such file or directory I checked the outside $TERM is xterm and inside $TERM is screen as FAQs suggest that is most common cause of problems. I've used tmux regularly on many different systems, but I on this VPS I can't figure out what's up... A little help, please? EDIT: strace output

    Read the article

  • hosts.allow and hosts.deny WHM Host Access Control - what if my IP changes?

    - by beingalex
    I want to use WHM/Cpanel's Host Access Control interface to change some settings in hosts.allow and hosts.deny. I want to block all access to our SSH exept from the IP we have from our office. Daemon Access List Action Comment sshd ALL EXCEPT x.x.x.x deny Deny access from all other IPs apart from ours But I am worried about what happens if our IP changes, which it does about twice a week. How would I get back in to edit the hosts.allow / hosts.deny files?

    Read the article

  • Why it's not possible to compile on a different OS than end-user OS [closed]

    - by sameold
    I was trying to compile a php extension on Windows and ran into some trouble. I then thought it was possible to do the compilation for Windows on Linux, but turned out that wasn't possible. Can someone explain to me why compiling has to be done on the same OS? I'm trying to understand this topic, specifically because if I want to distribute something, does that mean I have to compile it on all these OSs (Windows 7, Windows Vista, Windows XP, Linux, Mac, etc. etc. etc.) So what makes it not possible to compile for one OS on another? Is it the kernel or what?

    Read the article

  • How browsers handle multiple IPs

    - by Sandman4
    Can someone direct me to information on exact browsers behavior when browser gets multiple A records for a given hostname (say ip1 and ip2), and one of them is not accessible. I interested in EXACT details, like (but not limited to): Will browser get 2 IPs from OS, or it will get only one ? Which ip will browser try first (random or always the first one) ? Now, let's say browser started with the failed ip1 For how long will browser try ip1 ? If user hits "stop" while it waits for ip1, and then clicks refresh which IP will browser try ? What will happen when it times-out - will it start trying ip2 or give error ? (And if error, which ip will browser try when user clicks refresh). When user clicks refresh, will any browser attempt new DNS lookup ? Now let's assume browser tried working ip2 first. For the next page request, will browser still use ip2, or it may randomly switch ips ? For how long browsers keep IPs in their cache ? When browsers sends a new DNS request, and get SAME ips, will it CONTINUE to use the same known-to-be-working IP, or the process starts from scratch and it may try any of the two ? Of course it all may be browser dependent, and may also vary between versions and platforms, I'd be happy to have maximum of details. The purpose of this - I'm trying to understand what exactly users will experience when round-robin DNS based used and one of the hosts fails. Please, I'm NOT asking about how bad DNS load balancing is, and please refrain from answering "don't do it", "it's a bad idea", "you need heartbeat/proxy/BGP/whatever" and so on.

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >