Search Results

Search found 8354 results on 335 pages for 'welton v3 50'.

Page 47/335 | < Previous Page | 43 44 45 46 47 48 49 50 51 52 53 54  | Next Page >

  • The question about the basics of LINQ to SQL working

    - by Alex
    I just started learning LINQ to SQL, and so far I'm impressed with the easy of use and good performance. I used to think that when doing LINQ queries like from Customer in DB.Customers where Customer.Age > 30 select Customer Get all customers from the database ("SELECT * FROM Customers"), move them to the Customers array and then make a search in that Array using .NET methods. This is very inefficient, what if there are hundreds of thousands of customers in the database? Making such big SELECT queries would kill the web application. Now after experiencing how actually fast LINQ to SQL is, I start to suspect that when doing that query I just wrote, LINQ somehow converts it to a SQL Query string SELECT * FROM Customers WHERE Age > 30 And only when necessary it will run the query. So my question is: am I right? And when is the query actually run? The reason why I'm asking is not only because I want to understand how it works in order to build good optimized applications, but because I came across the following problem. I have 2 tables, one of them is Books, the other has information on how many books were sold on certain days. My goal is to select books that had at least 50 sales/day in past 10 days. It's done with this simple query: from Book in DB.Books where (from Sale in DB.Sales where Sale.SalesAmount >= 50 and Sale.DateOfSale >= DateTime.Now.AddDays(-10) select Sale.BookID).Contains(Book.ID) select Book The point is, I have to use the checking part in several queries and I decided to create an array with IDs of all popular books: var popularBooksIDs = from Sale in DB.Sales where Sale.SalesAmount >= 50 and Sale.DateOfSale >= DateTime.Now.AddDays(-10) select Sale.BookID; BUT when I try to do the query now: from Book in DB.Books where popularBooksIDs.Contains(Book.ID) select Book It doesn't work! That's why I think that we can't use thins kinds of shortcuts in LINQ to SQL queries, like we can't use them in real SQL. We have to create straightforward queries, am I right?

    Read the article

  • Understanding C++ pointers (when they point to a pointer)

    - by Stephano
    I think I understand references and pointers pretty well. Here is what I (think I) know: int i = 5; //i is a primitive type, the value is 5, i do not know the address. int *ptr; //a pointer to an int. i have no way if knowing the value yet. ptr = &i; //now i have an address for the value of i (called ptr) *ptr = 10; //go get the value stored at ptr and change it to 10 Please feel free to comment or correct these statements. Now I'm trying to make the jump to arrays of pointers. Here is what I do not know: char **char_ptrs = new char *[50]; Node **node_ptrs = new Node *[50]; My understanding is that I have 2 arrays of pointers, one set of pointers to chars and one to nodes. So if I wanted to set the values, I would do something like this: char_ptrs[0] = new char[20]; node_ptrs[0] = new Node; Now I have a pointer, in the 0 position of my array, in each respective array. Again, feel free to comment here if I'm confused. So, what does the ** operator do? Likewise, what is putting a single * next to the instantiation doing (*[50])? (what is that called exactly, instantiation?)

    Read the article

  • Center big image in smaller div

    - by larin555
    I'm trying to align images in the center of a slider div. I'm adjusting FlexSlider css by the way. Here's my CSS code : .flexslider {margin: 0; padding: 0; width: 600px; height:480px; overflow:hidden;margin-left:auto;margin-right:auto;} .flexslider .slides > li {display: none; -webkit-backface-visibility: hidden;} /* Hide the slides before the JS is loaded. Avoids image jumping */ .flexslider .slides img {width:auto;height:100%; display: inline-block; text-align:center;} Everything is working like I want, except that I want wider image to be centered in the div. Right now it is left-aligned. I cannot use background-image by the way. Any ideas? I also tried applying to the .flexslider .slides img : margin-left:-50%...not working margin-left:auto and margin-right:auto...not working left:50% and right:50%...not working either

    Read the article

  • binding image with 2 values with convertor

    - by prince23
    hi, is it possiable to set 2 data field for an image control whiling binding **<Image Source="{Binding ItemID, Converter={StaticResource IDToImageConverter}}" Height="50" />** now here i need to add one more value Price now. need to send even price as an paramter for IDToImageConverter function how can i do it? now i need to check first price value there are 3 condition i neeed to check in my IDToImageConverter function if( price> 5o) { // then get the ItemID based on the value bind image here if(ItemID >20) { // bind image1 } if(ItemID >50) { // bind image2 } } if( price> 100) { // as above codition we do here } now how can i add these above functionality in IDToImageConverter ? any idea how i can solve it <Image Source="{Binding ItemID, Converter={StaticResource IDToImageConverter}}" Height="50" /> </DataTemplate> </data:DataGridTemplateColumn.CellTemplate> </data:DataGridTemplateColumn> </data:DataGrid.Columns> </data:DataGrid> public class IDToImageConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { Uri uri = new Uri("~/Images/" + value.ToString()+ ".jpg", UriKind.Relative); return new BitmapImage(uri); } thanks in advance. for anyhelp you provide prince

    Read the article

  • select from multiple tables but ordering by a datetime field

    - by Chris Mccabe
    I have 3 tables that are unrelated (related that each contains data for a different social network). Each has a datetime field dated- I'm already grouping by hour as you can see below (this one below for linked_in) SELECT count(*), date_format(dated, '%Y:%m:%d %H') as hour FROM upd8r_linked_in_accts WHERE CAST(dated AS DATE) = '".$start_date."' GROUP BY hour I would like to know how to do a total across all 3 networks- the tables for the three are CREATE TABLE IF NOT EXISTS `upd8r_facebook_accts` ( `id` int(11) NOT NULL AUTO_INCREMENT, `owner_id` varchar(50) NOT NULL, `user_id` int(11) NOT NULL, `fb_id` bigint(30) NOT NULL, `dated` datetime NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=80 ; CREATE TABLE IF NOT EXISTS `upd8r_linked_in_accts` ( `id` int(11) NOT NULL AUTO_INCREMENT, `owner_id` varchar(50) NOT NULL, `user_id` int(11) NOT NULL, `linked_in` varchar(200) NOT NULL, `oauth_secret` varchar(100) NOT NULL, `first_count` int(11) NOT NULL, `second_count` int(11) NOT NULL, `dated` datetime NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=200 ; CREATE TABLE IF NOT EXISTS `upd8r_twitter_accts` ( `id` int(11) NOT NULL AUTO_INCREMENT, `owner_id` varchar(50) NOT NULL, `user_id` int(11) NOT NULL, `twitter` varchar(200) NOT NULL, `twitter_secret` varchar(100) NOT NULL, `dated` datetime NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ; something like this ? (SELECT count(*), date_format(dated, '%Y:%m:%d %H') as hour FROM upd8r_linked_in_accts WHERE CAST(dated AS DATE) = '".$start_date."') UNION ALL (SELECT count(*), date_format(dated, '%Y:%m:%d %H') as hour FROM upd8r_facebook_accts WHERE CAST(dated AS DATE) = '".$start_date."') UNION ALL (SELECT count(*), date_format(dated, '%Y:%m:%d %H') as hour FROM upd8r_twitter_accts WHERE CAST(dated AS DATE) = '".$start_date."') UNION ALL GROUP BY hour

    Read the article

  • Matlab fft function

    - by CTZStef
    The code below is from the Matlab 2011a help about fft function. I think there is a problem here : why do they multiply t(1:50) by Fs, and then say it's time in millisecond ? Certainly, it happens to be true in this very particular case, but change the value of Fs to, say, 2000, and it won't work anymore, obviously because of this factor of 2. Right ? Quite misleading, isn't it ? What do I miss ? Fs = 1000; % Sampling frequency T = 1/Fs; % Sample time L = 1000; % Length of signal t = (0:L-1)*T; % Time vector % Sum of a 50 Hz sinusoid and a 120 Hz sinusoid x = 0.7*sin(2*pi*50*t) + sin(2*pi*120*t); y = x + 2*randn(size(t)); % Sinusoids plus noise plot(Fs*t(1:50),y(1:50)) title('Signal Corrupted with Zero-Mean Random Noise') xlabel('time (milliseconds)') Clearer with this : fs = 2000; % Sampling frequency T = 1 / fs; % Sample time L = 1000; % Length of signal t2 = (0:L-1)*T; % Time vector f = 50; % signal frequency s2 = sin(2*pi*f*t2); figure, plot(fs*t2(1:50),s2(1:50)); % NOT good figure, plot(t2(1:50),s2(1:50)); % good

    Read the article

  • Setting WCF service for multiple client calls

    - by user348255
    Hi all, I have made a WCF service which is defined like this: [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Multiple)] binding is done using netTcpBinding. We support 50+ clients that call the server from time to time. Each client opens a channel using channelfactory once it is loaded and uses that channel for all calls (creates the channel and proxy only once). we have built a small load tester that imitates the client by calling the server by 50 different threads at once (using 50 different channels). when we run this tester, after the 10th client tries to connect, all other client fail connecting. We have set throttling to 100. My questions are: 1. is it correct for each client to create a channel and use it through the client life time? or, do i need to use a using statement for each call to the server (create and distroy a new channel for each call). 2. does the service have a limit of channel connections to it? other then throttling? thanks alot, Guy.

    Read the article

  • japanese input display outside of TextField created into ScrollPane

    - by soetheingilynn
    hello... I'm new to ActionScript 2.0. plz kindly help me. I have created the MainMovieClip and Scrollbar as follow .... my problem is that when I input japanese characters,the characters display at the top corner of the swf until I confirm the input. how can I do it?? if I install FlashPlayer "flashplayer10_1_rc2_plugin_041910", then the japanese characters display in the textfield normally....why is that??? plz..help me. with flash player 10.0, I can't input the japanese characters in the textfield. var mcMain:MovieClip = this.createEmptyMovieClip("mcMain", this.getNextHighestDepth()); scrp.contentPath = "scrollMovieClip"; mcMain = scrp.content; var textholder:TextField = mcMain.createTextField("txt", mcMain.getNextHighestDepth(), 50, 50, 100, 50); mcMain.txt.setFocus(); mcMain.txt.type = "input"; mcMain.txt.wordWrap = true; mcMain.txt.multiline = true; mcMain.txt.background = true; mcMain.txt.border = true; mcMain.txt.selectable = true; thanks in advanced...anyone.

    Read the article

  • SQL Database Schema Design For Large 3 Billion Relationship Database.

    - by K-Bell
    Get your geek on. Can you solve this? I am designing a products database for SQL Server 2008 R2 Ed. (not Enterprise Ed.) that will be used to store custom product configurations for over 30,000 distinct products. The database will have up to 500 users at a time. Here is the design problem… Each Product has a collection of Parts (up to 50 parts per product). So if I have 30,000 Products and each of them can have up to 50 Parts, that’s 1.5 million distinct Product-to-Part relationships …or as an equation… 30,000 (Products) X 50 (Parts) = 1.5 million Product-to-Parts records. …and If… Each Part can have up to 2000 finish options (A finish is a paint color). NOTE: Only one finish will be selected by a user at run-time. The 2000 finish options I need to store are the allowed options for a specific part on a specific product. So if I have 1.5 million distinct product-to-part relationships/records and each of those parts can have up to 2,000 finishes that is 3 billion allowable product-to-part-to finish relationships/records …or as an equation… 1.5 million (Parts) x 2,000 (Finishes) = 3 Billion Product-to-Part-to-Finishes records. How can I design this database so that I can execute fast and efficient queries for a specific product and return its list of Parts and all the allowable Finishes for each part without 3 Billion Product-to-Part-to-Finish records? Read time is more important then write time. Please post your thoughts/suggestions if you have experience with large databases. Thanks!

    Read the article

  • vaadin custom layout setting a text area in a table with the location attribute

    - by user3717298
    I need to set a text area in the html template and use it as a custom component in vaadin the html snippet is as below <table> <tr> <td> JUNK SENTENCE </td> <td> <div location="HEADIN"></div> <div location="Details"></div> <div location="Attachment"></div> </td> <td> <p>School of more than 50 students univer versities.</p> </td> </tr> </table> All the place holders are working and displays data but the "details" holder should be a text area. as the text is a lot over there so I tried the below way but it just turned the place holder to text vaadin could not manipulate / identify the "Details" place holder. I tried the below way i set - in side the text area tag. <textarea rows="4" cols="50"> </textarea> and again i tried this way too which also did not work. <textarea rows="4" cols="50" location="Details"> </textarea> Any guidance would be appreciated to solve this I am setting the needed values from a formfeildfactory and these values are set by implementing the Vaadin Custom field class(in case it helps some more to identify)

    Read the article

  • opengl: question about glutMainLoop()

    - by lego69
    can somebody explain how does glutMainLoop work? and second question, why glClearColor(0.0f, 0.0f, 1.0f, 1.0f); defined after glutDisplayFunc(RenderScene); cause firstly we call glClear(GL_COLOR_BUFFER_BIT); and only then define glClearColor(0.0f, 0.0f, 1.0f, 1.0f); int main(int argc, char* argv[]) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); glutInitWindowSize(800, 00); glutInitWindowPosition(300,50); glutCreateWindow("GLRect"); glutDisplayFunc(RenderScene); glutReshapeFunc(ChangeSize); glClearColor(0.0f, 0.0f, 1.0f, 1.0f); <-- glutMainLoop(); return 0; } void RenderScene(void) { // Clear the window with current clearing color glClear(GL_COLOR_BUFFER_BIT); // Set current drawing color to red // R G B glColor3f(1.0f, 0.0f, 1.0f); // Draw a filled rectangle with current color glRectf(0.0f, 0.0f, 50.0f, -50.0f); // Flush drawing commands glFlush(); }

    Read the article

  • Urgent help! how do i convert this?..

    - by sil3nt
    Hey there, this is part of a question i got in class, im at the final stretch but this has become a major problem. In it im given a certain value which is called the "gold value" and it is 40.5, this value changes in input. and i have these constants const int RUBIES_PER_DIAMOND = 5; // relative values. * const int EMERALDS_PER_RUBY = 2; const int GOLDS_PER_EMERALDS = 5; const int SILVERS_PER_GOLD = 4; const int COPPERS_PER_SILVER = 5; const int DIAMOND_VALUE = 50; // gold values. * const int RUBY_VALUE = 10; const int EMERALD_VALUE = 5; const float SILVER_VALUE = 0.25; const float COPPER_VALUE = 0.05; which means that basically for every diamond there are 5 rubies, and for every ruby there are 2 emeralds. So on and so forth. and the "gold value" for every diamond for example is 50 (diamond value = 50) this is how much one diamond is worth in golds. my problem is converting 40.5 into these diamonds and ruby values. I know the answer is 4rubies and 2silvers but how do i write the algorithm for this so that it gives the best estimate for every goldvalue that comes along?? please help!, im at my wits end

    Read the article

  • css, fixed size

    - by gloris
    Hi, I need three tables (div). The left and right sides of the occupied 50% of the free window. The center is fixed. Everything seems fine, but right down to jump off the table. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <style type="text/css"> body{ margin:0; padding:0; } #left{ float: left; width: 50%; background: #FDA02E; margin-left: -300px; } #center{ float: left; width: 600px; margin-right: 300px; background: #C8FF98; } #right{ float: left; width: 50%; margin-left: -300px; background: #FDE95E; } </style> </head> <body> <div id="pag"> <div id="left"> Left </div> <div id="center"> Center </div> <div id="right"> Right </div> </div> </body> </html>

    Read the article

  • How to display buttons after enterframe event is over in Corona?

    - by user1463542
    I am trying to display two buttons called countd_again and main_menu after my enterframe event is over. I can't see those buttons after enterframe event is over,though. Can you check my code,please? And also i want to add new addListener for the buttons using director and scene. module(..., package.seeall) function new() local localGroup = display.newGroup(); display.setStatusBar(display.HiddenStatusBar) local background = display.newImage("background.png") start=os.time() cnt=1 local countd_again = display.newImage("yeniden.png") countd_again.x=100 countd_again.y=100 countd_again.isVisible= false; countd_again.alpha=0; countd_again.scene="helloWorld"; local main_menu= display.newImage("anamenu.png") main_menu.x=100 main_menu.y=300 main_menu.isVisible=false; main_menu.alpha=0; main_menu.scene="helloWorld" -- listener function local function onEveryFrame( event ) if (cnt~=0) then cnt= 3-(os.time()-start) minute = math.floor(cnt/60) second=cnt%60 --print(minute,second) minTxt=display.newText(minute,50,50,nil,100) secTxt=display.newText(second,250,50,nil,100) transition.to(minTxt, {time=100, alpha=0}) transition.to(secTxt,{time=100, alpha=0}) else Runtime: removeEventListener("enterFrame",onEveryFrame) countd_again.isVisible=true; main_menu.isVisible=true; transition.to(countd_again,{time=500,alpha=1}); transition.to(main_menu,{time=500,alpha=1}); countd_again: addEventListener("touch", changeScene) main_menu: addEventListener("touch", changeScene) end end -- assign the above function as an "enterFrame" listener Runtime:addEventListener( "enterFrame", onEveryFrame ) function changeScene(e) if(e.phase=="ended") then director:changeScene(e.target.scene); end end countd_again: addEventListener("touch", changeScene) main_menu: addEventListener("touch", changeScene) localGroup: insert(countd_again) localGroup:insert(main_menu) localGroup:insert(background) return localGroup; end

    Read the article

  • rendering a TextView in a Bitmap for an android widget

    - by foke
    I'm building a widget which displays some text. By widget I mean the kind which lies on the desktop. The problem is that I want to change text's font at runtime. There is several textview I would like, at runtime, to set the first as bold, the second blue and italic for example, etc. I came up with this : TextView tv = new TextView(context); tv.setText(stringToDisplay); tv.setTextColor(0xa00050ff); // example tv.setTextSize(30); // example Bitmap b = loadBitmapFromView(tv); updateViews.setImageViewBitmap(R.id.id_of_the_imageview, b); with private static Bitmap loadBitmapFromView(View v) { Bitmap b = Bitmap.createBitmap(v.getLayoutParams().width, v.getLayoutParams().height, Bitmap.Config.ARGB_8888); Canvas c = new Canvas(b); v.layout(0, 0, v.getLayoutParams().width, v.getLayoutParams().height); v.draw(c); return b; } but it wont work (NullPointerException on first line of loadBitmap), until I replace v.getLayoutParams().width, v.getLayoutParams().height by fixed sizes like 250, 50 Bitmap b = Bitmap.createBitmap(250, 50, Bitmap.Config.ARGB_8888); // ... v.layout(0, 0, 250, 50); But that's not a good solution ... so I tried this : LayoutInflater li = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View row = li.inflate(R.layout.widget_text, null); TextView tv = (TextView) row.findViewById(R.id.id_of_the_textview); widget_text being a layout similar to the displayed one but with TextViews instead of ImageViews, in the hope to get some size information out of it .. but it's not working and I get this exception : 01-02 17:35:06.001: ERROR/AndroidRuntime(11025): Caused by: java.lang.IllegalArgumentException: width and height must be > 0 on the call to Bitmap.createBitmap() so, someone could point me in the right direction?

    Read the article

  • Actionscript Removing Display Objects

    - by Chunk1978
    i don't understand why none of my display objects are not being removed. when i press the button, i'm expecting a trace and removal of both shapes and the button, but nothing happens: import fl.controls.Button; var shape1:Shape = new Shape(); shape1.name = "Shape1"; shape1.graphics.lineStyle(4, 0x000000); shape1.graphics.beginFill(0x000055, 0.5); shape1.graphics.drawRoundRect(50, 50, 100, 75, 20, 30); shape1.graphics.endFill(); addChild(shape1); var shape2:Shape = new Shape(); shape2.name = "Shape2"; shape2.graphics.lineStyle(4, 0xFFFF99); shape2.graphics.beginFill(0x550000, 0.5); shape2.graphics.drawRoundRect(100, 75, 200, 175, 50, 10); shape2.graphics.endFill(); addChild(shape2); button1.addEventListener(MouseEvent.CLICK, pushButton); function pushButton(evt:MouseEvent):void { for(var amount:int = numChildren; amount == 0; amount--) { trace(amount); var disObj:DisplayObject = getChildAt(amount); trace("Removing " + disObj.name); removeChildAt(amount); } }

    Read the article

  • How to create a progress bar while downloading a file using the windows API?

    - by Jorge Chayan
    i'm working on an application in MS Visual C++ using Windows API that must download a file and place it in a folder. I have already implemented the download using URLDownloadToFile function, but i want to create a PROGRESS_CLASS progress bar with marquee style while the file is being downloaded, but it doesn't seems to get animated in the process. This is the function I use for downloading: BOOL SOXDownload() { HRESULT hRez = URLDownloadToFile(NULL, "url","C:\\sox.zip", 0, NULL); if (hRez == E_OUTOFMEMORY ) { MessageBox(hWnd, "Out of memory Error","", MB_OK); return FALSE; } if (hRez != S_OK) { MessageBox(hWnd, "Error downloading sox.", "Error!", MB_ICONERROR | MB_SYSTEMMODAL); return FALSE; } if (hRez == S_OK) { BSTR file = SysAllocString(L"C:\\sox.zip"); BSTR folder = SysAllocString(L"C:\\"); Unzip2Folder(file, folder); ::MessageBoxA(hWnd, "Sox Binaries downloaded succesfully", "Success", MB_OK); } return TRUE; } Later I call inside WM_CREATE (in my main window's message processor): if (!fileExists("C:\\SOX\\SOX.exe")) { components[7] = CreateWindowEx(0, PROGRESS_CLASS, NULL, WS_VISIBLE | PBS_MARQUEE, GetSystemMetrics(SM_CXSCREEN) / 2 - 80, GetSystemMetrics(SM_CYSCREEN) / 2 + 25, 200, 50, hWnd, NULL, NULL, NULL); SetWindowText(components[7], "Downloading SoX"); SendMessage(components[7], PBM_SETRANGE, 0, (LPARAM) MAKELPARAM(0, 50)); SendMessage(components[7], PBM_SETMARQUEE, TRUE, MAKELPARAM( 0, 50)); SOXDownload(); SendMessage(components[7], WM_CLOSE, NULL, NULL); } And as I want, I get a tiny progress bar... But it's not animated, and when I place the cursor over the bar, the cursor indicates that the program is busy downloading the file. When the download is complete, the window closes as i requested: SendMessage(components[7], WM_CLOSE, NULL, NULL); So the question is how can I make the bar move while downloading the file? Considering that i want it done with marquee style for simplicity. Thanks in advance.

    Read the article

  • Stored procedure or function expects parameter which is not supplied

    - by user2920046
    I am trying to insert data into a SQL Server database by calling a stored procedure, but I am getting the error Procedure or function 'SHOWuser' expects parameter '@userID', which was not supplied. My stored procedure is called "SHOWuser". I have checked it thoroughly and no parameters is missing. My code is: public void SHOWuser(string userName, string password, string emailAddress, List preferences) { SqlConnection dbcon = new SqlConnection(conn); try { SqlCommand cmd = new SqlCommand(); cmd.Connection = dbcon; cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.CommandText = "SHOWuser"; cmd.Parameters.AddWithValue("@userName", userName); cmd.Parameters.AddWithValue("@password", password); cmd.Parameters.AddWithValue("@emailAddress", emailAddress); dbcon.Open(); int i = Convert.ToInt32(cmd.ExecuteScalar()); cmd.Parameters.Clear(); cmd.CommandText = "tbl_pref"; foreach (int preference in preferences) { cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@userID", Convert.ToInt32(i)); cmd.Parameters.AddWithValue("@preferenceID", Convert.ToInt32(preference)); cmd.ExecuteNonQuery(); } } catch (Exception) { throw; } finally { dbcon.Close(); } and the stored procedure is: ALTER PROCEDURE [dbo].[SHOWuser] -- Add the parameters for the stored procedure here ( @userName varchar(50), @password nvarchar(50), @emailAddress nvarchar(50) ) AS BEGIN INSERT INTO tbl_user(userName,password,emailAddress) values(@userName,@password,@emailAddress) select tbl_user.userID,tbl_user.userName,tbl_user.password,tbl_user.emailAddress, stuff((select ',' + preferenceName from tbl_pref_master inner join tbl_preferences on tbl_pref_master.preferenceID = tbl_preferences.preferenceID where tbl_preferences.userID=tbl_user.userID FOR XML PATH ('')),1,1,' ' ) AS Preferences from tbl_user SELECT SCOPE_IDENTITY(); END Pls help, Thankx in advance...

    Read the article

  • Create an Oracle function that returns a table

    - by Craig
    I'm trying to create a function in package that returns a table. I hope to call the function once in the package, but be able to re-use its data mulitple times. While I know I create temp tables in Oracle, I was hoping to keep things DRY. So far, this is what I have: Header: CREATE OR REPLACE PACKAGE TEST AS TYPE MEASURE_RECORD IS RECORD ( L4_ID VARCHAR2(50), L6_ID VARCHAR2(50), L8_ID VARCHAR2(50), YEAR NUMBER, PERIOD NUMBER, VALUE NUMBER ); TYPE MEASURE_TABLE IS TABLE OF MEASURE_RECORD; FUNCTION GET_UPS( TIMESPAN_IN IN VARCHAR2 DEFAULT 'MONTLHY', STARTING_DATE_IN DATE, ENDING_DATE_IN DATE ) RETURN MEASURE_TABLE; END TEST; Body: CREATE OR REPLACE PACKAGE BODY TEST AS FUNCTION GET_UPS ( TIMESPAN_IN IN VARCHAR2 DEFAULT 'MONTLHY', STARTING_DATE_IN DATE, ENDING_DATE_IN DATE ) RETURN MEASURE_TABLE IS T MEASURE_TABLE; BEGIN SELECT ... INTO T FROM ... ; RETURN T; END GET_UPS; END TEST; The header compiles, the body does not. One error message is 'not enough values', which probably means that I should be selecting into the MEASURE_RECORD, rather than the MEASURE_TABLE. What am I missing?

    Read the article

  • help me to parse JSON value using JSONTouch

    - by EquinoX
    I have the following json: http://www.adityaherlambang.me/webservice.php?user=2&num=10&format=json I would like to get all the name in this data by the following code, but it gives an error. How can I fix it? NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding]; NSDictionary *results = [responseString JSONValue]; NSDictionary *users = [results objectForKey:@"users"] objectForKey:@"user"]; for (NSDictionary *user in users){ //NSLog(@"key:%@, value:%@", user, [user objectForKey:user]); NSString *title = [users objectForKey:@"NAME"]; NSLog(@"%@", title); } Error: 2011-01-29 00:18:50.386 NeighborMe[7763:207] -[__NSArrayM objectForKey:]: unrecognized selector sent to instance 0xb618840 2011-01-29 00:18:50.388 NeighborMe[7763:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayM objectForKey:]: unrecognized selector sent to instance 0xb618840' *** Call stack at first throw: ( 0 CoreFoundation 0x027d9b99 __exceptionPreprocess + 185 1 libobjc.A.dylib 0x0292940e objc_exception_throw + 47 2 CoreFoundation 0x027db6ab -[NSObject(NSObject) doesNotRecognizeSelector:] + 187 3 CoreFoundation 0x0274b2b6 ___forwarding___ + 966 4 CoreFoundation 0x0274ae72 _CF_forwarding_prep_0 + 50 5 NeighborMe 0x0000bd75 -[NeighborListViewController connectionDidFinishLoading:] + 226 6 Foundation 0x0007cb96 -[NSURLConnection(NSURLConnectionReallyInternal) sendDidFinishLoading] + 108 7 Foundation 0x0007caef _NSURLConnectionDidFinishLoading + 133 8 CFNetwork 0x02d8d72f _ZN19URLConnectionClient23_clientDidFinishLoadingEPNS_26ClientConnectionEventQueueE + 285 9 CFNetwork 0x02e58fcf _ZN19URLConnectionClient26ClientConnectionEventQueue33processAllEventsAndConsumePayloadEP20XConnectionEventInfoI12XClientEvent18XClientEventParamsEl + 389 10 CFNetwork 0x02e5944b _ZN19URLConnectionClient26ClientConnectionEventQueue33processAllEventsAndConsumePayloadEP20XConnectionEventInfoI12XClientEvent18XClientEventParamsEl + 1537 11 CFNetwork 0x02d82968 _ZN19URLConnectionClient13processEventsEv + 100 12 CFNetwork 0x02d827e5 _ZN17MultiplexerSource7performEv + 251 13 CoreFoundation 0x027bafaf __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15 14 CoreFoundation 0x0271939b __CFRunLoopDoSources0 + 571 15 CoreFoundation 0x02718896 __CFRunLoopRun + 470 16 CoreFoundation 0x02718350 CFRunLoopRunSpecific + 208 17 CoreFoundation 0x02718271 CFRunLoopRunInMode + 97 18 GraphicsServices 0x030b800c GSEventRunModal + 217 19 GraphicsServices 0x030b80d1 GSEventRun + 115 20 UIKit 0x002e9af2 UIApplicationMain + 1160 21 NeighborMe 0x00001c34 main + 102 22 NeighborMe 0x00001bc5 start + 53 23 ??? 0x00000001 0x0 + 1 ) terminate called after throwing an instance of 'NSException' I really just wanted to be able to iterate through the names

    Read the article

  • Android onFling not responding

    - by Kevin Moore
    I am new to android first of all so think of any newbie mistakes first I am trying to add a fling function in my code. public class MainGamePanel extends SurfaceView implements SurfaceHolder.Callback, OnGestureListener { private MainThread thread; private Droid droid; private Droid droid2; private static final String TAG = gameView.class.getSimpleName(); private GestureDetector gestureScanner; public MainGamePanel(Context context){ super(context); getHolder().addCallback(this); droid = new Droid(BitmapFactory.decodeResource(getResources(), R.drawable.playerbox2), 270, 300); droid2 = new Droid(BitmapFactory.decodeResource(getResources(), R.drawable.playerbox2), 50, 300); thread = new MainThread(getHolder(), this); setFocusable(true); gestureScanner = new GestureDetector(this); } public boolean onTouchEvent(MotionEvent event){ return gestureScanner.onTouchEvent(event); } @Override protected void onDraw(Canvas canvas){ canvas.drawColor(Color.BLACK); droid.draw(canvas); droid2.draw(canvas); } @Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { droid.setX(50); droid.setY(50); Log.d(TAG, "Coords: x=" + e1.getX() + ",y=" + e2.getY()); return true; } @Override public boolean onDown(MotionEvent e) { droid2.setX((int)e.getX()); droid2.setY((int)e.getY()); Log.d(TAG, "Coords: x=" + e.getX() + ",y=" + e.getY()); return false; } I got the gestureListener to work with: onDown, onLongPress, and onShowPress. But i can't get any response with onFling, onSingleTapUp, and onScroll. What mistake am I making? does it have to do with views? I don't know what code would be useful to see.... so any suggestions would be much appreciated. Thank You!

    Read the article

  • ActionScripting Issue: adding/removing children

    - by user1890698
    I have three movie clips all linked to the stage and I want them to behave like a button/ But I am not using a button because I have not found a way to have each part (up, over, down, hit) be animated and not just change when the mouse is in use with it. So far I have been able to have all three appear on my stage and show when I have the mouse over and as well when I click, but I think I'm doing something wrong with removeChild. Each MC should appear one at a time and now all three show up when I hover over and seem to "flash". Here's my code: var mainMoon:swayingMoon = new swayingMoon(); mainMoon.x = 50; mainMoon.y = 10; addChild(mainMoon); var hoverMoon:glowMoon = new glowMoon(); hoverMoon.x = 50; hoverMoon.y = 10; var movieMoon:clickedMoon = new clickedMoon(); movieMoon.x = 50; movieMoon.y = 10; mainMoon.addEventListener(MouseEvent.ROLL_OVER, showHoverMoon); mainMoon.addEventListener(MouseEvent.ROLL_OUT, hideHoverMoon); hoverMoon.addEventListener(MouseEvent.CLICK, startMovieMoon) function showHoverMoon(event:MouseEvent):void { addChild(hoverMoon); } function hideHoverMoon(event:MouseEvent):void { removeChild(hoverMoon) } function startMovieMoon(event:MouseEvent):void { addChild(movieMoon); }

    Read the article

  • The best way to return related data in a SQL statement

    - by Darvis Lombardo
    I have a question on the best method to get back to a piece of data that is in a related table on the other side of a many-to-many relationship table. My first method uses joins to get back to the data, but because there are multiple matching rows in the relationship table, I had to use a TOP 1 to get a single row result. My second method uses a subquery to get the data but this just doesn't feel right. So, my question is, which is the preferred method, or is there a better method? The script needed to create the test tables, insert data, and run the two queries is below. Thanks for your advice! Darvis -------------------------------------------------------------------------------------------- -- Create Tables -------------------------------------------------------------------------------------------- DECLARE @TableA TABLE ( [A_ID] [int] IDENTITY(1,1) NOT NULL, [Description] [varchar](50) NULL) DECLARE @TableB TABLE ( [B_ID] [int] IDENTITY(1,1) NOT NULL, [A_ID] [int] NOT NULL, [Description] [varchar](50) NOT NULL) DECLARE @TableC TABLE ( [C_ID] [int] IDENTITY(1,1) NOT NULL, [Description] [varchar](50) NOT NULL) DECLARE @TableB_C TABLE ( [B_ID] [int] NOT NULL, [C_ID] [int] NOT NULL) -------------------------------------------------------------------------------------------- -- Insert Test Data -------------------------------------------------------------------------------------------- INSERT INTO @TableA VALUES('A-One') INSERT INTO @TableA VALUES('A-Two') INSERT INTO @TableA VALUES('A-Three') INSERT INTO @TableB (A_ID, Description) VALUES(1,'B-One') INSERT INTO @TableB (A_ID, Description) VALUES(1,'B-Two') INSERT INTO @TableB (A_ID, Description) VALUES(1,'B-Three') INSERT INTO @TableB (A_ID, Description) VALUES(2,'B-Four') INSERT INTO @TableB (A_ID, Description) VALUES(2,'B-Five') INSERT INTO @TableB (A_ID, Description) VALUES(3,'B-Six') INSERT INTO @TableC VALUES('C-One') INSERT INTO @TableC VALUES('C-Two') INSERT INTO @TableC VALUES('C-Three') INSERT INTO @TableB_C (B_ID, C_ID) VALUES(1, 1) INSERT INTO @TableB_C (B_ID, C_ID) VALUES(2, 1) INSERT INTO @TableB_C (B_ID, C_ID) VALUES(3, 1) -------------------------------------------------------------------------------------------- -- Get result - method 1 -------------------------------------------------------------------------------------------- SELECT TOP 1 C.*, A.Description FROM @TableC C JOIN @TableB_C BC ON BC.C_ID = C.C_ID JOIN @TableB B ON B.B_ID = BC.B_ID JOIN @TableA A ON B.A_ID = A.A_ID WHERE C.C_ID = 1 -------------------------------------------------------------------------------------------- -- Get result - method 2 -------------------------------------------------------------------------------------------- SELECT C.*, (SELECT A.Description FROM @TableA A WHERE EXISTS (SELECT * FROM @TableB_C BC JOIN @TableB B ON B.B_ID = BC.B_ID WHERE BC.C_ID = C.C_ID AND B.A_ID = A.A_ID)) FROM @TableC C WHERE C.C_ID = 1

    Read the article

  • Is this a bad indexing strategy for a table?

    - by llamaoo7
    The table in question is part of a database that a vendor's software uses on our network. The table contains metadata about files. The schema of the table is as follows Metadata ResultID (PK, int, not null) MappedFieldname (char(50), not null) Fieldname (PK, char(50), not null) Fieldvalue (text, null) There is a clustered index on ResultID and Fieldname. This table typically contains millions of rows (in one case, it contains 500 million). The table is populated by 24 workers running 4 threads each when data is being "processed". This results in many non-sequential inserts. Later after processing, more data is inserted into this table by some of our in-house software. The fragmentation for a given table is at least 50%. In the case of the largest table, it is at 90%. We do not have a DBA. I am aware we desperately need a DB maintenance strategy. As far as my background, I'm a college student working part time at this company. My question is this, is a clustered index the best way to go about this? Should another index be considered? Are there any good references for this type and similar ad-hoc DBA tasks?

    Read the article

  • Vertically And Horizonatally center main wrap div

    - by Hello you all men
    Now i try <html> <head> <title>?????????????????</title> <style type="text/css"> body { margin-left: auto; margin-right:auto; } #wrap { background: black; margin-left: auto; margin-right:auto; height:450px; width:450px; position:absolute; top:50%; right:50%; left:50%; margin-top:-225px; } </style> </head> <body> <div id="wrap"> Hello </div> </body> </html> ?????

    Read the article

< Previous Page | 43 44 45 46 47 48 49 50 51 52 53 54  | Next Page >