Search Results

Search found 1372 results on 55 pages for 'userid'.

Page 29/55 | < Previous Page | 25 26 27 28 29 30 31 32 33 34 35 36  | Next Page >

  • Why MySQL sat for 2 minutes doing nothing?

    - by Alex R
    This was a one-time thing, not reproducible... But I saved the show innodb status output. Can anybody tell what's going on here? The simple insert took almost 3 minutes to complete. | InnoDB | | ===================================== 110201 15:58:10 INNODB MONITOR OUTPUT ===================================== Per second averages calculated from the last 34 seconds ---------- SEMAPHORES ---------- OS WAIT ARRAY INFO: reservation count 11963, signal count 11766 --Thread 1824 has waited at .\btr\btr0cur.c line 443 for 118.00 seconds the sema phore: S-lock on RW-latch at 09D6453C created in file .\buf\buf0buf.c line 550 a writer (thread id 1824) has reserved it in mode wait exclusive number of readers 1, waiters flag 1 Last time read locked in file .\buf\buf0flu.c line 599 Last time write locked in file .\btr\btr0cur.c line 443 Mutex spin waits 0, rounds 527817, OS waits 7133 RW-shared spins 2532, OS waits 1226; RW-excl spins 1652, OS waits 1118 ------------ TRANSACTIONS ------------ Trx id counter 0 95830 Purge done for trx's n:o < 0 95814 undo n:o < 0 0 History list length 11 LIST OF TRANSACTIONS FOR EACH SESSION: ---TRANSACTION 0 0, not started, OS thread id 3704 MySQL thread id 551, query id 2702112 localhost 127.0.0.1 root show innodb status ---TRANSACTION 0 95829, not started, OS thread id 3132 MySQL thread id 534, query id 2702020 localhost 127.0.0.1 root ---TRANSACTION 0 95828, not started, OS thread id 3152 MySQL thread id 527, query id 2701973 localhost 127.0.0.1 root ---TRANSACTION 0 95827, ACTIVE 118 sec, OS thread id 1824 inserting, thread decl ared inside InnoDB 500 mysql tables in use 1, locked 1 1 lock struct(s), heap size 320, 0 row lock(s) MySQL thread id 526, query id 2701972 localhost 127.0.0.1 root update INSERT INTO log_searchcriteria (userid,search_criteria,date,search_type) VALUES ( NAME_CONST('userid',NULL), NAME_CONST('search_criteria',_latin1' SELECT SQL_C ALC_FOUND_ROWS idx_search.CTCX_LATITUDE, idx_search.CTCX_LONGITUDE, idx_search.b uilding_id, idx_search.LN_LIST_NUMBER, idx_search.LP_LIST_PRICE, idx_search.HSN_ ADRESS_HOUSE_NUMBER, idx_search.STR_ADDRESS_STREET, idx_search.CP_ADDRESS_COMPAS S_POINT, idx_search.UN_UNIT, idx_search.CIT_CITY, idx_search.ZP_ZIP_CODE, idx_se arch.AR_AREA_NAME, idx_search.BR_BEDROOMS, idx_search.BTH_BATHS, idx_search.ST_S TATUS, idx_search.CTCX_STYLE_TYPE, idx_s -------- FILE I/O -------- I/O thread 0 state: wait Windows aio (insert buffer thread) I/O thread 1 state: wait Windows aio (log thread) I/O thread 2 state: wait Windows aio (read thread) I/O thread 3 state: wait Windows aio (write thread) Pending normal aio reads: 0, aio writes: 1, ibuf aio reads: 0, log i/o's: 0, sync i/o's: 0 Pending flushes (fsync) log: 0; buffer pool: 0 151006 OS file reads, 120758 OS file writes, 6844 OS fsyncs 0.00 reads/s, 0 avg bytes/read, 0.00 writes/s, 0.00 fsyncs/s ------------------------------------- INSERT BUFFER AND ADAPTIVE HASH INDEX ------------------------------------- Ibuf: size 1, free list len 5, seg size 7, 24664 inserts, 24664 merged recs, 4612 merges Hash table size 553253, node heap has 629 buffer(s) 0.00 hash searches/s, 0.00 non-hash searches/s --- LOG --- Log sequence number 5 2318193115 Log flushed up to 5 2318193115 Last checkpoint at 5 2318129891 0 pending log writes, 0 pending chkp writes 3036 log i/o's done, 0.00 log i/o's/second ---------------------- BUFFER POOL AND MEMORY ---------------------- Total memory allocated 213459462; in additional pool allocated 1720192 Dictionary memory allocated 240416 Buffer pool size 8192 Free buffers 0 Database pages 7563 Modified db pages 18 Pending reads 0 Pending writes: LRU 0, flush list 18, single page 0 Pages read 150973, created 28788, written 115137 0.00 reads/s, 0.00 creates/s, 0.00 writes/s No buffer pool page gets since the last printout -------------- ROW OPERATIONS -------------- 1 queries inside InnoDB, 0 queries in queue 1 read views open inside InnoDB Main thread id 2992, state: flushing buffer pool pages Number of rows inserted 794294, updated 89203, deleted 13698, read 1453084305 0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.00 reads/s ---------------------------- END OF INNODB MONITOR OUTPUT ============================ Thanks

    Read the article

  • nginx 502 bad gateway - fastcgi not listening? (Debian 5)

    - by Sean
    I have experience with nginx but it's always been pre-installed for me (via VPS.net pre-configured image). I really like what it does for me, and now I'm trying to install it on my own server with apt-get. This is a fairly fresh Debian 5 install. I have few extra packages installed but they're all .deb's, no manual compiling or anything crazy going on. Apache is already installed but I disabled it. I did apt-get install nginx and that worked fine. Changed the config around a bit for my needs, although the same problem I'm about to describe happens even with the default config. It took me a while to figure out that the default debian package for nginx doesn't spawn fastcgi processes automatically. That's pretty lame, but I figured out how to do that with this script, which I found posted on many different web sites: #!/bin/bash ## ABSOLUTE path to the PHP binary PHPFCGI="/usr/bin/php5-cgi" ## tcp-port to bind on FCGIPORT="9000" ## IP to bind on FCGIADDR="127.0.0.1" ## number of PHP children to spawn PHP_FCGI_CHILDREN=10 ## number of request before php-process will be restarted PHP_FCGI_MAX_REQUESTS=1000 # allowed environment variables sperated by spaces ALLOWED_ENV="ORACLE_HOME PATH USER" ## if this script is run as root switch to the following user USERID=www-data ################## no config below this line if test x$PHP_FCGI_CHILDREN = x; then PHP_FCGI_CHILDREN=5 fi ALLOWED_ENV="$ALLOWED_ENV PHP_FCGI_CHILDREN" ALLOWED_ENV="$ALLOWED_ENV PHP_FCGI_MAX_REQUESTS" ALLOWED_ENV="$ALLOWED_ENV FCGI_WEB_SERVER_ADDRS" if test x$UID = x0; then EX="/bin/su -m -c \"$PHPFCGI -q -b $FCGIADDR:$FCGIPORT\" $USERID" else EX="$PHPFCGI -b $FCGIADDR:$FCGIPORT" fi echo $EX # copy the allowed environment variables E= for i in $ALLOWED_ENV; do E="$E $i=${!i}" done # clean environment and set up a new one nohup env - $E sh -c "$EX" &> /dev/null & When I do a "ps -A | grep php5-cgi", I see the 10 processes running, that should be ready to listen. But when I try to view a web page via nginx, I just get a 502 bad gateway error. After futzing around a bit, I tried telneting to 127.0.0.1 9000 (fastcgi is listening on port 9000, and nginx is configured to talk to that port), but it just immediately closes the connection. This makes me think the problem is with fastcgi, but I'm not sure what I can do to test it. It may just be closing the connection because it's not getting fed any data to process, but it closes immediately so that makes me think otherwise. So... any advice? I can't figure it out. It doesn't help that it's 1AM, but I'm going crazy here!

    Read the article

  • Sendmail ignoring parameters

    - by André
    We're sending ~60k emails to non-local addresses with sendmail and I manually set the -f flag to [email protected]. This all works fine and dandy when I limit my PHP script to 5000 addresses. If I remove the limitation, sendmail ingnores the parameters and sends all emails with a reply-to and return-path of [email protected]. I'm sleeping in between each email for 500ms, that should not be the problem.

    Read the article

  • Reasons for missing IP info in `last` output on pts logins?

    - by Mike Pennington
    I have five CentOS 6 linux systems at work, and encountered a rather strange issue that only seems to happen with my userid across all the linux systems I have... This is an example of the problem from entries I excepted from the last command... mpenning pts/19 Fri Nov 16 10:32 - 10:35 (00:03) mpenning pts/17 Fri Nov 16 10:21 - 10:42 (00:21) bill pts/15 sol-bill.local Fri Nov 16 10:19 - 10:36 (00:16) mpenning pts/1 192.0.2.91 Fri Nov 16 10:17 - 10:49 (12+00:31) kkim14 pts/14 192.0.2.225 Thu Nov 15 18:02 - 15:17 (4+21:15) gduarte pts/10 192.0.2.135 Thu Nov 15 12:33 - 08:10 (11+19:36) gduarte pts/9 192.0.2.135 Thu Nov 15 12:31 - 08:10 (11+19:38) kkim14 pts/0 :0.0 Thu Nov 15 12:27 - 15:17 (5+02:49) gduarte pts/6 192.0.2.135 Thu Nov 15 11:44 - 08:10 (11+20:25) kkim14 pts/13 192.0.2.225 Thu Nov 15 09:56 - 15:17 (5+05:20) kkim14 pts/12 192.0.2.225 Thu Nov 15 08:28 - 15:17 (5+06:49) kkim14 pts/11 192.0.2.225 Thu Nov 15 08:26 - 15:17 (5+06:50) dspencer pts/8 192.0.2.130 Wed Nov 14 18:24 still logged in mpenning pts/18 alpha-console-1. Mon Nov 12 14:41 - 14:46 (00:04) You can see two of my pts login entries above that do not have a source IP address associated with them. My CentOS machines have as many as six other users that share the systems, but the mpenning userid is the only one that has this issue. Approximately 5% of my logins see this issue, but no other usernames exhibit this behavior. Questions Given the kind of scripts I keep on these systems (which control much of our network infrastructure), I'm a little spooked by this and would like to understand what would cause my logins to occasionally miss source addresses. Is there anything (other than malicious activity) that would reasonably explain the behavior? Other than bash history timestamping, are there other things I can do to track the issue down? Informational Since this started happening, I enabled bash history time-stamping (i.e. HISTTIMEFORMAT="%y-%m-%d %T " in .bash_profile) and also added a few other bash history hacks; however, that does not give clues to what happened during the previous occurrences. All the systems run CentOS 6.3... [mpenning@typo ~]$ uname -a Linux typo.local 2.6.32-279.9.1.el6.x86_64 #1 SMP Tue Sep 25 21:43:11 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux [mpenning@typo ~]$ EDIT If I use last -i mpenning, I see entries like this... mpenning pts/19 0.0.0.0 Fri Nov 16 10:32 - 10:35 (00:03) mpenning pts/17 0.0.0.0 Fri Nov 16 10:21 - 10:42 (00:21)

    Read the article

  • Issues with configuration of Apache and mod_auth_sspi

    - by TekiusFanatikus
    I've been able to get this working using XAMP with Apache 2.0.55 and XAMP Apache 2.2.14 without any problems. However, when I attempt to configure our intranet server (Apache 2.0.59), I don't get the same results. The results are that the following variables contain the information desired: $_SERVER["REMOTE_USER"] AND $_SERVER["PHP_AUTH_USER"]. In this case, they are blank. I'm expecting "domain/user_name". Conf file stuff: <Directory "/xxx/xampp/htdocs/"> # # Possible values for the Options directive are "None", "All", # or any combination of: # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews # # Note that "MultiViews" must be named *explicitly* --- "Options All" # doesn't give it to you. # # The Options directive is both complicated and important. Please see # http://httpd.apache.org/docs/2.2/mod/core.html#options # for more information. # #Options Indexes FollowSymLinks Includes ExecCGI Options Indexes FollowSymLinks # # AllowOverride controls what directives may be placed in .htaccess files. # It can be "All", "None", or any combination of the keywords: # Options FileInfo AuthConfig Limit # #AllowOverride All AllowOverride None # # Controls who can get stuff from this server. # #Order allow,deny #Allow from all Order allow,deny Allow from all #NT Domain Login AuthName "Intranet" AuthType SSPI SSPIAuth On SSPIAuthoritative On SSPIDomain "xxxx" SSPIOfferBasic Off SSPIPerRequestAuth On SSPIOmitDomain Off # keep domain name in userid string SSPIUsernameCase lower Require valid-user </Directory> I would like to note that I've modified the paths to reflect the intranet environment. I'm using the following module: http://sourceforge.net/projects/mod-auth-sspi/ Once the module is installed and the conf file is modified, the intranet environment's server scope isn't populated with the expected variables. Edit #1 <Directory "/path_here"> # # Possible values for the Options directive are "None", "All", # or any combination of: # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews # # Note that "MultiViews" must be named *explicitly* --- "Options All" # doesn't give it to you. # # The Options directive is both complicated and important. Please see # http://httpd.apache.org/docs/2.2/mod/core.html#options # for more information. # #Options Indexes FollowSymLinks Includes ExecCGI Options Indexes FollowSymLinks # # AllowOverride controls what directives may be placed in .htaccess files. # It can be "All", "None", or any combination of the keywords: # Options FileInfo AuthConfig Limit # #AllowOverride All AllowOverride None # # Controls who can get stuff from this server. # #Order allow,deny #Allow from all Order allow,deny Allow from all #NT Domain Login AuthName "Intranet" AuthType SSPI SSPIAuth On SSPIAuthoritative On SSPIDomain "domain_here" SSPIOfferBasic On SSPIPerRequestAuth On SSPIOmitDomain Off # keep domain name in userid string SSPIUsernameCase lower Require valid-user </Directory>

    Read the article

  • Is it possible that an insert would use parallelism?

    - by Lieven Cardoen
    In what situation can inserting a simple record (the table has got some 10 columns, two of them are xml) use parallelism? CREATE TABLE [dbo].[PackageSessions]( [PackageSessionId] [int] IDENTITY(1,1) NOT NULL, [PackageId] [int] NOT NULL, [UserId] [int] NOT NULL, [StartDateTime] [datetime] NULL, [StopDateTime] [datetime] NULL, [Score] [float] NOT NULL, [ScoreMax] [float] NOT NULL, [CompletionStatus] [int] NOT NULL, [ReviewPlayerContextId] [int] NOT NULL, [PlayerContextId] [int] NOT NULL, [ReducedScore] [float] NOT NULL, [ReducedScoreMax] [float] NOT NULL, [PackageSnapShot] [xml] NULL, [InterfaceLanguageId] [int] NOT NULL, [Data] [xml] NULL, [PackageSessionLanguageId] [int] NOT NULL, CONSTRAINT [PackageSessions_PK] PRIMARY KEY CLUSTERED ( [PackageSessionId] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY]

    Read the article

  • Do something by operator dial specified number in Asterisk?

    - by Rev
    I want to make ability for Asterisk phone Operators to able do something like this: While operator talking to caller, if Operator dial specified number like 244 (or something like that but not Sip-Userid's), do something (like play sound for caller or etc) for that call. So, Is this possible? Is need to change dialplan? ¦¦¦¦¦ I found this. in first paragraph it's say someething like: if operator dial exten go voiceMail.

    Read the article

  • How can I transfer output that appears on the console and format it so that it appears on a web page

    - by lojayna
    package collabsoft.backlog_reports.c4; import java.sql.CallableStatement; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.Statement; //import collabsoft.backlog_reports.c4.Report; public class Report { private Connection con; public Report(){ connectUsingJDBC(); } public static void main(String args[]){ Report dc = new Report(); dc.reviewMeeting(6, 8, 10); dc.createReport("dede",100); //dc.viewReport(100); // dc.custRent(3344,123,22,11-11-2009); } /** the following method is used to connect to the database **/ public void connectUsingJDBC() { // This is the name of the ODBC data source String dataSourceName = "Simple_DB"; try { // loading the driver in the memory Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); // This is the connection URL String dbURL = "jdbc:odbc:" + dataSourceName; con = DriverManager.getConnection("jdbc:mysql://localhost:3306/Collabsoft","root",""); // This line is used to print the name of the driver and it would throw an exception if a problem occured System.out.println("User connected using driver: " + con.getMetaData().getDriverName()); //Addcustomer(con,1111,"aaa","aaa","aa","aam","111","2222","111"); //rentedMovies(con); //executePreparedStatement(con); //executeCallableStatement(con); //executeBatch(con); } catch (Exception e) { e.printStackTrace(); } } /** *this code is to link the SQL code with the java for the task *as an admin I should be able to create a report of a review meeting including notes, tasks and users *i will take the task id and user id and note id that will be needed to be added in the review *meeting report and i will display the information related to these ida **/ public void reviewMeeting(int taskID, int userID, int noteID)// law el proc bt return table { try{ CallableStatement callableStatement = con.prepareCall("{CALL report_review_meeting(?,?,?)}"); callableStatement.setInt(1,taskID); callableStatement.setInt(2,userID); callableStatement.setInt(3,noteID); ResultSet resultSet = callableStatement.executeQuery(); // or executeupdate() or updateQuery ResultSetMetaData rsm = resultSet.getMetaData(); int numOfColumns = rsm.getColumnCount(); System.out.println("lojayna"); while (resultSet.next()) { System.out.println("New Row:"); for (int i = 1; i <= numOfColumns; i++) System.out.print(rsm.getColumnName(i) + ": " + resultSet.getObject(i) + " "); System.out.println(); } } catch(Exception e) { System.out.println("E"); } } ////////////////////////////////// ///////////////////////////////// public void allproject(int projID)// law el proc bt return table { try{ CallableStatement callableStatement = con.prepareCall("{CALL all_project(?)}"); callableStatement.setInt(1,projID); //callableStatement.setInt(2,userID); //callableStatement.setInt(3,noteID); ResultSet resultSet = callableStatement.executeQuery(); // or executeupdate() or updateQuery ResultSetMetaData rsm = resultSet.getMetaData(); int numOfColumns = rsm.getColumnCount(); System.out.println("lojayna"); while (resultSet.next()) { System.out.println("New Row:"); for (int i = 1; i <= numOfColumns; i++) System.out.print(rsm.getColumnName(i) + ": " + resultSet.getObject(i) + " "); System.out.println(); } } catch(Exception e) { System.out.println("E"); } } /////////////////////////////// /** * here i take the event id and i take a string report and then * i relate the report with the event **/ public void createReport(String report,int E_ID )// law el proc bt return table { try{ Statement st = con.createStatement(); st.executeUpdate("UPDATE e_vent SET e_vent.report=report WHERE e_vent.E_ID= E_ID;"); /* CallableStatement callableStatement = con.prepareCall("{CALL Create_report(?,?)}"); callableStatement.setString(1,report); callableStatement.setInt(2,E_ID); ResultSet resultSet = callableStatement.executeQuery(); // or executeupdate() or updateQuery ResultSetMetaData rsm = resultSet.getMetaData(); int numOfColumns = rsm.getColumnCount(); System.out.println("lojayna"); while (resultSet.next()) { System.out.println("New Row:"); for (int i = 1; i <= numOfColumns; i++) System.out.print(rsm.getColumnName(i) + ": " + resultSet.getObject(i) + " "); System.out.println(); }*/ } catch(Exception e) { System.out.println("E"); System.out.println(e); } } /** *in the following method i view the report of the event having the ID eventID **/ public void viewReport(int eventID)// law el proc bt return table { try{ CallableStatement callableStatement = con.prepareCall("{CALL view_report(?)}"); callableStatement.setInt(1,eventID); ResultSet resultSet = callableStatement.executeQuery(); // or executeupdate() or updateQuery ResultSetMetaData rsm = resultSet.getMetaData(); int numOfColumns = rsm.getColumnCount(); System.out.println("lojayna"); while (resultSet.next()) { System.out.println("New Row:"); for (int i = 1; i <= numOfColumns; i++) System.out.print(rsm.getColumnName(i) + ": " + resultSet.getObject(i) + " "); System.out.println(); } } catch(Exception e) { System.out.println("E"); } } } // the result of these methods is being showed on the console , i am using WIcket and i want it 2 be showed on the web how is that done ?!

    Read the article

  • i want to show the result of my code on a web page because it is being showed on a console??

    - by lojayna
    package collabsoft.backlog_reports.c4; import java.sql.CallableStatement; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.Statement; //import collabsoft.backlog_reports.c4.Report; public class Report { private Connection con; public Report(){ connectUsingJDBC(); } public static void main(String args[]){ Report dc = new Report(); dc.reviewMeeting(6, 8, 10); dc.createReport("dede",100); //dc.viewReport(100); // dc.custRent(3344,123,22,11-11-2009); } /** the following method is used to connect to the database **/ public void connectUsingJDBC() { // This is the name of the ODBC data source String dataSourceName = "Simple_DB"; try { // loading the driver in the memory Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); // This is the connection URL String dbURL = "jdbc:odbc:" + dataSourceName; con = DriverManager.getConnection("jdbc:mysql://localhost:3306/Collabsoft","root",""); // This line is used to print the name of the driver and it would throw an exception if a problem occured System.out.println("User connected using driver: " + con.getMetaData().getDriverName()); //Addcustomer(con,1111,"aaa","aaa","aa","aam","111","2222","111"); //rentedMovies(con); //executePreparedStatement(con); //executeCallableStatement(con); //executeBatch(con); } catch (Exception e) { e.printStackTrace(); } } /** *this code is to link the SQL code with the java for the task *as an admin I should be able to create a report of a review meeting including notes, tasks and users *i will take the task id and user id and note id that will be needed to be added in the review meeting report and i will display the information related to these ida */ public void reviewMeeting(int taskID, int userID, int noteID)// law el proc bt return table { try{ CallableStatement callableStatement = con.prepareCall("{CALL report_review_meeting(?,?,?)}"); callableStatement.setInt(1,taskID); callableStatement.setInt(2,userID); callableStatement.setInt(3,noteID); ResultSet resultSet = callableStatement.executeQuery(); // or executeupdate() or updateQuery ResultSetMetaData rsm = resultSet.getMetaData(); int numOfColumns = rsm.getColumnCount(); System.out.println("lojayna"); while (resultSet.next()) { System.out.println("New Row:"); for (int i = 1; i <= numOfColumns; i++) System.out.print(rsm.getColumnName(i) + ": " + resultSet.getObject(i) + " "); System.out.println(); } } catch(Exception e) { System.out.println("E"); } } ////////////////////////////////// ///////////////////////////////// public void allproject(int projID)// law el proc bt return table { try{ CallableStatement callableStatement = con.prepareCall("{CALL all_project(?)}"); callableStatement.setInt(1,projID); //callableStatement.setInt(2,userID); //callableStatement.setInt(3,noteID); ResultSet resultSet = callableStatement.executeQuery(); // or executeupdate() or updateQuery ResultSetMetaData rsm = resultSet.getMetaData(); int numOfColumns = rsm.getColumnCount(); System.out.println("lojayna"); while (resultSet.next()) { System.out.println("New Row:"); for (int i = 1; i <= numOfColumns; i++) System.out.print(rsm.getColumnName(i) + ": " + resultSet.getObject(i) + " "); System.out.println(); } } catch(Exception e) { System.out.println("E"); } } /////////////////////////////// /** * here i take the event id and i take a string report and then * i relate the report with the event **/ public void createReport(String report,int E_ID )// law el proc bt return table { try{ Statement st = con.createStatement(); st.executeUpdate("UPDATE e_vent SET e_vent.report=report WHERE e_vent.E_ID= E_ID;"); /* CallableStatement callableStatement = con.prepareCall("{CALL Create_report(?,?)}"); callableStatement.setString(1,report); callableStatement.setInt(2,E_ID); ResultSet resultSet = callableStatement.executeQuery(); // or executeupdate() or updateQuery ResultSetMetaData rsm = resultSet.getMetaData(); int numOfColumns = rsm.getColumnCount(); System.out.println("lojayna"); while (resultSet.next()) { System.out.println("New Row:"); for (int i = 1; i <= numOfColumns; i++) System.out.print(rsm.getColumnName(i) + ": " + resultSet.getObject(i) + " "); System.out.println(); }*/ } catch(Exception e) { System.out.println("E"); System.out.println(e); } } /** in the following method i view the report of the event having the ID eventID */ public void viewReport(int eventID)// law el proc bt return table { try{ CallableStatement callableStatement = con.prepareCall("{CALL view_report(?)}"); callableStatement.setInt(1,eventID); ResultSet resultSet = callableStatement.executeQuery(); // or executeupdate() or updateQuery ResultSetMetaData rsm = resultSet.getMetaData(); int numOfColumns = rsm.getColumnCount(); System.out.println("lojayna"); while (resultSet.next()) { System.out.println("New Row:"); for (int i = 1; i <= numOfColumns; i++) System.out.print(rsm.getColumnName(i) + ": " + resultSet.getObject(i) + " "); System.out.println(); } } catch(Exception e) { System.out.println("E"); } } } // the result of these methods is being showed on the console , i am using WIcket and i want it 2 be showed on the web how is that done ?! thnxxx

    Read the article

  • pass an ID with hyperlik but cant get this ID value from a fk in one table when i click in insert

    - by susan
    Something strange happened in my codes, actually I have a hyperlink that pass ID value in a query string to second page.in second page i have 2 sql datasource that both these sql datasources should get this id value and pass it to a filter parameter to show sth in datalist. so in another word I have a first page that has an hyperlink read ID value from a datasource and pass it to second page.its like below: <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# "~/forumpage.aspx?ID="+Eval("ID")%>'><%#Eval("title")%> </asp:HyperLink> then in second page i have one sql datasource with a query like this ...where ID=@id and get this id in query string from db.it work great . but i have problem with second sql datasource in second page it has a query sth like below:...forms.question_id=@id then in sql reference both to query string as ID that get by first page in hyperlink. but when i click in insert button show me error with fk. error:Error:The INSERT statement conflicted with the FOREIGN KEY constraint "FK_forumreply_forumquestions". The conflict occurred in database "forum", table "dbo.forumquestions", column 'ID'. The statement has been terminated. my tables (question(ID,user_id(fk),Cat_id(fk),title,bodytext) (reply(ID,userr_id(fk),questionn_id(fk),titlereply,bodytestreply); When by hand in cb i gave a number in questionn_id like 1 it show me successful but when it want read from a filter by datasource this field face with problem. plzzzz help i really need skip from this part.and cause i am new i guess I cant understand the logic way clearly. <asp:SqlDataSource ID="sdsreply" runat="server" ConnectionString="<%$ ConnectionStrings:forumConnectionString %>" SelectCommand="SELECT forumreply.ID, forumreply.userr_id, forumreply.questionn_id, forumreply.bodytextreply, forumreply.datetimereply, forumquestions.ID AS Expr1, forumusers.ID AS Expr2, forumusers.username FROM forumquestions INNER JOIN forumreply ON forumquestions.ID = forumreply.questionn_id INNER JOIN forumusers ON forumquestions.user_id = forumusers.ID AND forumreply.userr_id = forumusers.ID where forumreply.questionn_id=@questionn_id"> <SelectParameters> <asp:QueryStringParameter Name="questionn_id" QueryStringField="ID" /> </SelectParameters> </asp:SqlDataSource> it is cb for second page in insert button: { if (Session["userid"] != null) { lblreply.Text = Session["userid"].ToString(); } else { Session["userid"]=null; } if (HttpContext.Current.User.Identity.IsAuthenticated) { lblshow.Text = string.Empty; string d = HttpContext.Current.User.Identity.Name; lblshow.Text =d + "???? ??? ?????." ; foreach (DataListItem item in DataList2.Items) { Label questionn_idLabel = (Label)item.FindControl("questionn_idLabel"); Label userr_idLabel = (Label)item.FindControl("userr_idLabel"); lbltest.Text = string.Empty; lbltest.Text = questionn_idLabel.Text; lblreply.Text = string.Empty; lblreply.Text = userr_idLabel.Text; } } else { lblshow.Text = "??? ??? ??? ??? ?? ?? ?????? ???? ???? ???? ????? ??? ??? ? ??? ????? ???????."; } } { if(HttpContext.Current.User.Identity.IsAuthenticated) { if (Page.IsValid) { SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["forumConnectionString"].ConnectionString); try { con.Open(); SqlCommand cmd = new SqlCommand("insert into forumreply (userr_id,questionn_id,bodytextreply,datetimereply)values(@userr_id,@questionn_id,@bodytextreply,@datetimereply)", con); cmd.Parameters.AddWithValue("userr_id",lblreply.Text); cmd.Parameters.AddWithValue("questionn_id",lbltest.Text); cmd.Parameters.AddWithValue("bodytextreply",txtbody.Text); cmd.Parameters.AddWithValue("datetimereply",DateTime.Now ); cmd.ExecuteNonQuery(); } catch (Exception exp) { Response.Write("<b>Error:</b>"); Response.Write(exp.Message); } finally { con.Close(); } lblmsg.Text = "???? ??? ?? ?????? ??? ?????.thx"; lblshow.Visible = false; //lbltxt.Text = txtbody.Text; txtbody.Text = string.Empty; } } else { lblmsg.Text = string.Empty; Session["rem"] = Request.UrlReferrer.AbsoluteUri; Response.Redirect("~/login.aspx"); } }

    Read the article

  • SimpleMembership, Membership Providers, Universal Providers and the new ASP.NET 4.5 Web Forms and ASP.NET MVC 4 templates

    - by Jon Galloway
    The ASP.NET MVC 4 Internet template adds some new, very useful features which are built on top of SimpleMembership. These changes add some great features, like a much simpler and extensible membership API and support for OAuth. However, the new account management features require SimpleMembership and won't work against existing ASP.NET Membership Providers. I'll start with a summary of top things you need to know, then dig into a lot more detail. Summary: SimpleMembership has been designed as a replacement for traditional the previous ASP.NET Role and Membership provider system SimpleMembership solves common problems people ran into with the Membership provider system and was designed for modern user / membership / storage needs SimpleMembership integrates with the previous membership system, but you can't use a MembershipProvider with SimpleMembership The new ASP.NET MVC 4 Internet application template AccountController requires SimpleMembership and is not compatible with previous MembershipProviders You can continue to use existing ASP.NET Role and Membership providers in ASP.NET 4.5 and ASP.NET MVC 4 - just not with the ASP.NET MVC 4 AccountController The existing ASP.NET Role and Membership provider system remains supported as is part of the ASP.NET core ASP.NET 4.5 Web Forms does not use SimpleMembership; it implements OAuth on top of ASP.NET Membership The ASP.NET Web Site Administration Tool (WSAT) is not compatible with SimpleMembership The following is the result of a few conversations with Erik Porter (PM for ASP.NET MVC) to make sure I had some the overall details straight, combined with a lot of time digging around in ILSpy and Visual Studio's assembly browsing tools. SimpleMembership: The future of membership for ASP.NET The ASP.NET Membership system was introduces with ASP.NET 2.0 back in 2005. It was designed to solve common site membership requirements at the time, which generally involved username / password based registration and profile storage in SQL Server. It was designed with a few extensibility mechanisms - notably a provider system (which allowed you override some specifics like backing storage) and the ability to store additional profile information (although the additional  profile information was packed into a single column which usually required access through the API). While it's sometimes frustrating to work with, it's held up for seven years - probably since it handles the main use case (username / password based membership in a SQL Server database) smoothly and can be adapted to most other needs (again, often frustrating, but it can work). The ASP.NET Web Pages and WebMatrix efforts allowed the team an opportunity to take a new look at a lot of things - e.g. the Razor syntax started with ASP.NET Web Pages, not ASP.NET MVC. The ASP.NET Web Pages team designed SimpleMembership to (wait for it) simplify the task of dealing with membership. As Matthew Osborn said in his post Using SimpleMembership With ASP.NET WebPages: With the introduction of ASP.NET WebPages and the WebMatrix stack our team has really be focusing on making things simpler for the developer. Based on a lot of customer feedback one of the areas that we wanted to improve was the built in security in ASP.NET. So with this release we took that time to create a new built in (and default for ASP.NET WebPages) security provider. I say provider because the new stuff is still built on the existing ASP.NET framework. So what do we call this new hotness that we have created? Well, none other than SimpleMembership. SimpleMembership is an umbrella term for both SimpleMembership and SimpleRoles. Part of simplifying membership involved fixing some common problems with ASP.NET Membership. Problems with ASP.NET Membership ASP.NET Membership was very obviously designed around a set of assumptions: Users and user information would most likely be stored in a full SQL Server database or in Active Directory User and profile information would be optimized around a set of common attributes (UserName, Password, IsApproved, CreationDate, Comment, Role membership...) and other user profile information would be accessed through a profile provider Some problems fall out of these assumptions. Requires Full SQL Server for default cases The default, and most fully featured providers ASP.NET Membership providers (SQL Membership Provider, SQL Role Provider, SQL Profile Provider) require full SQL Server. They depend on stored procedure support, and they rely on SQL Server cache dependencies, they depend on agents for clean up and maintenance. So the main SQL Server based providers don't work well on SQL Server CE, won't work out of the box on SQL Azure, etc. Note: Cory Fowler recently let me know about these Updated ASP.net scripts for use with Microsoft SQL Azure which do support membership, personalization, profile, and roles. But the fact that we need a support page with a set of separate SQL scripts underscores the underlying problem. Aha, you say! Jon's forgetting the Universal Providers, a.k.a. System.Web.Providers! Hold on a bit, we'll get to those... Custom Membership Providers have to work with a SQL-Server-centric API If you want to work with another database or other membership storage system, you need to to inherit from the provider base classes and override a bunch of methods which are tightly focused on storing a MembershipUser in a relational database. It can be done (and you can often find pretty good ones that have already been written), but it's a good amount of work and often leaves you with ugly code that has a bunch of System.NotImplementedException fun since there are a lot of methods that just don't apply. Designed around a specific view of users, roles and profiles The existing providers are focused on traditional membership - a user has a username and a password, some specific roles on the site (e.g. administrator, premium user), and may have some additional "nice to have" optional information that can be accessed via an API in your application. This doesn't fit well with some modern usage patterns: In OAuth and OpenID, the user doesn't have a password Often these kinds of scenarios map better to user claims or rights instead of monolithic user roles For many sites, profile or other non-traditional information is very important and needs to come from somewhere other than an API call that maps to a database blob What would work a lot better here is a system in which you were able to define your users, rights, and other attributes however you wanted and the membership system worked with your model - not the other way around. Requires specific schema, overflow in blob columns I've already mentioned this a few times, but it bears calling out separately - ASP.NET Membership focuses on SQL Server storage, and that storage is based on a very specific database schema. SimpleMembership as a better membership system As you might have guessed, SimpleMembership was designed to address the above problems. Works with your Schema As Matthew Osborn explains in his Using SimpleMembership With ASP.NET WebPages post, SimpleMembership is designed to integrate with your database schema: All SimpleMembership requires is that there are two columns on your users table so that we can hook up to it – an “ID” column and a “username” column. The important part here is that they can be named whatever you want. For instance username doesn't have to be an alias it could be an email column you just have to tell SimpleMembership to treat that as the “username” used to log in. Matthew's example shows using a very simple user table named Users (it could be named anything) with a UserID and Username column, then a bunch of other columns he wanted in his app. Then we point SimpleMemberhip at that table with a one-liner: WebSecurity.InitializeDatabaseFile("SecurityDemo.sdf", "Users", "UserID", "Username", true); No other tables are needed, the table can be named anything we want, and can have pretty much any schema we want as long as we've got an ID and something that we can map to a username. Broaden database support to the whole SQL Server family While SimpleMembership is not database agnostic, it works across the SQL Server family. It continues to support full SQL Server, but it also works with SQL Azure, SQL Server CE, SQL Server Express, and LocalDB. Everything's implemented as SQL calls rather than requiring stored procedures, views, agents, and change notifications. Note that SimpleMembership still requires some flavor of SQL Server - it won't work with MySQL, NoSQL databases, etc. You can take a look at the code in WebMatrix.WebData.dll using a tool like ILSpy if you'd like to see why - there places where SQL Server specific SQL statements are being executed, especially when creating and initializing tables. It seems like you might be able to work with another database if you created the tables separately, but I haven't tried it and it's not supported at this point. Note: I'm thinking it would be possible for SimpleMembership (or something compatible) to run Entity Framework so it would work with any database EF supports. That seems useful to me - thoughts? Note: SimpleMembership has the same database support - anything in the SQL Server family - that Universal Providers brings to the ASP.NET Membership system. Easy to with Entity Framework Code First The problem with with ASP.NET Membership's system for storing additional account information is that it's the gate keeper. That means you're stuck with its schema and accessing profile information through its API. SimpleMembership flips that around by allowing you to use any table as a user store. That means you're in control of the user profile information, and you can access it however you'd like - it's just data. Let's look at a practical based on the AccountModel.cs class in an ASP.NET MVC 4 Internet project. Here I'm adding a Birthday property to the UserProfile class. [Table("UserProfile")] public class UserProfile { [Key] [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)] public int UserId { get; set; } public string UserName { get; set; } public DateTime Birthday { get; set; } } Now if I want to access that information, I can just grab the account by username and read the value. var context = new UsersContext(); var username = User.Identity.Name; var user = context.UserProfiles.SingleOrDefault(u => u.UserName == username); var birthday = user.Birthday; So instead of thinking of SimpleMembership as a big membership API, think of it as something that handles membership based on your user database. In SimpleMembership, everything's keyed off a user row in a table you define rather than a bunch of entries in membership tables that were out of your control. How SimpleMembership integrates with ASP.NET Membership Okay, enough sales pitch (and hopefully background) on why things have changed. How does this affect you? Let's start with a diagram to show the relationship (note: I've simplified by removing a few classes to show the important relationships): So SimpleMembershipProvider is an implementaiton of an ExtendedMembershipProvider, which inherits from MembershipProvider and adds some other account / OAuth related things. Here's what ExtendedMembershipProvider adds to MembershipProvider: The important thing to take away here is that a SimpleMembershipProvider is a MembershipProvider, but a MembershipProvider is not a SimpleMembershipProvider. This distinction is important in practice: you cannot use an existing MembershipProvider (including the Universal Providers found in System.Web.Providers) with an API that requires a SimpleMembershipProvider, including any of the calls in WebMatrix.WebData.WebSecurity or Microsoft.Web.WebPages.OAuth.OAuthWebSecurity. However, that's as far as it goes. Membership Providers still work if you're accessing them through the standard Membership API, and all of the core stuff  - including the AuthorizeAttribute, role enforcement, etc. - will work just fine and without any change. Let's look at how that affects you in terms of the new templates. Membership in the ASP.NET MVC 4 project templates ASP.NET MVC 4 offers six Project Templates: Empty - Really empty, just the assemblies, folder structure and a tiny bit of basic configuration. Basic - Like Empty, but with a bit of UI preconfigured (css / images / bundling). Internet - This has both a Home and Account controller and associated views. The Account Controller supports registration and login via either local accounts and via OAuth / OpenID providers. Intranet - Like the Internet template, but it's preconfigured for Windows Authentication. Mobile - This is preconfigured using jQuery Mobile and is intended for mobile-only sites. Web API - This is preconfigured for a service backend built on ASP.NET Web API. Out of these templates, only one (the Internet template) uses SimpleMembership. ASP.NET MVC 4 Basic template The Basic template has configuration in place to use ASP.NET Membership with the Universal Providers. You can see that configuration in the ASP.NET MVC 4 Basic template's web.config: <profile defaultProvider="DefaultProfileProvider"> <providers> <add name="DefaultProfileProvider" type="System.Web.Providers.DefaultProfileProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/" /> </providers> </profile> <membership defaultProvider="DefaultMembershipProvider"> <providers> <add name="DefaultMembershipProvider" type="System.Web.Providers.DefaultMembershipProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" /> </providers> </membership> <roleManager defaultProvider="DefaultRoleProvider"> <providers> <add name="DefaultRoleProvider" type="System.Web.Providers.DefaultRoleProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/" /> </providers> </roleManager> <sessionState mode="InProc" customProvider="DefaultSessionProvider"> <providers> <add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" /> </providers> </sessionState> This means that it's business as usual for the Basic template as far as ASP.NET Membership works. ASP.NET MVC 4 Internet template The Internet template has a few things set up to bootstrap SimpleMembership: \Models\AccountModels.cs defines a basic user account and includes data annotations to define keys and such \Filters\InitializeSimpleMembershipAttribute.cs creates the membership database using the above model, then calls WebSecurity.InitializeDatabaseConnection which verifies that the underlying tables are in place and marks initialization as complete (for the application's lifetime) \Controllers\AccountController.cs makes heavy use of OAuthWebSecurity (for OAuth account registration / login / management) and WebSecurity. WebSecurity provides account management services for ASP.NET MVC (and Web Pages) WebSecurity can work with any ExtendedMembershipProvider. There's one in the box (SimpleMembershipProvider) but you can write your own. Since a standard MembershipProvider is not an ExtendedMembershipProvider, WebSecurity will throw exceptions if the default membership provider is a MembershipProvider rather than an ExtendedMembershipProvider. Practical example: Create a new ASP.NET MVC 4 application using the Internet application template Install the Microsoft ASP.NET Universal Providers for LocalDB NuGet package Run the application, click on Register, add a username and password, and click submit You'll get the following execption in AccountController.cs::Register: To call this method, the "Membership.Provider" property must be an instance of "ExtendedMembershipProvider". This occurs because the ASP.NET Universal Providers packages include a web.config transform that will update your web.config to add the Universal Provider configuration I showed in the Basic template example above. When WebSecurity tries to use the configured ASP.NET Membership Provider, it checks if it can be cast to an ExtendedMembershipProvider before doing anything else. So, what do you do? Options: If you want to use the new AccountController, you'll either need to use the SimpleMembershipProvider or another valid ExtendedMembershipProvider. This is pretty straightforward. If you want to use an existing ASP.NET Membership Provider in ASP.NET MVC 4, you can't use the new AccountController. You can do a few things: Replace  the AccountController.cs and AccountModels.cs in an ASP.NET MVC 4 Internet project with one from an ASP.NET MVC 3 application (you of course won't have OAuth support). Then, if you want, you can go through and remove other things that were built around SimpleMembership - the OAuth partial view, the NuGet packages (e.g. the DotNetOpenAuthAuth package, etc.) Use an ASP.NET MVC 4 Internet application template and add in a Universal Providers NuGet package. Then copy in the AccountController and AccountModel classes. Create an ASP.NET MVC 3 project and upgrade it to ASP.NET MVC 4 using the steps shown in the ASP.NET MVC 4 release notes. None of these are particularly elegant or simple. Maybe we (or just me?) can do something to make this simpler - perhaps a NuGet package. However, this should be an edge case - hopefully the cases where you'd need to create a new ASP.NET but use legacy ASP.NET Membership Providers should be pretty rare. Please let me (or, preferably the team) know if that's an incorrect assumption. Membership in the ASP.NET 4.5 project template ASP.NET 4.5 Web Forms took a different approach which builds off ASP.NET Membership. Instead of using the WebMatrix security assemblies, Web Forms uses Microsoft.AspNet.Membership.OpenAuth assembly. I'm no expert on this, but from a bit of time in ILSpy and Visual Studio's (very pretty) dependency graphs, this uses a Membership Adapter to save OAuth data into an EF managed database while still running on top of ASP.NET Membership. Note: There may be a way to use this in ASP.NET MVC 4, although it would probably take some plumbing work to hook it up. How does this fit in with Universal Providers (System.Web.Providers)? Just to summarize: Universal Providers are intended for cases where you have an existing ASP.NET Membership Provider and you want to use it with another SQL Server database backend (other than SQL Server). It doesn't require agents to handle expired session cleanup and other background tasks, it piggybacks these tasks on other calls. Universal Providers are not really, strictly speaking, universal - at least to my way of thinking. They only work with databases in the SQL Server family. Universal Providers do not work with Simple Membership. The Universal Providers packages include some web config transforms which you would normally want when you're using them. What about the Web Site Administration Tool? Visual Studio includes tooling to launch the Web Site Administration Tool (WSAT) to configure users and roles in your application. WSAT is built to work with ASP.NET Membership, and is not compatible with Simple Membership. There are two main options there: Use the WebSecurity and OAuthWebSecurity API to manage the users and roles Create a web admin using the above APIs Since SimpleMembership runs on top of your database, you can update your users as you would any other data - via EF or even in direct database edits (in development, of course)

    Read the article

  • The ugly evolution of running a background operation in the context of an ASP.NET app

    - by Jeff
    If you’re one of the two people who has followed my blog for many years, you know that I’ve been going at POP Forums now for over almost 15 years. Publishing it as an open source app has been a big help because it helps me understand how people want to use it, and having it translated to six languages is pretty sweet. Despite this warm and fuzzy group hug, there has been an ugly hack hiding in there for years. One of the things we find ourselves wanting to do is hide some kind of regular process inside of an ASP.NET application that runs periodically. The motivation for this has always been that a lot of people simply don’t have a choice, because they’re running the app on shared hosting, or don’t otherwise have access to a box that can run some kind of regular background service. In POP Forums, I “solved” this problem years ago by hiding some static timers in an HttpModule. Truthfully, this works well as long as you don’t run multiple instances of the app, which in the cloud world, is always a possibility. With the arrival of WebJobs in Azure, I’m going to solve this problem. This post isn’t about that. The other little hacky problem that I “solved” was spawning a background thread to queue emails to subscribed users of the forum. This evolved quite a bit over the years, starting with a long running page to mail users in real-time, when I had only a few hundred. By the time it got into the thousands, or tens of thousands, I needed a better way. What I did is launched a new thread that read all of the user data in, then wrote a queued email to the database (as in, the entire body of the email, every time), with the properly formatted opt-out link. It was super inefficient, but it worked. Then I moved my biggest site using it, CoasterBuzz, to an Azure Website, and it stopped working. So let’s start with the first stupid thing I was doing. The new thread was simply created with delegate code inline. As best I can tell, Azure Websites are more aggressive about garbage collection, because that thread didn’t queue even one message. When the calling server response went out of scope, so went the magic background thread. Duh, all I had to do was move the thread to a private static variable in the class. That’s the way I was able to keep stuff running from the HttpModule. (And yes, I know this is still prone to failure, particularly if the app recycles. For as infrequently as it’s used, I have not, however, experienced this.) It was still failing, but this time I wasn’t sure why. It would queue a few dozen messages, then die. Running in Azure, I had to turn on the application logging and FTP in to see what was going on. That led me to a helper method I was using as delegate to build the unsubscribe links. The idea here is that I didn’t want yet another config entry to describe the base URL, appended with the right path that would match the routing table. No, I wanted the app to figure it out for you, so I came up with this little thing: public static string FullUrlHelper(this Controller controller, string actionName, string controllerName, object routeValues = null) { var helper = new UrlHelper(controller.Request.RequestContext); var requestUrl = controller.Request.Url; if (requestUrl == null) return String.Empty; var url = requestUrl.Scheme + "://"; url += requestUrl.Host; url += (requestUrl.Port != 80 ? ":" + requestUrl.Port : ""); url += helper.Action(actionName, controllerName, routeValues); return url; } And yes, that should have been done with a string builder. This is useful for sending out the email verification messages, too. As clever as I thought I was with this, I was using a delegate in the admin controller to format these unsubscribe links for tens of thousands of users. I passed that delegate into a service class that did the email work: Func<User, string> unsubscribeLinkGenerator = user => this.FullUrlHelper("Unsubscribe", AccountController.Name, new { id = user.UserID, key = _profileService.GetUnsubscribeHash(user) }); _mailingListService.MailUsers(subject, body, htmlBody, unsubscribeLinkGenerator); Cool, right? Actually, not so much. If you look back at the helper, this delegate then will depend on the controller context to learn the routing and format for the URL. As you might have guessed, those things were turning null after a few dozen formatted links, when the original request to the admin controller went away. That this wasn’t already happening on my dedicated server is surprising, but again, I understand why the Azure environment might be eager to reclaim a thread after servicing the request. It’s already inefficient that I’m building the entire email for every user, but going back to check the routing table for the right link every time isn’t a win either. I put together a little hack to look up one generic URL, and use that as the basis for a string format. If you’re wondering why I didn’t just use the curly braces up front, it’s because they get URL formatted: var baseString = this.FullUrlHelper("Unsubscribe", AccountController.Name, new { id = "--id--", key = "--key--" }); baseString = baseString.Replace("--id--", "{0}").Replace("--key--", "{1}"); Func unsubscribeLinkGenerator = user => String.Format(baseString, user.UserID, _profileService.GetUnsubscribeHash(user)); _mailingListService.MailUsers(subject, body, htmlBody, unsubscribeLinkGenerator); And wouldn’t you know it, the new solution works just fine. It’s still kind of hacky and inefficient, but it will work until this somehow breaks too.

    Read the article

  • Eclipse won't let me select a Windows share as Workspace

    - by Android Eve
    Environment: Ubuntu 10.04 (64-bit), Eclipse Helios 3.6 (64-bit), Android 2.3 SDK + ADT. All works great, but I can only select a workspace that's on the local system. Eclipse won't let me select shared folder on a Samba server. Ubuntu's URI for this share is of the form: smb://[email protected]/sandbox/workspace But even if I typed this manually into the edit box, Eclipse won't accept it. I don't have this problem with Eclipse 3.6 on Windows. Is there a workaround to solve this?

    Read the article

  • database api commands

    - by Rahul Mehta
    As I am developing database api for a project. I am developing commands for getting data from database. e.g. i have one gib table so command for that is getgib name alias limit fields if user pass the name e.g. getgib rahul than it will return all the gib data whose name is like rahul. if alias is given than it will return the all the gib owned by the user whose alias(userid) given . So i want to design the commands. limit : is to limit the record in query, fields : is the extra fields i want to add in the select query . so as now commands are set but now Question 1 : i want the gibs by the gibid , so how to make this or any suggestion to improve my command is welcome. Question 2 : if user don't want to specify the name , and he want only the gibs by providing alias then at this what separator at the place of name i should used.

    Read the article

  • How should I design my database API commands? [closed]

    - by WebDev
    I am developing a database API for a project, with commands for getting data from the database. For example, I have one gib table, so the command for that is: getgib name alias limit fields If the user pass their name: getgib rahul Then it will return all gib data whose name is like rahul. If an alias is given then it will return all the gib owned by the user whose alias (userid) was given. I want to design the commands: limit: to limit the record in query, fields: extra fields I want to add in the select query. So now the commands are set, but: I want the gibs by the gibid, so how to make this or any suggestion to improve my command is welcome. If the user doesn't want to specify the name, and he wants only the gibs by providing alias, then what separator should I use instead of name?

    Read the article

  • Windows Phone 7 UserExtenedProperties opinion...

    - by webdad3
    I was thinking of a way to some how connect my phone user base to my site user base. Right now if an item gets added to the site via the phone the userId is generic and the site displays it as SmartPhoneUser. I was thinking it might be cool to display the unique phone id by using the UserExtenedProperties, however, after reading Nick Harris's blog about it I'm thinking it may not be a good idea as I don't want users to think I'm up to anything nefarious. So I'm wondering if there are any suggestions out there on how to accomplish this task. Right now my site uses the JanRain module that allows multiple logins from other sites (Facebook, Yahoo, Google etc.). Any thoughts on how I can accomplish what I want to do without using the ExtendedProperties?

    Read the article

  • What is the term that means "keeping the arguments for different API calls as similar as possible"?

    - by larson4
    There is a word which I can never remember... it expresses a design goal that API calls (or functions or methods or whatever) should be as similar as reasonably possible in their argument patterns. It may also extend to naming as well. In other words, all other things being equal, it is probably bad to have these three functions: deleteUser(email) petRemove(petId,species) destroyPlanet(planetName,starName) if instead you could have deleteUser(userId) deletePet(petId) deletePlanet(planetId) What is the word for this concept? I keep thinking it's "orthogonal" but it definitely isn't. Its a very important concept, and to me it's one of the biggest things that makes some APIs a joy to work with (because once you learn a few things you can pretty much use everything without looking at doco), and others a pain (because every function is done inconsistently).

    Read the article

  • De-facto standards for customer information record

    - by maasg
    I'm currently evaluating a potential new project that involves creating a DB for typical customer information (userid, pwd, first & last name, email, adress, telfnr ...). At this point, requirements are only roughly defined. The customer DB is expected in the O(millions) of records. In order to calculate some back-of-the-envelope numbers for DB sizing and evaluate potential DB options & architectures, I'm looking for some de-facto standards for these kind of records. In particular, the std size of every field (first name, last name, address,...) or typical avg for a simple customer record would be great info. With so many e-commerce websites out there, there should be some kind of typical config that can be reused and avoid re-inventing the wheel. Any ideas?

    Read the article

  • Player rewards in games where you normally have nothing to purchase

    - by PeterK
    In many games there are rewards such as gold coins, points, etc. When these rewards can be used to purchase in-game items, it motivates the player to keep playing. Let's say we have an online game, poker, Yatzy etc. What type of reward would keep the players playing if there are few in-game items available to buy, or none at all? What I am looking for is a reward system that entices the players to play more in a game environment where there isn't that much to purchase. For example, there isn't much to buy in a poker or Yatzy game with the gold you win. I guess having some titles that are added to the userid is one way, or maybe purchasing a logo for the id... A leaderboard is another. Any thoughts on this?

    Read the article

  • gnome-power-manager is running while trying to log in. How to get rid of it?

    - by koushik
    After booting into the ubuntu login screen and clicking on my user name and entering the password, I get a dialog stating that gnome-power-manager is still running. The dialog presents 2 buttons, 1 to Cancel and other to Logout Anyway. This issue happens about 50% of the time and I don't remember doing anything related to power management recently. Also, even if I don't choose any option in the dialog it goes away after about 30s. This is happening on a desktop machine as well as a laptop. On the laptop I have configured power management for myself (not for gdm) whereas in desktop I have not configured power management for any user. This is only an annoyance but still I would like to fix it, especially on my desktop where I am interested in getting it auto-login ASAP into my userid. Any ideas why this could be happenning?

    Read the article

  • arrays format (Javascript)

    - by João Melo
    i have a list of users, with minions, something like this: User52: minion10 minion12 User32: minion13 minion11 i've been keeping in an array where the "location" is the id, like this: Users: [52]User minions: [10]minion [12]minion [32]User minions: [13]minion [11]minion so i can access them easily like this: user[UserID].minions[MinionID] (ex: user[32].minions[11]) but when i print it or send it by json i get something like this: {,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,minion,,,,,,,,,,,,,,minion} but should i keep using like this or should i change to something like this: User = function(){ this.minions = ...; this.getMinion = function(value){ for(var m in this.minions){ if(this.minions[m].id == value){ return this.minions[m]; break; } } } } and get it like this: user.getMinion(MinionID); Question: i get better performance using a "short" array but using loops every time i need a minion, or using "long" arrays, but no need for loop and getting values directly from the id "name"?

    Read the article

  • Placing advice on any parameter of a given type in AspectJ

    - by user12558
    Hi, Im doing a POC using Aspectj. class BaseInfo{..} class UserInfo extends BaseInfo{..} class UserService { public void getUser(UserInfo userInfo){..} public void deleteUser(String userId){..} } I've defined an advice, that gets invoked when I pass an UserInfo instance.But when i try to pass the BaseInfo, the advice is not getting invoked. Below block executes the afterMethod as expected for getUser. &ltaop:pointcut id="aopafterMethod" expression="execution(* UserService.*(..,UserInfo,..))" / &gtaop:after pointcut-ref="aopafterMethod" method="afterMethod" / But when i try to give BaseInfo instead of UserInfo, the aspect is not getting triggered. Am i missing something? Kindly help me on this issue.

    Read the article

  • Problem with connect to server using FTP(with login)

    - by Sourav Chattopadhyay
    I am unable connect to my remote account using Ubuntu's "Connect to Server" option after moving on to Ubuntu 12.04 LTS. In Ubuntu 10.10 I used to connect to my FTP server by going to Places-Connect to server-FTP (with login) After giving the userid and password the remote folder would mount immediately but now it is showing a busy icon at top until I close the window after some time. I have also tried to connect using Ctrl + L from a Nautilus window using sftp://user@server but result is the same. Even though I could connect to my FTP server using gFTP, the default one from Nautilus is a better option to me.

    Read the article

  • aspect parameter validation [closed]

    - by user12558
    Hi, Im doing a POC using Aspectj. class BaseInfo{..} class UserInfo extends BaseInfo{..} class UserService { public void getUser(UserInfo userInfo){..} public void deleteUser(String userId){..} } I've defined an advice, that gets invoked when I pass an UserInfo instance.But when i try to pass the BaseInfo, the advice is not getting invoked. Below block executes the afterMethod as expected for getUser. &ltaop:pointcut id="aopafterMethod" expression="execution(* UserService.*(..,UserInfo,..))" / &gtaop:after pointcut-ref="aopafterMethod" method="afterMethod" / But when i try to give BaseInfo instead of UserInfo, the aspect is not getting triggered. Am i missing something? Kindly help me on this issue.

    Read the article

< Previous Page | 25 26 27 28 29 30 31 32 33 34 35 36  | Next Page >