Daily Archives

Articles indexed Saturday April 3 2010

Page 18/78 | < Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >

  • Loading a page into memory in Rails

    - by titaniumdecoy
    My rails app produces XML when I load /reports/generate_report.xml. On a separate page, I want to read this XML into a variable and save it to the database. How can I do this? Can I somehow stream the response from the /reports/generate_report.xml URI into a variable? Or is there a better way to do it since the XML is produced by the same web app?

    Read the article

  • how to write an artificial request.

    - by Bunny Rabbit
    how can i construct a artificial request to login to twitter or any site for that matter that accpets post forms. what i've been trying is to extract the headers and post request parameters from the origional request(directed at the action atribute of the form) and copy it to the outgoing url object that i am making.but it just won't work. And i am aware of the apis and i don't wanna use them i am trying this to write a web proxy site.

    Read the article

  • how can we count the time interval of the animation in cocos2d ?

    - by srikanth rongali
    Hi, I am doing my program in cocos2d. I am using NSDate to get the current time of the start of animation. And I know my animation takes 3 seconds. So I can get the time at completion of animation by using NSInterval and using the previous time and animation time. But, if If the animation time interval is not fixed how can I calculate the time interval of the animation and time at the completion of the animation ? I am animating a sprite. Please help how can I make it. Thank You.

    Read the article

  • ASP.NET and VB.NET OleDbConnection Problem

    - by Matt
    I'm working on an ASP.NET website where I am using an asp:repeater with paging done through a VB.NET code-behind file. I'm having trouble with the database connection though. As far as I can tell, the paging is working, but I can't get the data to be certain. The database is a Microsoft Access database. The function that should be accessing the database is: Dim pagedData As New PagedDataSource Sub Page_Load(ByVal obj As Object, ByVal e As EventArgs) doPaging() End Sub Function getTheData() As DataTable Dim DS As New DataSet() Dim strConnect As New OleDbConnection("Provider = Microsoft.Jet.OLEDB.4.0;Data Source=App_Data/ArtDatabase.mdb") Dim objOleDBAdapter As New OleDbDataAdapter("SELECT ArtID, FileLocation, Title, UserName, ArtDate FROM Art ORDER BY Art.ArtDate DESC", strConnect) objOleDBAdapter.Fill(DS, "Art") Return DS.Tables("Art").Copy End Function Sub doPaging() pagedData.DataSource = getTheData().DefaultView pagedData.AllowPaging = True pagedData.PageSize = 2 Try pagedData.CurrentPageIndex = Int32.Parse(Request.QueryString("Page")).ToString() Catch ex As Exception pagedData.CurrentPageIndex = 0 End Try btnPrev.Visible = (Not pagedData.IsFirstPage) btnNext.Visible = (Not pagedData.IsLastPage) pageNumber.Text = (pagedData.CurrentPageIndex + 1) & " of " & pagedData.PageCount ArtRepeater.DataSource = pagedData ArtRepeater.DataBind() End Sub The ASP.NET is: <asp:Repeater ID="ArtRepeater" runat="server"> <HeaderTemplate> <h2>Items in Selected Category:</h2> </HeaderTemplate> <ItemTemplate> <li> <asp:HyperLink runat="server" ID="HyperLink" NavigateUrl='<%# Eval("ArtID", "ArtPiece.aspx?ArtID={0}") %>'> <img src="<%# Eval("FileLocation") %>" alt="<%# DataBinder.Eval(Container.DataItem, "Title") %>t"/> <br /> <%# DataBinder.Eval(Container.DataItem, "Title") %> </asp:HyperLink> </li> </ItemTemplate> </asp:Repeater>

    Read the article

  • Handle existing instance of root activity when launching root activity again from intent filter

    - by Robert
    Hi, I'm having difficulties handling multiple instances of my root (main) activity for my application. My app in question has an intent filter in place to launch my application when opening an email attatchment from the "Email" app. My problem is if I launch my application first through the the android applications screen and then launch my application via opening the Email attachment it creates two instances of my root activity. steps: Launch root activity A, press home Open email attachment, intent filter triggers launches root activity A Is it possible when opening the Email attachment that when the OS tries to launch my application it detects there is already an instance of it running and use that or remove/clear that instance?

    Read the article

  • ASP.NET Nested Repeater Accessing elements

    - by Rich
    I have a list of Accommodation objects bound to a Repeater, and then a nested Repeater which has the various attendee groups listed [e.g. Default, Seniors, Juniors]. This is all output fine, with the values displayed as LinkButtons, which when clicked gets sent to a code-behind event handler. Here is an example of the output to give you a picture [with some er... interesting attendee group names]: In the event handler, I test the object parameter to see which Repeater has been sent, as the outer repeater's links can also be clicked [so the Accommodation would be set, but no Attendee Group]. Is there a way to get a HiddenField from the outer RepeaterItem that contains the currently clicked inner repeater's LinkButton? E.g. From the image, I click the Attending link in the Women section. So the EventArgs via FindControl can get me the hidden field which contains the Attendee Group's ID, which is good, but I also need the Accommodation ID [to know whether it was either Wimbledon Hotel Inn or New Acc]

    Read the article

  • How to know the ordinal position of an ItemTemplate

    - by Gaizka
    Need to add styles (class="bBot") to the first ItemTemplate item, how do I know it's the first? <asp:Repeater id="ArticlesRepeater" runat="server"> <HeaderTemplate> <div class="FR boxW380"> <div class="cnt mag"> <div class="FR"> <a href="#">Subscribe</a> &#160; &#160; <a href="#">Archive</a> </div> <h1>Magazine</h1> </HeaderTemplate> <ItemTemplate> <div> <a href="#"> <img class="visu" alt="" src="<%# DataBinder.Eval(Container.DataItem, "image") %> " /> <span class="title"> <%# DataBinder.Eval(Container.DataItem, "title") %> </span> <span class="content"> <%# DataBinder.Eval(Container.DataItem, "shortintroduction")%> </span> </a> <div class="CB"></div> </div> </ItemTemplate> <FooterTemplate> </div> </div> </FooterTemplate> </asp:Repeater>

    Read the article

  • Override an IOCTL Handler in PQOAL

    - by Kate Moss' Big Fan
    When porting or creating a BSP to a new platform, we often need to make change to OEMIoControl or HAL IOCTL handler for more specific. Since Microsoft introduced PQOAL in CE 5.0 and more and more BSP today leverages PQOAL to simplify the OAL, we no longer define the OEMIoControl directly. It is somehow analogous to migrate from pure Windows SDK to MFC; people starts to define those MFC handlers and forgot the WinMain and the big message loop. If you ever take a look at the interface between OAL and Kernel, PUBLIC\COMMON\OAK\INC\oemglobal.h, the pfnOEMIoctl is still there just as the entry point of Windows Program is WinMain since day one. (For those may argue about pfnOEMIoctl is not OEMIoControl, I will encourage you to dig into PRIVATE\WINCEOS\COREOS\NK\OEMMAIN\oemglobal.c which initialized pfnOEMIoctl to OEMIoControl. The interface is just to split OAL and Kernel which no longer linked to one executable file in CE 6, all of the function signature is still identical) So let's trace into PQOAL to realize how it implements OEMIoControl and how can we override an IOCTL handler we interest. First thing to know is the entry point (just as finding the WinMain in MFC), OEMIoControl is defined in PLATFORM\COMMON\SRC\COMMON\IOCTL\ioctl.c. Basically, it does nothing special but scan a pre-defined IOCTL table, g_oalIoCtlTable, and then execute the handler. (The highlight part) Other than that is just for error handling and the use of critical section to serialize the function. BOOL OEMIoControl(     DWORD code, VOID *pInBuffer, DWORD inSize, VOID *pOutBuffer, DWORD outSize,     DWORD *pOutSize ) {     BOOL rc = FALSE;     UINT32 i; ...     // Search the IOCTL table for the requested code.     for (i = 0; g_oalIoCtlTable[i].pfnHandler != NULL; i++) {         if (g_oalIoCtlTable[i].code == code) break;     }     // Indicate unsupported code     if (g_oalIoCtlTable[i].pfnHandler == NULL) {         NKSetLastError(ERROR_NOT_SUPPORTED);         OALMSG(OAL_IOCTL, (             L"OEMIoControl: Unsupported Code 0x%x - device 0x%04x func %d\r\n",             code, code >> 16, (code >> 2)&0x0FFF         ));         goto cleanUp;     }            // Take critical section if required (after postinit & no flag)     if (         g_ioctlState.postInit &&         (g_oalIoCtlTable[i].flags & OAL_IOCTL_FLAG_NOCS) == 0     ) {         // Take critical section                    EnterCriticalSection(&g_ioctlState.cs);     }     // Execute the handler     rc = g_oalIoCtlTable[i].pfnHandler(         code, pInBuffer, inSize, pOutBuffer, outSize, pOutSize     );     // Release critical section if it was taken above     if (         g_ioctlState.postInit &&         (g_oalIoCtlTable[i].flags & OAL_IOCTL_FLAG_NOCS) == 0     ) {         // Release critical section                    LeaveCriticalSection(&g_ioctlState.cs);     } cleanUp:     OALMSG(OAL_IOCTL&&OAL_FUNC, (L"-OEMIoControl(rc = %d)\r\n", rc ));     return rc; }   Where is the g_oalIoCtlTable? It is defined in your BSP. Let's use DeviceEmulator BSP as an example. The PLATFORM\DEVICEEMULATOR\SRC\OAL\OALLIB\ioctl.c defines the table as const OAL_IOCTL_HANDLER g_oalIoCtlTable[] = { #include "ioctl_tab.h" }; And that leads to PLATFORM\DEVICEEMULATOR\SRC\INC\ioctl_tab.h which defined some of IOCTL handler but others are defined in oal_ioctl_tab.h which is under PLATFORM\COMMON\SRC\INC\. Finally, we got the full table body! (Just like tracing MFC, always jumping back and forth). The format of table is very straight forward, IOCTL code, Flags and Handler Function // IOCTL CODE,                          Flags   Handler Function //------------------------------------------------------------------------------ { IOCTL_HAL_INITREGISTRY,                   0,  OALIoCtlHalInitRegistry     }, { IOCTL_HAL_INIT_RTC,                       0,  OALIoCtlHalInitRTC          }, { IOCTL_HAL_REBOOT,                         0,  OALIoCtlHalReboot           }, The PQOAL scans through the table until it find a matched IOCTL code, then invokes the handler function. Since it scans the table from the top which means if we define TWO handler with same IOCTL code, the first one is always invoked with no exception. Now back to the PLATFORM\DEVICEEMULATOR\SRC\INC\ioctl_tab.h, with the following table { IOCTL_HAL_INITREGISTRY,                   0,  OALIoCtlDeviceEmulatorHalInitRegistry     }, ... #include <oal_ioctl_tab.h> Note the IOCTL_HAL_INITREGISTRY handler are defined in both BSP's local ioctl_tab.h and the common oal_ioctl_tab.h, but due to BSP's local handler comes before "#include <oal_ioctl_tab.h>" so we know the OALIoCtlDeviceEmulatorHalInitRegistry always get called. In this example, the DeviceEmulator BSP overrides the IOCTL_HAL_INITREGISTRY handler from OALIoCtlHalInitRegistry to OALIoCtlDeviceEmulatorHalInitRegistry by manipulating the g_oalIoCtlTable table. (In some point of view, it is similar to message map in MFC) Please be aware, when you override an IOCTL handler in PQOAL, you may want to clone the original implementation to your BSP and change to meet your need. It is recommended and save you the redundant works but remember to rename the handler function (Just like the DeviceEmulator it changes the name of OALIoCtlHalInitRegistry to OALIoCtlDeviceEmulatorHalInitRegistry). If you don't change the name, linker may not be happy (due to name conflict) and the more important is by using different handler name, you could always redirect the handler back to original one. (It is like the concept of OOP that calling a function in base class; still not so clear? I am goinf to show you soon!) The OALIoCtlDeviceEmulatorHalInitRegistry setups DeviceEmulator specific registry settings and in the end, if everything goes well, it calls the OALIoCtlHalInitRegistry (PLATFORM\COMMON\SRC\COMMON\IOCTL\reginit.c) to do the rest.     if(fOk) {         fOk = OALIoCtlHalInitRegistry(code, pInpBuffer, inpSize, pOutBuffer,             outSize, pOutSize);     } Now you got the picture, whenever you want to override an IOCTL hadnler that is implemented in PQOAL just Clone the handler function to your BSP as a template. Simple name change for the handler function, and a name change in the IOCTL table header file that maps the IOCTL with the function Implement your IOCTL handler and whenever you need to redirect it back just calling the original handler function. It is the standard way of implementing a custom IOCTL and most Microsoft developers prefer. The mapping of IOCTL routine to IOCTL code is platform specific - you control the header file that does that mapping.

    Read the article

  • MVC2 IModelBinder and parsing a string to an object - How do I do it?

    - by burnt_hand
    I have an object called Time public class Time{ public int Hour {get;set;} public int Minute {get;set;} public static Time Parse(string timeString){ //reads the ToString()'s previous output and returns a Time object } override protected string ToString(){ //puts out something like 14:50 (as in 2:50PM) } } So what I want is for the automatic model binding on the Edit or Create action to set this Time instance up from a string (i.e. feed the Parse method with the string and return the result). The reason I am doing this is that I will have a DropDownList with selectable times. The value of each option will be the parser readable string. Can anyone provide an example BindModel method from the IModelBinder interface?

    Read the article

  • Read a local file

    - by user246114
    Hi, Is there no way for javascript hosted on a webserver to read a file on a client's local machine? (this has obvious security risks). I guess I'm wondering if there's any access granting a user can do, like drag and dropping a file into the browser, or explicitly selecting a file from a popup to get around this? I know flash 10 allows reading of a local file, just wondering if there were any method to do this in javascript. Thanks

    Read the article

  • ASP.NET MVC - Data Annotations - Why add a default RequiredAttribute?

    - by redsquare
    Can anyone explain why it is assumed that a non nullable type property should always have a RequiredAttribue? I am trying to write a label helper that will auto append * or change the css class so that I can indicate to the user that the field is required. However when querying the metadata the non nullable properties end up with a required attribute. MVC Source Code: protected override IEnumerable<ModelValidator> GetValidators( ModelMetadata metadata, ControllerContext context, IEnumerable<Attribute> attributes) { _adaptersLock.EnterReadLock(); try { List<ModelValidator> results = new List<ModelValidator>(); if (metadata.IsRequired && !attributes.Any(a => a is RequiredAttribute)) { //******* Why Do this? attributes = attributes.Concat(new[] { new RequiredAttribute() }); } foreach (ValidationAttribute attribute in attributes.OfType<ValidationAttribute>()) { DataAnnotationsModelValidationFactory factory; if (!_adapters.TryGetValue(attribute.GetType(), out factory)) factory = _defaultFactory; results.Add(factory(metadata, context, attribute)); } return results; } finally { _adaptersLock.ExitReadLock(); } }

    Read the article

  • Why we used double pointer in objective-C or C language?

    - by Rajendra Bhole
    Hi, I confused when i want to take single pointer and when should i take double pointer? In following structure what exactly did? struct objc_class { Class isa; Class super_class; const char *name; long version; long info; long instance_size; struct objc_ivar_list *ivars; struct objc_method_list **methodLists; struct objc_cache *cache; struct objc_protocol_list *protocols; }; Why we use the "**methodLists" double pointer?

    Read the article

  • stack overflow problem in program

    - by Jay
    So I am currently getting a strange stack overflow exception when i try to run this program, which reads numbers from a list in a data/text file and inserts it into a binary search tree. The weird thing is that when the program works when I have a list of 4095 numbers in random order. However when i have a list of 4095 numbers in increasing order (so it makes a linear search tree), it throws a stack overflow message. The problem is not the static count variable because even when i removed it, and put t=new BinaryNode(x,1) it still gave a stack overflow exception. I tried debugging it, and it broke at if (t == NULL){ t = new BinaryNode(x,count); Here is the insert function. BinaryNode *BinarySearchTree::insert(int x, BinaryNode *t) { static long count=0; count++; if (t == NULL){ t = new BinaryNode(x,count); count=0; } else if (x < t->key){ t->left = insert(x, t->left); } else if (x > t->key){ t->right = insert(x, t->right); } else throw DuplicateItem(); return t; }

    Read the article

  • Windows Server 2003 Hacked - Files Being Uploaded

    - by jreedinc
    Blank directories are being created on my Windows Server 2003 virtual server with sub directories that are weird (for example: "88ÿ ÿ ÿÿþþ þþ13þ"). It looks like they are uploading bootlegged DVDs and pirated software. All of my bandwidth and file space is being eaten up. Could this be a shared permissions issue? Where should I look to further investigate this? My security permissions for the directory that is being hit are as followed: Administrators - ALL GRANTED IIS_WPG - Read & Execute, List Folder Contents, Read Internet Guest - DENY SYSTEM - ALL GRANTED Users - Read & Execute, List Folder Contents, Read My Event Viewer is showing many Logon/Logoff with NO IP?

    Read the article

  • ASP.NET OleDbConnection Problem

    - by Matt
    I'm working on an ASP.NET website where I am using an asp:repeater with paging done through a VB.NET code-behind file. I'm having trouble with the database connection though. As far as I can tell, the paging is working, but I can't get the data to be certain. The database is a Microsoft Access database. The function that should be accessing the database is: Dim pagedData As New PagedDataSource Sub Page_Load(ByVal obj As Object, ByVal e As EventArgs) doPaging() End Sub Function getTheData() As DataTable Dim DS As New DataSet() Dim strConnect As New OleDbConnection("Provider = Microsoft.Jet.OLEDB.4.0;Data Source=App_Data/ArtDatabase.mdb") Dim objOleDBAdapter As New OleDbDataAdapter("SELECT ArtID, FileLocation, Title, UserName, ArtDate FROM Art ORDER BY Art.ArtDate DESC", strConnect) objOleDBAdapter.Fill(DS, "Art") Return DS.Tables("Art").Copy End Function Sub doPaging() pagedData.DataSource = getTheData().DefaultView pagedData.AllowPaging = True pagedData.PageSize = 2 Try pagedData.CurrentPageIndex = Int32.Parse(Request.QueryString("Page")).ToString() Catch ex As Exception pagedData.CurrentPageIndex = 0 End Try btnPrev.Visible = (Not pagedData.IsFirstPage) btnNext.Visible = (Not pagedData.IsLastPage) pageNumber.Text = (pagedData.CurrentPageIndex + 1) & " of " & pagedData.PageCount ArtRepeater.DataSource = pagedData ArtRepeater.DataBind() End Sub The ASP.NET is: <asp:Repeater ID="ArtRepeater" runat="server"> <HeaderTemplate> <h2>Items in Selected Category:</h2> </HeaderTemplate> <ItemTemplate> <li> <asp:HyperLink runat="server" ID="HyperLink" NavigateUrl='<%# Eval("ArtID", "ArtPiece.aspx?ArtID={0}") %>'> <img src="<%# Eval("FileLocation") %>" alt="<%# DataBinder.Eval(Container.DataItem, "Title") %>t"/> <br /> <%# DataBinder.Eval(Container.DataItem, "Title") %> </asp:HyperLink> </li> </ItemTemplate> </asp:Repeater>

    Read the article

  • Changing color of the titlebar, background and text of MFMailComposeViewController

    - by iSharreth
    I am sending email from my iPhone application. Everything working fine, but I want to change the color of the title bar that appears from blue to black and the background color from white to black. Also, all the text to white color. What should I do? Anyone please help! I used the below code: (IBAction)sendMail{ MFMailComposeViewController *mailComposer = [[MFMailComposeViewController alloc]init]; mailComposer.mailComposeDelegate = self; if([MFMailComposeViewController canSendMail]){ [mailComposer setToRecipients: [NSArray arrayWithObjects:@"[email protected]",nil]]; [mailComposer setSubject: nil]; [mailComposer setMessageBody: nil isHTML:NO]; [self presentModalViewController:mailComposer animated: YES]; }

    Read the article

  • @user.posts.where('status = ?', :unfinished).all returns []

    - by Cheng
    By @user.posts, I can see there is a post with :unfinished status. But @user.posts.where('status = ?', :unfinished).all returns an empty array. I've tried to invoke @user.reload first, but it doesn't resolve the problem. (rdb:568) @user.posts [#<Post id: 1, content: "hehe", user_id: 1, created_at: "2010-04-03 06:16:47", updated_at: "2010-04-03 06:16:47", status: "--- :unfinished\n">] (rdb:568) @user.posts.where('status = ?', :unfinished).all []

    Read the article

  • How to get the Time value from datetime picker

    - by Ranjana
    how to get the time value in a stored procedure form datepicker value i.e i have a datetime picker value stored into my table as '2010-04-06 09:00:00.000' '2010-04-07 14:30:00.000' i have got the date sepeartely using convert(varchar,Date,3) as Date.. i have got the time seperately using convert(time,Time) but it show the values as 9:00 , 14:30 i need it to show as 9.00 am and 2.30pm instead of 14.30. How to achieve this????????? and help??????

    Read the article

  • Spelling correction for data normalization in Java

    - by dareios
    I am looking for a Java library to do some initial spell checking / data normalization on user generated text content, imagine the interests entered in a Facebook profile. This text will be tokenized at some point (before or after spell correction, whatever works better) and some of it used as keys to search for (exact match). It would be nice to cut down misspellings and the like to produce more matches. It would be even better if the correction would perform well on tokens longer than just one word, e.g. "trinking coffee" would become "drinking coffee" and not "thinking coffee". I found the following Java libraries for doing spelling correction: JAZZY does not seem to be under active development. Also, the dictionary-distance based approach seems inadequate because of the use of non-standard language in social network profiles and multi-word tokens. APACHE LUCENE seems to have a statistical spell checker that should be much more suited. Question here would how to create a good dictionary? (We are not using Lucene otherwise, so there is no existing index.) Any suggestions are welcome!

    Read the article

  • Delphi, ImageList that handles BOTH png and bitmaps.

    - by michal
    Recently I've found TPngImageList component ( http://cc.embarcadero.com/Item/26127 ) which is very good, but it handles only png images ... I'd like to have some imagelist that allows combining of pngimages with bitmaps, as I'm using lots of bitmaps, and I do not want to spend coming week converting those bitmaps to pngs, yet I want to use be able to add PNG images for coming features ... So far I used to convert the PNGs to bitmaps using GIMP if I wasn't able to find any replacement.

    Read the article

  • Sudden restart when Ubuntu almost loaded from disc.

    - by Wesley
    Hi all, Here are the specs beforehand: ECS K7SEM motherboard AMD Duron 900MHz 2x 256MB PC133 SDRAM The Best Power MT-500P 500W PSU Integrated graphics No hard drive DVD-ROM - will update with brand & model Now, I was starting up this machine after it was left outside for 3 months in winter weather. (I got this from a friend.) I was able to get it started and tried to load Ubuntu from the DVD-ROM. It was fairly successful and got up to the point when the Ubuntu logo is glowing. However, when Ubuntu was about to go to the main screen, the computer crashed and automatically rebooted. Is there any reason why this is happening? Also, I should mention that when I try to hit Delete on the BIOS screen to go to Setup, it only shows a screen with four lines saying something Novell something... I will edit with exact lines. Should I be resetting the BIOS or something? Thanks in advance.

    Read the article

< Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >