Daily Archives

Articles indexed Sunday December 26 2010

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

  • about c# OBJECTS and the Possibilties it has.

    - by user527825
    As a novice programmer and i always wonder about c# capabilities.i know it is still early to judge that but all i want to know is can c# do complex stuffs or something outside windows OS. 1- I think c# is a proprietary language (i don't know if i said that right) meaning you can't do it outside visual studio or windows. 2-also you cant create your own controller(called object right?) like you are forced to use these available in toolbox and their properties and methods. 3-can c# be used with openGL API or DirectX API . 4-Finally it always bothers me when i think i start doing things in visual studio, i know it sounds arrogant to say but sometimes i feel that i don't like to be forced to use something even if its helpful, like i feel (do i have the right to feel?) that i want to do all things by myself? don't laugh i just feel that this will give me a better understanding. 5- is visual c# is like using MaxScript inside 3ds max in that c# is exclusive to do windows and forms and components that are windows related and maxscript is only for 3d editing and manipulation for various things in the software. If it is too difficult for a beginner i hope you don't answer the fourth question as i don't have enough motivation and i want to keep the little i have. thank you for your time. Note: 1-sorry for my English, i am self taught and never used the language with native speakers so expect so errors. 2-i have a lot of questions regarding many things, what is the daily ratio you think for asking (number of questions) that would not bother the admins of the site and the members here. thank you for your time.

    Read the article

  • why this signal handler is called infinitely

    - by lz_prgmr
    I am using Mac OS 10.6.5, g++ 4.2.1. And meet problem with following code: #include <iostream> #include <sys/signal.h> using namespace std; void segfault_handler(int signum) { cout << "segfault caught!!!\n"; } int main() { signal(SIGSEGV, segfault_handler); int* p = 0; *p = 100; return 1; } It seems the segfault_handler is called infinitely and keep on print: segfault caught!!! segfault caught!!! segfault caught!!! ... I am new to Mac development, do you have any idea on what happened?

    Read the article

  • How to get updated automatically WPF TreeViewItems with values based on .Net class properties?

    - by ProgrammerManiac
    Good morning. I have a class with data derived from InotifyPropertyChange. The data come from a background thread, which searches for files with certain extension in certain locations. Public property of the class reacts to an event OnPropertyChange by updating data in a separate thread. Besides, there are described in XAML TreeView, based on HierarhicalDataTemplates. Each TextBlock inside templates supplied ItemsSource = "{Binding FoundFilePaths, Mode = OneWay, NotifyOnTargetUpdated = True}". enter code here <HierarchicalDataTemplate DataType = "{x:Type lightvedo:FilesInfoStore}" ItemsSource="{Binding FoundFilePaths, Mode=OneWay, NotifyOnTargetUpdated=True}"> <!--????? ??????????? ???? ??????--> <StackPanel x:Name ="TreeNodeStackPanel" Orientation="Horizontal"> <TextBlock Margin="5,5,5,5" TargetUpdated="TextBlockExtensions_TargetUpdated"> <TextBlock.Text> <MultiBinding StringFormat="Files with Extension {0}"> <Binding Path="FileExtension"/> </MultiBinding> </TextBlock.Text> </TextBlock> <Button x:Name="OpenFolderForThisFiles" Click="OnOpenFolderForThisFiles_Click" Margin="5, 3, 5, 3" Width="22" Background="Transparent" BorderBrush="Transparent" BorderThickness="0.5"> <Image Source="images\Folder.png" Height="16" Width="20" > </Image> </Button> </StackPanel> </HierarchicalDataTemplate> <HierarchicalDataTemplate DataType="{x:Type lightvedo:FilePathsStore}"> <TextBlock Text="{Binding FilePaths, Mode=OneWay, NotifyOnTargetUpdated=True}" TargetUpdated="OnTreeViewNodeChildren_Update" /> </HierarchicalDataTemplate> </TreeView.Resources> <TreeView.RenderTransform> <TransformGroup> <ScaleTransform/> <SkewTransform AngleX="-0.083"/> <RotateTransform/> <TranslateTransform X="-0.249"/> </TransformGroup> </TreeView.RenderTransform> <TreeView.BorderBrush> <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5"> <GradientStop Color="#FF74591F" Offset="0" /> <GradientStop Color="#FF9F7721" Offset="1" /> <GradientStop Color="#FFD9B972" Offset="0.49" /> </LinearGradientBrush> </TreeView.BorderBrush> </TreeView> Q: Why is the data from a class derived from INotifyPropertyChange does not affect the display of tree items. Do I understand: The interface will make INotifyPropertyChange be automatically redrawn TreeViewItems or do I need to manually carry out this operation? Currently TreeViewItems not updated and PropertyChamged always null. A feeling that no subscribers to the event OnPropertyChanged.

    Read the article

  • Simple URL rewrite, not redirect, with .htaccess

    - by Ron
    I'm pretty inexperienced with .htaccess so please bear with me. I have a domain - "http://www.exampletest.com" which redirects to a folder at a different domain where I have hosting i.e: "http://www.differenturl.com/exampletest" Is there an easy mod_rewrite rule where I could have anything at "http://www.differenturl.com/exampletest" show up as "http://www.exampletest.com?" An example would be: "http://www.differenturl.com/exampletest/user.php" - "http://www.exampletest.com/user.php" Any assistance is greatly appreciated. I assume this easy so sorry to ask such a basic question. Thanks

    Read the article

  • Running Different Modules on Tomcat/Server

    - by umesh awasthi
    Hi All, I have started working on my own project idea but on the starting i have strucked in the structure decision may be lack of knowledge is the promary factor. i am wondering how we can make 2 different modules to co-operate on the server.Here is is explanation of what i am trying to ask as per my design i need 2 modules for my application 1. Back end handling where i can do all content handling as well as other admin task a console which will be capable of handling everything from ceating importing contents to everything. 2 USer end which is only an interface to the end user to use the application. to visualize the things its kinda e-commerce application one is back office management and other is user end of web-shop. since these two module will be very much interlinked but i don't want them to mix up i want them to develop independently since admin is one which is core and it will also going to serve user interface. my question is how i can develop two module independently but on the other hand i want them to co-operate to accomplish the task as a whole. Really sorry in advance if i am not making any sense. Thanks in advance

    Read the article

  • HTTPS post - what I'm doing wrong?

    - by evilone
    Hi, I'm making requests to the webaddress to get XML files throught the HTTPS connection. But this connection works like 50%. In most cases it fails. Usual error is "socket error #10060". Or "Error connecting with SSL. EOF was observed that violates the protocol". What I'm doing wrong? function SendRequest(parameters: string): IXMLDocument; var sPostData: TStringList; sHttpSocket: TIdHTTP; sshSocketHandler: TIdSSLIOHandlerSocketOpenSSL; resStream: TStringStream; xDoc: IXMLDocument; begin sPostData := TStringList.Create; try sPostData.Add('add some parameter to post' + '&'); sPostData.Add('add some parameter to post' + '&'); sPostData.Add('add some parameter to post' + '&'); sPostData.Add(parameters); sHttpSocket := TIdHTTP.Create; sshSocketHandler := TIdSSLIOHandlerSocketOpenSSL.Create; sHttpSocket.IOHandler := sshSocketHandler; sHttpSocket.Request.ContentType := 'application/x-www-form-urlencoded'; sHttpSocket.Request.Method := 'POST'; resStream := TStringStream.Create; sHttpSocket.Post(Self.sUrl, sPostData, resStream); xDoc := CreateXMLDoc; xDoc.LoadFromStream(resStream); Result := xDoc; resStream.Free; sHttpSocket.Free; sshSocketHandler.Free; sPostData.Free; except on E: Exception do begin TCommon.ErrorLog('errorLog.txt', DateTimeToStr(Now) + ' ' + E.Message); end end; end; Maybe I can do this in another way, that works like 100%, when internet connection is available? Regards, evilone

    Read the article

  • Why do the outputs differ when I run this code using Netbeans 6.8 and Eclipse?

    - by Vimal Basdeo
    When I am running the following codes using Eclipse and Netbeans 6.8. I want to see the available COM ports on my computer. When running in Eclipse it is returning me all available COm ports but when running t in Netbeans, it does not seem to find any ports .. public static void test(){ Enumeration lists=CommPortIdentifier.getPortIdentifiers(); System.out.println(lists.hasMoreElements()); while (lists.hasMoreElements()){ CommPortIdentifier cn=(CommPortIdentifier)lists.nextElement(); if ((CommPortIdentifier.PORT_SERIAL==cn.getPortType())){ System.out.println("Name is serail portzzzz "+cn.getName()+" Owned status "+cn.isCurrentlyOwned()); try{ SerialPort port1=(SerialPort)cn.open("ComControl",800000); port1.setSerialPortParams(9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); System.out.println("Before get stream"); OutputStream out=port1.getOutputStream(); InputStream input=port1.getInputStream(); System.out.println("Before write"); out.write("AT".getBytes()); System.out.println("After write"); int sample=0; //while((( sample=input.read())!=-1)){ System.out.println("Before read"); //System.out.println(input.read() + "TEsting "); //} System.out.println("After read"); System.out.println("Receive timeout is "+port1.getReceiveTimeout()); }catch(Exception e){ System.err.println(e.getMessage()); } } else{ System.out.println("Name is parallel portzzzz "+cn.getName()+" Owned status "+cn.isCurrentlyOwned()+cn.getPortType()+" "); } } } Output with Netbeans false Output using Eclipse true Name is serail portzzzz COM1 Owned status false Before get stream Before write After write Before read After read Receive timeout is -1 Name is serail portzzzz COM2 Owned status false Before get stream Before write After write Before read After read Receive timeout is -1 Name is parallel portzzzz LPT1 Owned status false2 Name is parallel portzzzz LPT2 Owned status false2

    Read the article

  • Python win32api not moving mouse cursor in VirtualBox

    - by wes
    I'm trying to use this Python code: import math for i in xrange(500): x = 500 + math.sin(math.pi * i / 100) * 500 y = 500 + math.cos(i) * 100 x, y = int(x), int(y) win32api.SetCursorPos((x, y)) time.sleep(.01) taken from here to move the mouse cursor in an XP VirtualBox. The mouse icon will flicker to the appropriate graphic (when it hits the edge of a window it turns into the <- resize image, for instance), but it doesn't actually move the visible cursor. I can move the mouse around while the code is running. Same result using the ctypes example in the above link. It works fine in the Win7 host. I have Guest Additions installed, if that matters.

    Read the article

  • Minimum Hardware requirements for Android development

    - by vishwanath
    I need information about minimum hardware requirement I need to have better experience in developing Android application. My current configuration is as follows. P4 3.0 GHz, 512 MB of ram. Started with Hello Android development on my machine and experience was sluggish, was using Eclipse Helios for development. Emulator used to take lot of time to start. And running program too. Do I need to upgrade my machine for the development purpose or is there anything else I am missing on my machine(like heavy processing by some other application I might have installed). And If I do need to upgrade, do I need to upgrade my processor too(that counts to new machine actually, which I am not in favor of), or only upgrading RAM will suffice.

    Read the article

  • how to implement a callback in runnable to update other swing class

    - by wizztjh
    I have a thread like this public class SMS { class Read implements Runnable { Read(){ Thread th = new Thread(this); th.start(); } @Override public void run() { // TODO Auto-generated method stub while (true){ Variant SMSAPIReturnValue = SMSAPIJava.invoke("ReadSMS"); if (SMSAPIReturnValue.getBoolean()){ String InNumber = SMSAPIJava.getPropertyAsString("MN"); String InMessage = SMSAPIJava.getPropertyAsString("MSG"); } } } } } How do I update the message to another GUI class in the same package(I understand how to put nested class to another package ....). Should I implement a callback function in SMS class? But how? Or should I pass in the Jlabel into the class?

    Read the article

  • Different sizes of same strings - Telnet programming

    - by tommyogp
    Hi all, I have been trying to create an iphone app sending telnet command. However what puzzling me is that the sizes of certain strings are so much different, particularly when they include \n or \r. I listed out a few examples. Please assist. const char *a = "play 25\n"; int sizeBitA1 = sizeof(a); // 8 units int sizeBitA2 = sizeof("play 25\n"); // 9 units const char *b = "\r\n"; int sizeBitB1 = sizeof(b); // 8 units int sizeBitB2 = sizeof("\r\n"); // 3 units

    Read the article

  • two HashMap iteration

    - by user431276
    I have two HashMaps and I can iterate both hashmaps with following code Iterator it = mp.entrySet().iterator(); while (it.hasNext()) { Map.Entry pairs = (Map.Entry)it.next(); String firstVal = pairs.getValue(); } Iterator it2 = mp2.entrySet().iterator(); while (it2.hasNext()) { Map.Entry pairs2 = (Map.Entry)it.next(); String SecondVal = pairs2.getValue(); } myFunction(firstVal, SecondVal) Is there anyway to iterate two hashmaps at the same time without using two loops? Currently, I have a method that accepts two parameters and each parameter value is stored in first and second hashmap. I have to iterate first hash then second to get values. I think there must be a good way to do it but I don't know :( P.S: there could be some errors in above code as this is just an example to explain my problem. Each iterator is a method in original program and accept one parameter. I couldn't copy past real time functions as they are HUGE !

    Read the article

  • Routing Issue in ASP.NET MVC 3 RC 2

    - by imran_ku07
         Introduction:             Two weeks ago, ASP.NET MVC team shipped the ASP.NET MVC 3 RC 2 release. This release includes some new features and some performance optimization. This release also fixes most of the bugs but still some minor issues are present in this release. Some of these issues are already discussed by Scott Guthrie at Update on ASP.NET MVC 3 RC2 (and a workaround for a bug in it). In addition to these issues, I have found another issue in this release regarding routing. In this article, I will show you the issue regarding routing and a simple workaround for this issue.       Description:             The easiest way to understand an issue is to reproduce it in the application. So create a MVC 2 application and a MVC 3 RC 2 application. Then in both applications, just open global.asax file and update the default route as below,     routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "Default", // Route name "{controller}/{action}/{id1}/{id2}", // URL with parameters new { controller = "Home", action = "Index", id1 = UrlParameter.Optional, id2 = UrlParameter.Optional } // Parameter defaults );              Then just open Index View and add the following lines,    <%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %> <asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> Home Page </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> <% Html.RenderAction("About"); %> </asp:Content>             The above view will issue a child request to About action method. Now run both applications. ASP.NET MVC 2 application will run just fine. But ASP.NET MVC 3 RC 2 application will throw an exception as shown below,                  You may think that this is a routing issue but this is not the case here as both ASP.NET MVC 2 and ASP.NET MVC  3 RC 2 applications(created above) are built with .NET Framework 4.0 and both will use the same routing defined in System.Web. Something is wrong in ASP.NET MVC 3 RC 2. So after digging into ASP.NET MVC source code, I have found that the UrlParameter class in ASP.NET MVC 3 RC 2 overrides the ToString method which simply return an empty string.     public sealed class UrlParameter { public static readonly UrlParameter Optional = new UrlParameter(); private UrlParameter() { } public override string ToString() { return string.Empty; } }             In MVC 2 the ToString method was not overridden. So to quickly fix the above problem just replace UrlParameter.Optional default value with a different value other than null or empty(for example, a single white space) or replace UrlParameter.Optional default value with a new class object containing the same code as UrlParameter class have except the ToString method is not overridden (or with a overridden ToString method that return a string value other than null or empty). But by doing this you will loose the benefit of ASP.NET MVC 2 Optional URL Parameters. There may be many different ways to fix the above problem and not loose the benefit of optional parameters. Here I will create a new class MyUrlParameter with the same code as UrlParameter class have except the ToString method is not overridden. Then I will create a base controller class which contains a constructor to remove all MyUrlParameter route data parameters, same like ASP.NET MVC doing with UrlParameter route data parameters early in the request.     public class BaseController : Controller { public BaseController() { if (System.Web.HttpContext.Current.CurrentHandler is MvcHandler) { RouteValueDictionary rvd = ((MvcHandler)System.Web.HttpContext.Current.CurrentHandler).RequestContext.RouteData.Values; string[] matchingKeys = (from entry in rvd where entry.Value == MyUrlParameter.Optional select entry.Key).ToArray(); foreach (string key in matchingKeys) { rvd.Remove(key); } } } } public class HomeController : BaseController { public ActionResult Index(string id1) { ViewBag.Message = "Welcome to ASP.NET MVC!"; return View(); } public ActionResult About() { return Content("Child Request Contents"); } }     public sealed class MyUrlParameter { public static readonly MyUrlParameter Optional = new MyUrlParameter(); private MyUrlParameter() { } }     routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "Default", // Route name "{controller}/{action}/{id1}/{id2}", // URL with parameters new { controller = "Home", action = "Index", id1 = MyUrlParameter.Optional, id2 = MyUrlParameter.Optional } // Parameter defaults );             MyUrlParameter class is a copy of UrlParameter class except that MyUrlParameter class not overrides the ToString method. Note that the default route is modified to use MyUrlParameter.Optional instead of UrlParameter.Optional. Also note that BaseController class constructor is removing MyUrlParameter parameters from the current request route data so that the model binder will not bind these parameters with action method parameters. Now just run the ASP.NET MVC 3 RC 2 application again, you will find that it runs just fine.             In case if you are curious to know that why ASP.NET MVC 3 RC 2 application throws an exception if UrlParameter class contains a ToString method which returns an empty string, then you need to know something about a feature of routing for url generation. During url generation, routing will call the ParsedRoute.Bind method internally. This method includes a logic to match the route and build the url. During building the url, ParsedRoute.Bind method will call the ToString method of the route values(in our case this will call the UrlParameter.ToString method) and then append the returned value into url. This method includes a logic after appending the returned value into url that if two continuous returned values are empty then don't match the current route otherwise an incorrect url will be generated. Here is the snippet from ParsedRoute.Bind method which will prove this statement.       if ((builder2.Length > 0) && (builder2[builder2.Length - 1] == '/')) { return null; } builder2.Append("/"); ........................................................... ........................................................... ........................................................... ........................................................... if (RoutePartsEqual(obj3, obj4)) { builder2.Append(UrlEncode(Convert.ToString(obj3, CultureInfo.InvariantCulture))); continue; }             In the above example, both id1 and id2 parameters default values are set to UrlParameter object and UrlParameter class include a ToString method that returns an empty string. That's why this route will not matched.            Summary:             In this article I showed you the issue regarding routing and also showed you how to workaround this problem. I explained this issue with an example by creating a ASP.NET MVC 2 and a ASP.NET MVC 3 RC 2 application. Finally I also explained the reason for this issue. Hopefully you will enjoy this article too.   SyntaxHighlighter.all()

    Read the article

  • Is execution of sync(8) still required before shutting down linux?

    - by Amos Shapira
    I still see people recommend use of "sync; sync; sync; sleep 30; halt" incantations when talking about shutting down or rebooting Linux. I've been running Linux since its inception and although this was the recommended procedure in the BSD 4.2/4.3 and SunOS 4 days, I can't recall that I had to do that for at least the last ten years, during which I probably went through shutdown/reboot of Linux maybe thousands of times. I suspect that this is an anachronism since the days that the kernel couldn't unmount and sync the root filesystem and other critical filesystems required even during single-user mode (e.g. /tmp), and therefore it was necessary to tell it explicitly to flush as much data as it can to disk. These days, without finding the relevant code in the kernel source yet (digging through http://lxr.linux.no and google), I suspect that the kernel is smart enough to cleanly unmount even the root filesystem and the filesystem is smart enough to effectively do a sync(2) before unmounting itself during a normal "shutdown"/"reboot"/"poweorff". The "sync; sync; sync" is only necessary in extreme cases where the filesystem won't unmount cleanly (e.g. physical disk failure) or the system is in a state that only forcing a direct reboot(8) will get it out of its freeze (e.g. the load is too high to let it schedule the shutdown command). I also never do the "sync" procedure before unmounting removable devices, and never hit a problem. Another example - Xen allows the DomU to be sent a "shutdown" command from the Dom0, this is considered a "clean shutdown" without anyone having to login and type the magical "sync; sync; sync" first. Am I right or was I lucky for a few thousands of system shutdowns?

    Read the article

  • IIS7 houndreds of connections in CLOSE_WAIT

    - by rjlopes
    I have a .Net application on my IIS7 server it was working fine until I had to move it to another server. I moved the exact same code to the new server and I noticed that after some hours the website stopped responding to remote requests but if I did remote desktop to the server it responded to the request done to localhost. If I stop the website and the application pool it started working fine again. I was able to track the problem to hundreds of requests left in CLOSE_WAIT state to the http port that are never closed (I waited a few hours and they remain the same). Any ideias?

    Read the article

  • ubuntu input/output error

    - by rplevy
    I'm having a problem with Ubuntu that I'm finding hard to troubleshoot for reasons that will become clear: reboot -bash: /sbin/reboot: Input/output error dmesg -bash: /bin/dmesg: Input/output error ps -e ps: error while loading shared libraries: /lib/libproc-3.2.8.so: cannot read file data: Input/output error lsof -bash: /usr/bin/lsof: Input/output error fsck -bash: /sbin/fsck: Input/output error badblocks -bash: /sbin/badblocks: Input/output error So I can't see what is going on, and I can't remotely reboot. What can I do to get to the bottom of this? Interestingly: init 0 Segmentation fault I can cat /var/syslog but not /var/log/messages or several other important files. less and more don't work, neither do tail or head, etc.

    Read the article

  • Is there a way to password protect my external drive and be compatible with both Windows and MAC?

    - by Stucko
    I have an external hard drive (HD-PXTU2 Series). I used it for more than 6 months now, what I liked about it was its password protect utility that comes together with the drive. However the problem is the password protect utility is not compatible with MAC ( I'l be regularly transferring data between MacOS and Windows). Is there a way to password protect my external drive which is compatible with both Windows and MacOS?

    Read the article

  • Using PHP and cURL to login to indyarocks.com

    - by Divya
    I am new to cURL and don't know much about it. I basically want to login to my account on www.indyarocks.com through libcurl for PHP. I don't know what type of authentication it uses (I don't know how to find that out.). When I go to http://www.indyarocks.com, I get a login form which asks for my username and password. I put in my username and password and click login and everything is good. I tried to automate this using cURL. This is a snippet of my code. curl_setopt($curl_connection, CURLOPT_URL, "http://www.indyarocks.com/loginchk.php"); curl_setopt($curl_connection, CURLOPT_POST, 1); curl_setopt($curl_connection, CURLOPT_HTTPAUTH, CURLAUTH_ANY); curl_setopt($curl_connection, CURLOPT_USERPWD, $username.':'.$password); I looked at the source of the login page and found out the address of the page to which the username and password are sent (the action attribute of the form) which is "http://www.indyarocks.com/loginchk.php" and set it as the target url. When I run this, I get username or password is wrong error and the login fails. My username and password is correct. I don't know what the problem is. Can the password be encrypted? Can that be responsible for this failure? Please help me get around this problem. I'll be really thankful. Thanks in advance.

    Read the article

  • How to use multiple flatpages models in a django app?

    - by the_drow
    I have multiple models that can be converted to flatpages but have to have some extra information (For example I have an about us page but I also have a blog). However I understand that there must be only one flatpages model since the middleware only returns the flatpages instance and does not resolve the child models. What do I have to do? EDIT: It seems I need to change the views. Here's the current code: from django.contrib.flatpages.models import FlatPage from django.template import loader, RequestContext from django.shortcuts import get_object_or_404 from django.http import HttpResponse, HttpResponseRedirect from django.conf import settings from django.core.xheaders import populate_xheaders from django.utils.safestring import mark_safe from django.views.decorators.csrf import csrf_protect DEFAULT_TEMPLATE = 'flatpages/default.html' # This view is called from FlatpageFallbackMiddleware.process_response # when a 404 is raised, which often means CsrfViewMiddleware.process_view # has not been called even if CsrfViewMiddleware is installed. So we need # to use @csrf_protect, in case the template needs {% csrf_token %}. # However, we can't just wrap this view; if no matching flatpage exists, # or a redirect is required for authentication, the 404 needs to be returned # without any CSRF checks. Therefore, we only # CSRF protect the internal implementation. def flatpage(request, url): """ Public interface to the flat page view. Models: `flatpages.flatpages` Templates: Uses the template defined by the ``template_name`` field, or `flatpages/default.html` if template_name is not defined. Context: flatpage `flatpages.flatpages` object """ if not url.endswith('/') and settings.APPEND_SLASH: return HttpResponseRedirect("%s/" % request.path) if not url.startswith('/'): url = "/" + url # Here instead of getting the flat page it needs to find if it has a page with a child model. f = get_object_or_404(FlatPage, url__exact=url, sites__id__exact=settings.SITE_ID) return render_flatpage(request, f) @csrf_protect def render_flatpage(request, f): """ Internal interface to the flat page view. """ # If registration is required for accessing this page, and the user isn't # logged in, redirect to the login page. if f.registration_required and not request.user.is_authenticated(): from django.contrib.auth.views import redirect_to_login return redirect_to_login(request.path) if f.template_name: t = loader.select_template((f.template_name, DEFAULT_TEMPLATE)) else: t = loader.get_template(DEFAULT_TEMPLATE) # To avoid having to always use the "|safe" filter in flatpage templates, # mark the title and content as already safe (since they are raw HTML # content in the first place). f.title = mark_safe(f.title) f.content = mark_safe(f.content) # Here I need to be able to configure what I am passing in the context c = RequestContext(request, { 'flatpage': f, }) response = HttpResponse(t.render(c)) populate_xheaders(request, response, FlatPage, f.id) return response

    Read the article

  • How to fix unresolved external symbol due to MySql Connector C++?

    - by Chan
    Hi everyone, I followed this tutorial http://blog.ulf-wendel.de/?p=215#hello. I tried both on Visual C++ 2008 and Visual C++ 2010. Either static or dynamic, the compiler gave me the same exact error messages: error LNK2001: unresolved external symbol _get_driver_instance Has anyone experience this issue before? Update: + Additional Dependencies: mysqlcppconn.lib + Additional Include Directories: C:\Program Files\MySQL\MySQL Connector C++ 1.0.5\include + Additional Libraries Directories: C:\Program Files\MySQL\MySQL Connector C++ 1.0.5\lib\opt Thanks, Chan Nguyen

    Read the article

  • PHP: System Timezone Setting error

    - by marknt15
    Hi, I'm trying to use PHP in the terminal under MAMP but I got an error related to the system's timezone settings. How can I fix this error? $/Applications/MAMP/bin/php5/bin/php echo.php PHP Strict Standards: PHP Startup: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Manila' for 'PHT/8.0/no DST' instead in Unknown on line 0 Thanks

    Read the article

  • Define classes for a datatable structure - ORM

    - by user424493
    I have existing tables - I have following datatables : ActivityTable(Key ActivityId) - which lists the identifier for various activity ProcessTable (identified by ProcessId) - which lists down which activites(ActivityId) are to be carried out along with their order(StepNum). Some of the activities are marked constant with in a process, that is they will have same data, ir-respective of there run environment. RunTable(Key RunConfigurationId) - that identifies the project name and Process Id Then data for each activity is stored is stored in their individual tables Activity_A, Activity_B,Activity_C so on it uses a combination of RunConfigurationId,ProcessId and stepNum. For the activities which are constant we use a RunConfigurationId= -100. Can anybody help me out how I can map something like this in classes using inheritence regards

    Read the article

  • C++Template in Java?

    - by RnMss
    I want something like this: public abstract class ListenerEx<LISTENER, PARENT> implements LISTENER { PARENT parent; public ListenerEx(PARENT p) { parent = p; } } But it doesn't compile. Is there a better solution? Is there something in Java like C++ template that would do check syntax after template deduction? The following explains why I need such a ListenerEX class, if you already know what it is, you don't need to read the following. I have a main window, and a button on it, and I want to get access to some method of the main window's within the listener: public class MainWindow extends JFrame { public void doSomething() { /* ... */ } public void doSomethingElse() { /* ... */ } private JButton button; public MainWindow() { button = new JButton(...); add(button); button.setActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doSomething(); doSomethingElse(); } }); } } This would compile but does not work properly all the time. (Why would it compile when the ActionListener does not have doSomething() method?) Of course we can do it like this: public class MainWindow extends JFrame { public void doSomething() { } public void doSomethingElse() { } private JButton button; public MainWindow() { button = new JButton(...); add(button); class ActionListener1 implements ActionListener { MainWindow parent; public ActionListener(MainWindow p) { parent = p; } public void actionPerformed(ActionEvent e) { parent.doSomething(); parent.doSomethingElse(); } } button.setActionListener(new ActionListener1(this)); } } However I hate this style ... So I tried: public abstract class ActionListenerEx<P> implements ActionListener { P parent; public ActionListenerEx(P p) { parent = p; } } public class MainWindow extends JFrame { public void doSomething() { } public void doSomethingElse() { } private JButton button; public MainWindow() { button = new JButton(...); add(button); button.setActionListener(new ActionListenerEx<MainWindow>(this) { public void actionPerformed(ActionEvent e) { parent.doSomething(); parent.doSomethingElse(); } }); } } But there's lots of Listeners beside the ActionListener ... public abstract class ActionListenerEx<LISTENER, PARENT> implements LISTENER { PARENT parent; public ActionListenerEx(PARENT p) { parent = p; } } However, it won't compile ... I am fresh at Java, and I wonder if there's already better solution.

    Read the article

  • wrong data type in mysql for grails byte[] property

    - by srkiNZ84
    Hi, I have an application which is trying to save a photo to the database. I've created a grails domain class with a byte[] property and this was working well when using HSQLDB (the default in grails). However, when I changed the database to MySQL I ended up getting the following error: Data truncation: Data too long for column 'photo' at row 1 I then had a look at the schema and found that the byte[] was being created as a TINYBLOB field, which was causing the error. How can I specify that this property should correspond to a BLOB/LONGBLOB type in the database?

    Read the article

  • Asp.Net Basic Program

    - by Abid Ali
    I want to Visible the combo Box named Cities when i click the Country Pakistan.. but the combo box visibility remains Hidden.. how do i do so ? I think my Code is correct but it is not working :s .. Help Required.. <select id="Items" name = "Countries"> <option id="Pakistan" onclick="VisibileTrue()">Pakistan</option> <option id = "Taiwan">Taiwan</option> </select> <select id="Items2" name="Cities" style="display:none" > <option>Karachi</option> <option>Sindh</option> </select> </div> </form> function VisibileTrue() { var element = document.getElementById(Pakistan); if(element == Pakistan) { var element2 = document.getElementsByTagName("Items2"); element2.style.display = "inline"; } }

    Read the article

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