Search Results

Search found 9366 results on 375 pages for 'common lisp'.

Page 45/375 | < Previous Page | 41 42 43 44 45 46 47 48 49 50 51 52  | Next Page >

  • Does Objective-C support Mixin like Ruby?

    - by hacksignal
    In Ruby, there's Modules and you can extend a class by "mixing-in" the module. Module myModule def printone print "one" end end Class myClass extend myModule end theOne = myClass.new theOne.printone >> one In Objective-C, I find that I have a set of common methods that I want a number of Class to "inherit". What other ways can I achieve this without creating a common class and deriving all from that common class?

    Read the article

  • Django custom locale directory

    - by valya
    I'm developing a project with two different sites, divided by language. Maybe I was terribly wrong, but now my directory structure looks like: /ruapp/settings.py # SITE_ID = 1 /ruapp/manage.py /enapp/settings.py # SITE_ID = 2 /enapp/manage.py /common/urls.py /common/ # almost every other file /common/templates/ # templates with {% trans %} /locale/ # with locales ru-ru and en-us, generated by calling makemessages from the root of all this structure How to tell django about the locale? It does not seem like it will find the /locale/ folder by itself

    Read the article

  • Automatic (keyless) styles not applied when in a MergedDictionaries in another assembly

    - by Catalin DICU
    I moved the styles and templates xaml files form my application (.exe) project to a library project (.dll) because I want to use them in multiple applications. In App.xaml I have: <Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="pack://application:,,,/MyApplication.Common;component/Resources/All.xaml" /> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Application.Resources> In All.xaml (in the Common assembly) : <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="Styles.xaml" /> <ResourceDictionary Source="Templates.xaml" /> <ResourceDictionary Source="Converters.xaml" /> </ResourceDictionary.MergedDictionaries> With this code keyless styles in Styles.xaml aren't applied. Instead, if I reference them directly in App.xaml, it works : <Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="pack://application:,,,/MyApplication.Common;component/Resources/Styles.xaml" /> <ResourceDictionary Source="pack://application:,,,/MyApplication.Common;component/Resources/Templates.xaml" /> <ResourceDictionary Source="pack://application:,,,/MyApplication.Common;component/Resources/Converters.xaml" /> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Application.Resources> Can anyone explain why it happens ?

    Read the article

  • The same class file in multiple .jar files. How bad is this?

    - by Kannan Goundan
    I have a library that writes data in either a text or binary format. It has the following three components: common data structures text writer (depends on 1) binary writer (depends on 1) The obvious way to distribute this is as 3 .jar files, so that users can include only what they need. However, the "common data structures" component is really just two small classes so I'm considering creating only two .jar files and including the common .class files in both. My question: What are the potential problems with doing this?

    Read the article

  • What's the best way to resolve a filepath?

    - by BillyONeal
    Hello everyone :) I've got a series of filepaths that look something like this: C:\Windows\System32\svchost.exe -k LocalSystemNetworkRestricted C:\Windows\System32\svchost C:\Program Files (x86)\Common Files\Steam\SteamService.exe /RunAsService "C:\Program Files (x86)\Common Files\Steam\SteamService.exe" /RunAsService and I need to find these paths' actual locations. So, respectively, the above would be: C:\Windows\System32\svchost.exe C:\Windows\System32\svchost.exe C:\Program Files (x86)\Common Files\Steam\SteamService.exe C:\Program Files (x86)\Common Files\Steam\SteamService.exe What's the best way to go about doing this? Does windows have an API function to accomplish it? I essentially am trying to figure out what executable CreateProcess will call if I pass it that path. Thanks! Billy3

    Read the article

  • Best way to handle Integer overflow in C#?

    - by byte
    Handling integer overflow is a common task, but what's the best way to handle it in C#? Is there some syntactic sugar to make it simpler than with other languages? Or is this really the best way? int x = foo(); int test = x * common; if(test / common != x) Console.WriteLine("oh noes!"); else Console.WriteLine("safe!");

    Read the article

  • java.lang.ClassNotFoundException

    - by user341493
    Hey everyone, I have a java project that I'm working on which was working until a few days ago. I'm not sure what I did to my Eclipse set-up to hose it but now I'm getting a java.lang.ClassNotFoundException when I try to run some code that accesses the google finance api. I've built a small test application that uses the google finance api on its own and that seems to work. So, I think this is a project specific problem. Any help would be greatly appreciated. Here's the stack trace: `ptolemy.kernel.util.IllegalActionException: in .RandomSearch.manager Because: com/google/common/collect/Maps at ptolemy.actor.Manager.execute(Manager.java:472) at ptolemy.actor.Manager.run(Manager.java:1119) at ptolemy.actor.Manager$3.run(Manager.java:1160) Caused by: java.lang.NoClassDefFoundError: com/google/common/collect/Maps at com.google.gdata.wireformats.AltRegistry.(AltRegistry.java:118) at com.google.gdata.wireformats.AltRegistry.(AltRegistry.java:100) at com.google.gdata.client.Service.(Service.java:546) at AtomicBroadcast.GoogleFinance.GooglePortfolioReader.fire(GooglePortfolioReader.java:108) at ptolemy.domains.de.kernel.DEDirector.fire(DEDirector.java:568) at ptolemy.actor.CompositeActor.fire(CompositeActor.java:458) at ptolemy.actor.Manager.iterate(Manager.java:714) at ptolemy.actor.Manager.execute(Manager.java:349) ... 2 more Caused by: java.lang.ClassNotFoundException: com.google.common.collect.Maps at java.net.URLClassLoader$1.run(URLClassLoader.java:217) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:205) at java.lang.ClassLoader.loadClass(ClassLoader.java:319) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) at java.lang.ClassLoader.loadClass(ClassLoader.java:264) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:332) ... 10 more Caused by: java.lang.NoClassDefFoundError: com/google/common/collect/Maps at com.google.gdata.wireformats.AltRegistry.(AltRegistry.java:118) at com.google.gdata.wireformats.AltRegistry.(AltRegistry.java:100) at com.google.gdata.client.Service.(Service.java:546) at AtomicBroadcast.GoogleFinance.GooglePortfolioReader.fire(GooglePortfolioReader.java:108) at ptolemy.domains.de.kernel.DEDirector.fire(DEDirector.java:568) at ptolemy.actor.CompositeActor.fire(CompositeActor.java:458) at ptolemy.actor.Manager.iterate(Manager.java:714) at ptolemy.actor.Manager.execute(Manager.java:349) at ptolemy.actor.Manager.run(Manager.java:1119) at ptolemy.actor.Manager$3.run(Manager.java:1160) Caused by: java.lang.ClassNotFoundException: com.google.common.collect.Maps at java.net.URLClassLoader$1.run(URLClassLoader.java:217) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:205) at java.lang.ClassLoader.loadClass(ClassLoader.java:319) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) at java.lang.ClassLoader.loadClass(ClassLoader.java:264) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:332) ... 10 more`

    Read the article

  • Help a Python newbie with a Django model inheritance problem

    - by Joshmaker
    I'm working on my first real Django project after years of PHP programming, and I am running into a problem with my models. First, I noticed that I was copying and pasting code between the models, and being a diligent OO programmer I decided to make a parent class that the other models could inherit from: class Common(model.Model): self.name = models.CharField(max_length=255) date_created = models.DateTimeField(auto_now_add=True) date_modified = models.DateTimeField(auto_now=True) def __unicode__(self): return self.name class Meta: abstract=True So far so good. Now all my other models extend "Common" and have names and dates like I want. However, I have a class for "Categories" were the name has to be unique. I assume there should be a relatively simple way for me to access the name attribute from Common and make it unique. However, the different methods I have tried to use have all failed. For example: class Category(Common): def __init__(self, *args, **kwargs): self.name.unique=True Spits up the error "Caught an exception while rendering: 'Category' object has no attribute 'name' Can someone point me in the right direction?

    Read the article

  • longest string in texts

    - by davit-datuashvili
    Ihave following code in Java: import java.util.*; public class longest{ public static void main(String[] args){ int t=0;int m=0;int token1, token2; String words[]=new String[10]; String word[]=new String[10]; String common[]=new String[10]; String text="saqartvelo gabrwyindeba da gadzlierdeba aucileblad "; String text1="saqartvelo gamtliandeba da gadzlierdeba aucileblad"; StringTokenizer st=new StringTokenizer(text); StringTokenizer st1=new StringTokenizer(text1); token1=st.countTokens(); token2=st1.countTokens(); while (st.hasMoreTokens()){ words[t]=st.nextToken(); t++; } while (st1.hasMoreTokens()){ word[m]=st1.nextToken(); m++; } for (int k=0;k<token1;k++){ for (int f=0;f<token2;f++){ if (words[f].compareTo(word[f])==0){ common[f]=words[f]; } } } while (i<common.length){ System.out.println(common[i]); i++; } } } I want that in common array put elements which i in both text or these words saqartvelo (georgia in english) da (and in english) gadzlierdeba (will be stronger) aucileblad (sure) and then between these words find string which has maximum length but it does not work more correctly it show me these words and also many null elements. How do I correct it?

    Read the article

  • Trouble using CollectionViewSource in Silverlight

    - by Johnny
    Hi, I having some trouble when implementing the CollectionViewSource in silverlight. I'm new in this topic, so basically I've been following what I find searching through the web. Here's what I've been trying to do so far. I'm creating a CollectionViewSource in the resources tag: <UserControl.Resources> <CollectionViewSource x:Key="TestCVS"> <CollectionViewSource.SortDescriptions> <scm:SortDescription PropertyName="Value" Direction="Ascending" /> </CollectionViewSource.SortDescriptions> </CollectionViewSource> </UserControl.Resources> Then I'm binding my TestCVS in a HierarchicalDataTemplate: <common:HierarchicalDataTemplate ItemsSource="{Binding Source={StaticResource TestCVS}}"> <common:HierarchicalDataTemplate.ItemTemplate> <common:HierarchicalDataTemplate> <Border BorderBrush="#FF464646" BorderThickness="1" CornerRadius="3" Padding="5"> <Grid> <Grid.RowDefinitions> <RowDefinition /> <RowDefinition /> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="*"/> </Grid.ColumnDefinitions> <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"> <TextBlock TextWrapping="Wrap" Text="{Binding MyClassField}"/> </StackPanel> </Grid> </Border> </common:HierarchicalDataTemplate> </common:HierarchicalDataTemplate.ItemTemplate> </common:HierarchicalDataTemplate> Now, in the code behind I'm assigning the Source for the TestCVS in a property, like this: private ObservableCollection<MyClass> _MyClass; public ObservableCollection<MyClass> MyClass { get { return _MyClass; } set { var testCVS = (this.Resources["TestCVS"] as CollectionViewSource); if (testCVS != null) testCVS.Source = value; } } After testing this I realize that the information is not showing on screen and I don't really know why, can anyone help me on this matter? Hope this makes any sense, thanks in advance!

    Read the article

  • PHP get "Application Root" in Xampp on Windows correctly

    - by Michael Mao
    Hi all: I found this thread on StackOverflow about how to get the "Application Root" from inside my web app. However, most of the approaches suggested in that thread can hardly be applied to my Xampp on Windows. Say, I've got a "common.php" which stays inside my web app's app directory: / /app/common.php /protected/index.php In my common.php, what I've got is like this: define('DOCROOT', $_SERVER['DOCUMENT_ROOT']); define('ABSPATH', dirname(__FILE__)); define('COMMONSCRIPT', $_SERVER['PHP_SELF']); After I required the common.php inside the /protected/index.php, I found this: C:/xampp/htdocs //<== echo DOCROOT; C:\xampp\htdocs\comic\app //<== echo ABSPATH /comic/protected/index.php //<== echo COMMONSCRIPT So the most troublesome part is the path delimiters are not universal, plus, it seems all superglobals from the $_SERVER[] asso array, such as $_SERVER['PHP_SELF'], are relative to the "caller" script, not the "callee" script. It seems that I can only rely on dirname(__FILE__) to make sure this always returns an absolute path to the common.php file. I can certainly parse the returning values from DOCROOT and ABSPATH and then calculate the correct "application root". For instance, I can compare the parts after htdocs and substitute all backslashes with slashes to get a unix-like path I wonder is this the right way to handle this? What if I deploy my web app on a LAMP environment? would this environment-dependent approach bomb me out? I have used some PHP frameworks such as CakePHP and CodeIgniter, to be frank, They just work on either LAMP or WAMP, but I am not sure how they approached such a elegant solution. Many thanks in advance for all the hints and suggestions.

    Read the article

  • Building a specific piece of Android platform?

    - by Chrisc
    Hi, I have been trying to build only the "/libcore" directory of the Android platform. When I try mmm libcore I end up with the following output: ============================================ PLATFORM_VERSION_CODENAME=REL PLATFORM_VERSION=2.1-update1 TARGET_PRODUCT=generic TARGET_BUILD_VARIANT=eng TARGET_SIMULATOR=false TARGET_BUILD_TYPE=release TARGET_ARCH=arm HOST_ARCH=x86 HOST_OS=linux HOST_BUILD_TYPE=release BUILD_ID=ECLAIR ============================================ make: Entering directory `/home/chris/android/platform' target Prebuilt: (out/target/product/generic/system/etc/security/cacerts.bks) host Prebuilt: run-core-tests-on-ri (out/host/linux-x86/obj/EXECUTABLES/run-core-tests-on-ri_intermediates/run-core-tests-on-ri) target Prebuilt: run-core-tests (out/target/product/generic/obj/EXECUTABLES/run-core-tests_intermediates/run-core-tests) Copy: out/target/product/generic/system/etc/apns-conf.xml Copying: out/target/common/obj/JAVA_LIBRARIES/core_intermediates/classes-full-debug.jar Copying: out/target/common/obj/JAVA_LIBRARIES/core-tests_intermediates/classes-full-debug.jar /bin/bash: jar: command not found make: *** [out/host/common/core-tests.jar] Error 127 make: *** Deleting file `out/host/common/core-tests.jar' make: Leaving directory `/home/chris/android/platform' Does anyone have any suggestions on what Error 127 is, or another method I can go about building "libcore" without having to build the entire platform again? Thanks, Chris

    Read the article

  • How to write a custom solution using a python package, modules etc

    - by morpheous
    I am writing a packacge foobar which consists of the modules alice, bob, charles and david. From my understanding of Python packages and modules, this means I will create a folder foobar, with the following subdirectories and files (please correct if I am wrong) foobar/ __init__.py alice/alice.py bob/bob.py charles/charles.py david/david.py The package should be executable, so that in addition to making the modules alice, bob etc available as 'libraries', I should also be able to use foobar in a script like this: python foobar --args=someargs Question1: Can a package be made executable and used in a script like I described above? Question 2 The various modules will use code that I want to refactor into a common library. Does that mean creating a new sub directory 'foobar/common' and placing common.py in that folder? Question 3 How will the modules foo import the common module ? Is it 'from foobar import common' or can I not use this since these modules are part of the package? Question 4 I want to add logic for when the foobar package is being used in a script (assuming this can be done - I have only seen it done for modules) The code used is something like: if __name__ == "__main__": dosomething() where (in which file) would I put this logic ?

    Read the article

  • Ant: How to force java compilation if classpath jars have changed but sources have not

    - by Ittai
    Hi, I have the following usecase: I have a java project (myProj) which uses a common.jar from a different project(common). I want the javac ant task to work even if the sources of myProj have not changed if the common.jar has changed (as the sources of myProj depend of it and might be invalid now). I have a task which copies the common.jar from a central location to the myProj lib if it has changed and I can use it to set a property whether or not to "force" compilation so that end is taken care of. I'm not sure how (or if) I can tell the javac task to try and compile anyway? I don't want to change myProj's sources (or timestamps) so that the task will start. Excerpt from the ant build.xml file: <path id="project.class.path"> <pathelement location... /> ... <fileset dir="lib" includes="**/*.jar" /> </path> <target name="copyLibs" > <copy file="${central.loc}/common.jar" todir="lib" /> ... </target> <target name="javac" > <javac srcdir="src" includes="**" excludes=... > <classpath refid="project.class.path"/> </javac> </target> Thanks in advance, Ittai

    Read the article

  • How to use multi-level SUBDIRS in Makefile.am:s?

    - by Jukka Dahlbom
    A common issue automake complains about is caused by following lines in various Makefile.am:s Makefile.am: SUBDIRS = deployment transport/http/util transport/http/common engine transport The intent of this line is to force the order of building so that transport/http/util and transport/http/common are build before the engine directory, and building rest of the transport after engine is build. This line causes the following error when running automake under MinGW: Makefile.am:1: directory should not contain `/'

    Read the article

  • Generate dynamic xmlns

    - by alexbf
    Hello, I would like to dynamically generate xmlns attributes. I want to generate this in XSL : <Common:MainPageBase xmlns:Common="clr-namespace:ThisPartIsDynamic;assembly=ThisPartIsDynamic" </Common:MainPageBase How can I do that in XSL? Thanks, Alex

    Read the article

  • 3 page longest path on a website

    - by Kazoom
    i have a log file which maintains source entry for each page.all the pages share the common file. source means from what page did user arrive on the target page. I want to find the most common 3 page path for all the pages on the website. Example log file: source Target 1 2 1 3 2 1 3 2 3 2 2 1 The most common 3 page path here was from 3 to 2 to 1.

    Read the article

  • Visual Studio 2008 Explicit Reference Error

    - by Alan
    I have a project which references a dll in the same solution (called "Common"). Common has two types of errors with the same names but different namespaces i.e. Common.Login.UserDeleted Common.Imaging.UserDeleted When I type UserDeleted visual studio recognizes both of these and asks for which it is ("ambiguous reference"). I right-click UserDeleted and select one of the two above, yet it then says that the type or reference doesn't exist! It doesn't make any sense. Why is this happening? I can't compile my program until I find a solution to this, thanks

    Read the article

  • An Ideal Keyboard Layout for Programming

    - by Jon Purdy
    I often hear complaints that programming languages that make heavy use of symbols for brevity, most notably C and C++ (I'm not going to touch APL), are difficult to type because they require frequent use of the shift key. A year or two ago, I got tired of it myself, downloaded Microsoft's Keyboard Layout Creator, made a few changes to my layout, and have not once looked back. The speed difference is astounding; with these few simple changes I am able to type C++ code around 30% faster, depending of course on how hairy it is; best of all, my typing speed in ordinary running text is not compromised. My questions are these: what alternate keyboard layouts have existed for programming, which have gained popularity, are any of them still in modern use, do you personally use any altered layout, and how can my layout be further optimised? I made the following changes to a standard QWERTY layout. (I don't use Dvorak, but there is a programmer Dvorak layout worth mentioning.) Swap numbers with symbols in the top row, because long or repeated literal numbers are typically replaced with named constants; Swap backquote with tilde, because backquotes are rare in many languages but destructors are common in C++; Swap minus with underscore, because underscores are common in identifiers; Swap curly braces with square brackets, because blocks are more common than subscripts; and Swap double quote with single quote, because strings are more common than character literals. I suspect this last is probably going to be the most controversial, as it interferes the most with running text by requiring use of shift to type common contractions. This layout has significantly increased my typing speed in C++, C, Java, and Perl, and somewhat increased it in LISP and Python.

    Read the article

  • Dynamic 'twitter style' urls with ASP.NET

    - by Desiny
    I am looking to produce an MVC site which has complete control of the url structure using routing. The specific requirements are: www.mysite.com/ = homepage (home controller) www.mysite.com/common/about = content page (common controller) www.mysite.com/common/contact = content page (common controller) www.mysite.com/john = twitter style user page (dynamic controller) www.mysite.com/sarah = twitter style user page (dynamic controller) www.mysite.com/me = premium style user page (premium controller) www.mysite.com/oldpage.html = 301 redirect to new page www.mysite.com/oldpage.asp?id=3333 = 301 redirect to new page My routes look as follows: routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "Common", "common/{action}/{id}", new { controller = "common", action = "Index", id = "" } ); routes.MapRoute( "Home", "", new { controller = "Home", action = "Index", id = "" } ); routes.MapRoute( "Dynamic", "{id}", new { controller = "dynamic", action = "Index", id = "" } ); In order to handle the 301 rredirct, I have a database defining the old pages and their new page urls and a stored procdure to handle the lookup. The code (handler) looks like this: public class AspxCatchHandler : IHttpHandler, IRequiresSessionState { #region IHttpHandler Members public bool IsReusable { get { return true; } } public void ProcessRequest(HttpContext context) { if (context.Request.Url.AbsolutePath.Contains("aspx") && !context.Request.Url.AbsolutePath.ToLower().Contains("default.aspx")) { string strurl = context.Request.Url.PathAndQuery.ToString(); string chrAction = ""; string chrDest = ""; try { DataTable dtRedirect = SqlFactory.Execute( ConfigurationManager.ConnectionStrings["emptum"].ConnectionString, "spGetRedirectAction", new SqlParameter[] { new SqlParameter("@chrURL", strurl) }, true); chrAction = dtRedirect.Rows[0]["chrAction"].ToString(); chrDest = dtRedirect.Rows[0]["chrDest"].ToString(); chrDest = context.Request.Url.Host.ToString() + "/" + chrDest; chrDest = "http://" + chrDest; if (string.IsNullOrEmpty(strurl)) context.Response.Redirect("~/"); } catch { chrDest = "/";// context.Request.Url.Host.ToString(); } context.Response.Clear(); context.Response.Status = "301 Moved Permanently"; context.Response.AddHeader("Location", chrDest); context.Response.End(); } else { string originalPath = context.Request.Path; HttpContext.Current.RewritePath("/", false); IHttpHandler httpHandler = new MvcHttpHandler(); httpHandler.ProcessRequest(HttpContext.Current); HttpContext.Current.RewritePath(originalPath, false); } } #endregion } It is very simple to look up a user and in fact the above code does this. My problem is in the dynamic / premium part. I am trying to do the following: 1) in the dynamic controller, lookup the username. 2) if the username is in the user list (database), show the Index ActionResult of the Dynamic controller. 3) if the username is not found, look up the username in the premium list 4) if the username is fund in the premium list (database) then show the Index ActionResult of the Preium controller. 5) If all else fails jump to the 404 page (which will ask the user to sign up) Is this possible? Looking up the user twice is a bad idea for performance? How do I do this without redirecting?

    Read the article

  • ASP.NET MVC Default URL View

    - by Moose Factory
    I'm trying to set the Default URL of my MVC application to a view within an area of my application. The area is called "Common", the controller "Home" and the view "Index". I've tried setting the defaultUrl in the forms section of web.config to "~/Common/Home/Index" with no success. I've also tried mapping a new route in global.asax, thus: routes.MapRoute( "Area", "{area}/{controller}/{action}/{id}", new { area = "Common", controller = "Home", action = "Index", id = "" } ); Again, to no avail.

    Read the article

  • .NET: Split web application into multiple DLLs?

    - by aximili
    Is it possible to compile some code-behind (.cs) files (eg. all .cs file under a particular folder) into one DLL, and the rest into another DLL? We have some common codes and pages (aspx + cs files) that we want to use across many websites. We want this to compile into a DLL (eg. Common.dll). The rest of the files will be website-specific, unique to each website and should compile into another DLL (eg. Website3.dll) This is so that if we make changes to a common code-behind, we can just publish Common.dll onto all our websites. Is that possible using VS Web Developer Express 2008? Thanks in advance. EDIT: We are already using a class library, but not for pages (aspx+cs)

    Read the article

  • PHP Frontpage/Page controller

    - by atno
    I using the following as Frontpage/Page Controller(s) and it's working ok so far, except two problems I'm facing which as you can see are the $pages array and the switch, which are actually much much longer as the one I've pasted here. Everytime there is a need for a new page controller I have to add it to $pages array and to switch which makes that list very long. How would you overcome this problem and do you see any other improvement on this code? loadLogic() in page controllers it is used to get functions under pages/controllername/logic/function.php. Frontpage Controller - index.php: include 'common/common.php'; if(!isset($_GET['p']) OR $_GET['p'] == ''){ $_GET['p'] = 'home'; header('Location: index.php?p=home'); } $pages = array('home','register','login','logout','page1','page2','page3'); $_GET['p'] = trim($_GET['p']); if(isset($_GET['p'])){ if(in_array($_GET['p'], $pages)){ switch ($_GET['p']) { case 'home': include 'home.php'; break; case 'register': include 'register.php'; break; case 'login': include 'login.php'; break; case 'logout': include 'logout.php'; break; case 'page1': include 'page1.php'; break; case 'page2': include 'page2.php'; break; case 'page3': include 'page3.php'; break; } }else{ echo '404!'; } } Page Controller - {home,register,login,logout,page1,page2,page3}.php: include 'tpl/common/header.php'; contentStart(); if(isset($_SESSION['logged'])){ loadLogic('dashboard'); }else{ loadLogic('nologin'); } //Display login form in logic page instead links // if(!isset($_SESSION['logged'])){ contentEnd(); loadLogic('nologinForm'); }else{ contentEnd(); include'tpl/common/rcol.php'; } include 'tpl/common/footer.php'; function loadLogic(): function loadLogic($logic) { $path = dirname(__DIR__) . '/pages'; $controller = preg_split('/&/',$_SERVER['QUERY_STRING']); $controller = trim($controller[0],"p="); $logicPath = 'logic'; $logic = $logic . '.php'; $err = 0; $logicFullPath = $path.'/'.$controller.'/'.$logicPath.'/'.$logic; if($err == '0'){ include "$logicFullPath"; } } Folder Structure: projectName | ---> common | ---> pages | | | --->home | | | --->register | | | --->login | | | --->logout | | | --->page1 | | | --->page2 | | | --->page3 | ---> tpl | | | ---> common | --> home.php | --> register.php | --> login.php | --> logout.php | --> page1.php | --> page2.php | --> page3.php

    Read the article

  • how to import other schema jars when using the scomp tool

    - by MikeJiang
    there is a huge amount of xml schemas for the business, some of them are common types like Money.xsd, Address.xsd, etc, while others are business specific like Customer.xsd, ShippingOrder.xsd, etc. So I decide to compile these schemas into 2 jars, one is commonbeans.jar, the other is businessbeans.jar. I've separated them into different folders. to build the commonbeans.jar is simple, just run "scomp -out commonbeans.jar ....\common*.xsd"; while run "scomp -out businessbeans.jar ....\business*.xsd" is a different story, there are errors say can't find those common types, and run "scomp -out businessbeans.jar ....\business*.xsd ....\business*.xsd" will blindly duplicate all the common types into the businessbeans.jar. so is there any way to link the commonbeans.jar when compile those busimess schemas, maybe something like "scomp -out businessbeans.jar ....\business*.xsd commonbeans.jar". I hope my poor english has expressed my issue!

    Read the article

  • ASP.Net Architecture Specific to Shared/Static functions

    - by Maxim Gershkovich
    Hello All, Could someone please advise in the context of a ASP.Net application is a shared/static function common to all users? If for example you have a function Public shared function GetStockByID(StockID as Guid) as Stock Is that function common to all current users of your application? Or is the shared function only specific to the current user and shared in the context of ONLY that current user? So more specifically my question is this, besides database concurrency issues such as table locking do I need to concern myself with threading issues in shared functions in an ASP.Net application? In my head; let’s say my application namespace is MyTestApplicationNamespace. Everytime a new user connects to my site a new instance of the MyTestApplicationNamespace is created and therefore all shared functions are common to that instance and user but NOT common across multiple users. Is this correct?

    Read the article

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