Search Results

Search found 161 results on 7 pages for 'petr marek'.

Page 4/7 | < Previous Page | 1 2 3 4 5 6 7  | Next Page >

  • How to force PyYAML to load strings as unicode objects?

    - by Petr Viktorin
    The PyYAML package loads unmarked strings as either unicode or str objects, depending on their content. I would like to use unicode objects throughout my program (and, unfortunately, can't switch to Python 3 just yet). Is there an easy way to force PyYAML to always strings load unicode objects? I do not want to clutter my YAML with !!python/unicode tags. # Encoding: UTF-8 import yaml menu= u"""--- - spam - eggs - bacon - crème brûlée - spam """ print yaml.load(menu) Output: ['spam', 'eggs', 'bacon', u'cr\xe8me br\xfbl\xe9e', 'spam'] I would like: [u'spam', u'eggs', u'bacon', u'cr\xe8me br\xfbl\xe9e', u'spam']

    Read the article

  • Themes outside application.

    - by Marek
    Hi all I read http://forum.kohanaframework.org/comments.php?DiscussionID=5744&page=1#Item_0 and I want to use similar solution, but with db. In my site controller after(): $theme = $page->get_theme_name(); //Orange Kohana::set_module_path('themes', Kohana::get_module_path('themes').'/'.$theme); $this->template = View::factory('layout') I checked with firebug: fire::log(Kohana::get_module_path('themes')); // D:\tools\xampp\htdocs\kohana\themes/Orange I am sure that path exists. I have directly in 'Orange' folder 'views' folder with layout.php file. But I am getting: The requested view layout could not be found Extended Kohana_Core is just: public static function get_module_path($module_key) { return self::$_modules[$module_key]; } public static function set_module_path($module_key, $path) { self::$_modules[$module_key] = $path; } Could anybody help me with solving that issue? Maybe it is a .htaccess problem: # Turn on URL rewriting RewriteEngine On # Put your installation directory here: # If your URL is www.example.com/kohana/, use /kohana/ # If your URL is www.example.com/, use / RewriteBase /kohana/ # Protect application and system files from being viewed RewriteCond $1 ^(application|system|modules) # Rewrite to index.php/access_denied/URL RewriteRule ^(.*)$ / [PT,L] RewriteRule ^(media) - [PT,L] RewriteRule ^(themes) - [PT,L] # Allow these directories and files to be displayed directly: # - index.php (DO NOT FORGET THIS!) # - robots.txt # - favicon.ico # - Any file inside of the images/, js/, or css/ directories RewriteCond $1 ^(index\.php|robots\.txt|favicon\.ico|static) # No rewriting RewriteRule ^(.*)$ - [PT,L] # Rewrite all other URLs to index.php/URL RewriteRule ^(.*)$ index.php/$1 [PT,L] Could somebody help? What I am doing wrong? Regards [EDIT] My controller code: class Controller_Site extends Controller_Fly { public static $meta_names = array('keywords', 'descriptions', 'author'); public function action_main() { $this->m('page')->get_main_page(); } public function action_page($page_title) { $this->m('page')->get_by_link($page_title); } public function after() { $page = $this->m('page'); $metas = ''; foreach(self::$meta_names as $meta) { if (! empty($page->$meta)) { $metas .= html::meta($page->$meta, $meta).PHP_EOL; } } $theme = $page->get_theme_name(); Kohana::set_module_path('themes', Kohana::get_module_path('themes').'/'.$theme); $menus = $page->get_menus(); $this->template = View::factory('layout') ->set('theme', $theme) ->set('metas', $metas) ->set('menus', $menus['content']) ->set('sections', $page->get_sections()) ->set_global('page', $page); if ($page->header_on) { $settings = $this->m('setting'); $this->template->header = View::factory('/header') ->set('title', $settings->title) ->set('subtitle', $settings->subtitle) ->set('menus', $menus['header']); } if ($page->sidebar_on) { $this->template->sidebar = View::factory('sidebar', array('menus' => $menus['sidebar'])); } if ($page->footer_on) { $this->template->footer = View::factory('footer'); } parent::after(); } } and parent controller: abstract class Controller_Fly extends Controller_Template { protected function m($model_name, $id = NULL) { if (! isset($this->$model_name)) { $this->$model_name = ORM::factory($model_name, $id); } return $this->$model_name; } protected function mf($model_name, $id = NULL) { return ORM::factory($model_name, $id); } }

    Read the article

  • Windows Workflow Foundation: Multiple applications

    - by Petr Felzmann
    We are running several ASP.NET applications (one per customer) based on our custom framework (which just extend ASP.NET). Each web application use its own database (Initial Catalog in the term of connection string). Now we would like to add workflow capability to the applications (to our framework respectively). The particular workflows will be the same for all the applications only some initial settings of each workflow can vary, e.g. in one application the e-mail will be send to the user X, but in other application to the user Y. The question is if we can install one workflow engine (with one database for persistence) and share this for all workflows in all web applications. If so, how then workflow engine get knows the particular workflow belongs to which web application? Should we store some application identifier somewhere in workflow? Thanks for suggestions!

    Read the article

  • Empty accessors do matter? Regarding value types and their modification

    - by Petr
    Hi, I have following code that does not work due to "a" being a value typed. But I thought it would not work even without accessors, but it did: class Program { a _a //with accessors it WONT compile { get; set; } static void Main(string[] args) { Program p = new Program(); p._a.X = 5; //when both accessors are deleted, compiler does not //complain about _a.X not being as variable } } struct a { public int X; } It does not work as "a" is struct. But when I delete accessors from "_a" instance, it works. I do not understand why. Thanks

    Read the article

  • How to return proper 404 for google while providing user friendly content to the user?

    - by Marek
    I am bouncing between posting this here and on Superuser. Please excuse me if you feel this does not belong here. I am observing the behavior described here - Googlebot is requesting random urls on my site, like aecgeqfx.html or sutwjemebk.html. I am sure that I am not linking these urls from anywhere on my site. I suspect this may be google probing how we handle non existent content - to cite from an answer to the linked question: [google is requesting random urls to] see if your site correctly handles non-existent files (by returning a 404 response header) We have a custom page for nonexistent content - a styled page saying "Content not found, if you believe you got here by error, please contact us", with a few internal links, served (naturally) with a 200 OK. The URL is served directly (no redirection to a single url). I am afraid this may discriminate the site at google - they may not interpret the user friendly page as a 404 - not found and may think we are trying to fake something and provide duplicate content. How should I proceed to ensure that google will not think the site is bogus while providing user friendly message to users in case they click on dead links by accident?

    Read the article

  • Iphone video subtitles programmatic selection

    - by Marek
    I have some videos (mp4) with multiple language subtitles that can be read by an iphone. Users can select to view the subtitle and the language from the default iphone button in the video ui. I would like to be able to set a defalut programmatically, so that, for instance, an user can select a language just one time in the main screen and, from then on, all the videos will have that language subtitles on by default. I can't find anything in the official documentation. I tought about some workarounds like renaming srt files but i don't think it's possible witouht copying all the video files in the user documents dir (not an option).

    Read the article

  • ASP.NET MVC: How to create a usable UrlHelper instance?

    - by Marek
    I am using quartz.net to schedule regular events within asp.net mvc application. The scheduled job should call a service layer script that requires a UrlHelper instance (for creating Urls based on correct routes (via urlHelper.Action(..)) contained in emails that will be sent by the service). I do not want to hardcode the links into the emails - they should be resolved using the urlhelper. The job: public class EvaluateRequestsJob : Quartz.IJob { public void Execute(JobExecutionContext context) { // where to get a usable urlHelper instance? ServiceFactory.GetRequestService(urlHelper).RunEvaluation(); } } Please note that this is not run within the MVC pipeline. There is no current request being served, the code is run by the Quartz scheduler at defined times. How do I get a UrlHelper instance usable on the indicated place? If it is not possible to construct a UrlHelper, the other option I see is to make the job "self-call" a controller action by doing a HTTP request - while executing the action I will of course have a UrlHelper instance available - but this seems a little bit hacky to me.

    Read the article

  • Windows Workflow Foundation: Recommendations how to design architecture

    - by Petr Felzmann
    We are running several the same ASP.NET applications (one per customer) based on our custom framework (libraries). Each application use its own database (Initial Catalog in the term of connection string). Now we would like to add workflow capability (of course 4.0 ;) to the applications. So the particular workflows will be the same for all the applications only some initial settings of each workflow can vary, e.g. in one application the e-mail will be send to the user X, but in other application to the user Y. I have several general questions how to design architecture: (1) Can be the workflow database shared for all the applications? (2) Where to host workflow engine - inside our custom windows NT service or inside IIS? What are the criteria to choose the right host? (3) How the workflow engine should communicate with applications? Should application call some WCF endpoint API configured in workflow host or vice verse - should each application provide WCF endpoint API and workflow engine will call it? How then the workflow engine will identify applications? Both cases requires probably some application identifier as a parameter in API calls? (4) We would like to also store some information to the application databases based on the workflow states. Is it possible? Thanks for suggestions!

    Read the article

  • WinForms: Why do I get InvalidCastException when showing folder browser dialog?

    - by Marek
    I am randomly getting InvalidCastException when showing FolderBrowserDialog and also many clients have reported this. I have not been able to find anything relevant on the internet. Does anyone know what causes this/how to fix this? My code: using (FolderBrowserDialog fbd = new FolderBrowserDialog()) { fbd.ShowNewFolderButton = false; if (fbd.ShowDialog() == DialogResult.OK) Stack trace: Error: System.InvalidCastException: 'Unable to cast object of type 'System.__ComObject' to type 'IMalloc'.'. Stack trace: at System.Windows.Forms.UnsafeNativeMethods.Shell32.SHGetMalloc(IMalloc[] ppMalloc) at System.Windows.Forms.FolderBrowserDialog.GetSHMalloc() at System.Windows.Forms.FolderBrowserDialog.RunDialog(IntPtr hWndOwner) at System.Windows.Forms.CommonDialog.ShowDialog(IWin32Window owner) at System.Windows.Forms.CommonDialog.ShowDialog() EDIT: Additional information: I have been able to reproduce this only when running in VS2008 debugger. When running out of debugger, it happens only very rarely (happened once or twice in 6 months) on my 64 bit Windows 7 and goes away after restart. The clients are certainly not running the app in debugger so it is surely reproducible out of debugger.

    Read the article

  • How to update application files using patching?

    - by Marek
    I am not interested in any auto update solution, such as ClickOnce or the MS Updater Block. For anyone feeling the urge to ask why not: I am already using these and there is nothing wrong with them, I would just like to learn about any efficient alternatives. I would like to publish patches = small differences that will modify existing files of the deployment with the smallest possible delta. Not only code needs to be patched, but also resource files. Patching the running code can be accomplished by maintaining two separate synchronized copies of the deployment (no on the fly changes to the running executable are required). The application itself can be xcopy deployed (to avoid MSI auto-correcting the modified files or breaking ClickOnce signatures). I would like to learn how to handle different versions of patches (e.g. there is a patch issued that fixes one error and later another patch that fixes another error (in the same file) - users may have any combination of these and there comes a third patch - in text files, this may be easy to implement, but how about executable files? (native Win32 code vs. .NET, any difference?) If the first problem is too hard to solve or unsolvable for executables, I would like to at least learn if there is a solution that implements simple patching with serial revisions - in order to install revision 5, user must have all previous revisions installed to ensure validity of the deployment. Are there any existing solutions to accomplish this? NOTE: There are a few questions on SO that may seem like duplicates, but none with a good answer. This question is about the Windows platform, preferably .NET.

    Read the article

  • Is it possible to provide a resize indication (resizer-grip) on a form without adding a status bar?

    - by Marek
    I would like to have a resize indication on a windows forms Form (the same resize-grip as when you have a status bar). I do not want to add a status bar to the form - that would break the design of the form. The form can have various controls inside that are docked (Fill). I have not found any solution to this besides drawing the resize indication in lower right corner of every control, which is not very feasible. Is this possible without adding a picture of the resize grip to every control that can be docked in the form?

    Read the article

  • C# Converter difficulties

    - by Petr
    Hi, I am trying to fill object[] with List<string> but I cannot figure out how to use ConvertAll. MSDN did not help me. At first I tried to create an instance of Converter but it looks like it expects delegate? Converter<string, object> conv = new Converter<string, object>(??); //why delegate? this.comboBox1.Items.AddRange(Form1.AnimalType.ConvertAll<object>(conv)); Thanks :)

    Read the article

  • How do you protect your software from illegal distribution?

    - by petr k.
    I am curious about how do you protect your software against cracking, hacking etc. Do you employ some kind of serial number check? Hardware keys? Do you use any third-party solutions? How do you go about solving licensing issues? (e.g. managing floating licenses) EDIT: I'm not talking any open source, but strictly commercial software distribution...

    Read the article

  • Predicate<INT> match question

    - by Petr
    Hi, I do not understand how following code works. Specifically, I do not understand using of "return i<3". I would expect return i IF its < than 3. I always though that return just returns value. I could not even find what syntax is it. Second question, it seems to me like using anonymous method (delegate(int i)) but could be possible to write it with normal delegate pointing to method elsewere? Thanks List<int> listOfInts = new List<int> { 1, 2, 3, 4, 5 }; List<int> result = listOfInts.FindAll(delegate(int i) { return i < 3; });

    Read the article

  • Java try finally variations

    - by Petr Gladkikh
    This question nags me for a while but I did not found complete answer to it yet (e.g. this one is for C# http://stackoverflow.com/questions/463029/initializing-disposable-resources-outside-or-inside-try-finally). Consider two following Java code fragments: Closeable in = new FileInputStream("data.txt"); try { doSomething(in); } finally { in.close(); } and second variation Closeable in = null; try { in = new FileInputStream("data.txt"); doSomething(in); } finally { if (null != in) in.close(); } The part that worries me is that the thread might be somewhat interrupted between the moment resource is acquired (e.g. file is opened) but resulting value is not assigned to respective local variable. Is there any other scenarios the thread might be interrupted in the point above other than: InterruptedException (e.g. via Thread#interrupt()) or OutOfMemoryError exception is thrown JVM exits (e.g. via kill, System.exit()) Hardware fail (or bug in JVM for complete list :) I have read that second approach is somewhat more "idiomatic" but IMO in the scenario above there's no difference and in all other scenarios they are equal. So the question: What are the differences between the two? Which should I prefer if I do concerned about freeing resources (especially in heavily multi-threading applications)? Why? I would appreciate if anyone points me to parts of Java/JVM specs that support the answers.

    Read the article

  • Why my async call does not work?

    - by Petr
    Hi, I am trying to understand what is IAsyncresult good and therefore I wrote this code. The problem is it behaves as I called "MetodaAsync" normal way. While debugging, the program stops here until the method completed. Any help appreciated, thank you. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; namespace ConsoleApplication1 { class Program { delegate int Delegat(); static void Main(string[] args) { Program p=new Program(); Delegat d = new Delegat(p.MetodaAsync); IAsyncResult a = d.BeginInvoke(null, null); //I have removed callback int returned=d.EndInvoke(a); Console.WriteLine("AAA"); } private int MetodaAsync() { int AC=0; for (int I = 0; I < 600000; I++) { for (int A = 0; A < 6000000; A++) { } Console.Write("B"); } return AC; } } }

    Read the article

  • How can one use the "Add view" dialog in Visual Studio efficiently when working with ASP.NET MVC?

    - by Marek
    Does anyone else think that the add view dialog in VS is useless or is it just me? Why is there no search/filtering in there? I can not even paste the type name (without namespace) there to speed up the view creation. Plus, there are a lot of irrelevant classes there, including classes from all referenced libraries. Am I missing something or Microsoft never did any usability testing with that?? Is it possible to filter out types/assemblies in the dialog and/or better navigation compared to manually scrolling the combobox with all the types listed? Is it possible to include only types from a particular directory/assembly/namespace? (the ViewModels namespace for example) EDIT: As it seems from the answers that there is no usable workaround for this, I have filed a suggestion at Connect: https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=507784 Please vote for the suggestion if you find this is an important issue.

    Read the article

  • Can not access response.body inside after filter block in Sinatra 1.0

    - by Petr Vostrel
    I'm struggling with a strange issue. According to http://github.com/sinatra/sinatra (secion Filters) a response object is available in after filter blocks in Sinatra 1.0. However the response.status is correctly accessible, I can not see non-empty response.body from my routes inside after filter. I have this rackup file: config.ru require 'app' run TestApp Then Sinatra 1.0.b gem installed using: gem install --pre sinatra And this is my tiny app with a single route: app.rb require 'rubygems' require 'sinatra/base' class TestApp < Sinatra::Base set :root, File.dirname(__FILE__) get '/test' do 'Some response' end after do halt 500 if response.empty? # used 500 just for illustation end end And now, I would like to access the response inside the after filter. When I run this app and access /test URL, I got a 500 response as if the response is empty, but the response clearly is 'Some response'. Along with my request to /test, a separate request to /favicon.ico is issued by the browser and that returns 404 as there is no route nor a static file. But I would expect the 500 status to be returned as the response should be empty. In console, I can see that within the after filter, the response to /favicon.ico is something like 'Not found' and response to /test really is empty even though there is response returned by the route. What do I miss?

    Read the article

  • Malicious crawler blocker for ASP.NET

    - by Marek
    I have just stumbled upon Bad Behavior - a plugin for PHP that promises to detect spam and malicious crawlers by preventing them from accessing the site at all. Does something similar exist for ASP.NET/ASP.NET MVC? I am interested in blocking access to the site altogether, not in detecting spam after it was posted.

    Read the article

  • How to associate application with existing file types using WiX installer?

    - by Marek
    related to this: http://stackoverflow.com/questions/138550/how-to-register-file-types-extensions-with-a-wix-installer but not a duplicate. I need to handle existing file types (.jpg files). I do not want to be the default handler for .jpg, I would just like to extend the "Open with" menu with a link to my app. I see HKCR\.jpg\OpenWithList\ and HKCR\.jpg\OpenWithProgIds\ in the registry but I am not sure whether to write to these and how to do it correctly with WiX. Should I use something like this? <ProgId Id='??what here?' Description='Jpeg handled by my App'> <Extension Id='jpg' ContentType='image/jpeg'> <Verb Id='openwithmyapp' Sequence='10' Command='OpenWithMyApp' Target='[!FileId]' Argument='"%1"' /> </Extension> </ProgId> There are many ways how to fail here (like Photo Mechanics did, the HKCR for image file types is a real mess after I have installed this software) How to do this correctly with WiX?

    Read the article

  • Empty accessors do matter?

    - by Petr
    Hi, I have following code that does not work due to "a" being a value typed. But I thought it would not work even without accessors, but it did: class Program { a _a { get; //when both accessors deleted, it will work set; } static void Main(string[] args) { Program p = new Program(); p._a.X = 5; } } struct a { public int X; } It does not work as "a" is struct. But when I delete accessors from "_a" instance, it works. I do not understand why. Thanks

    Read the article

  • PHP - database not selected. What is wrong with my code?

    - by Petr
    Hi, I am learning PHP and tried to connect to MySQL. Altough I am using select DB, is still reports "No database selected". What is wrong, please? Thanks. <?php $user="test"; $pass="aaa"; ConnectToDb(); function ConnectToDb() { $pripojeni=mysql_connect('localhost',$user,$pass); $selectedDB=mysql_select_db('1a'); if($query=mysql_query('select * from project')) { while($d=mysql_fetch_array($query)) { echo "TEST"; } } else echo mysql_error($pripojeni); } ?>

    Read the article

< Previous Page | 1 2 3 4 5 6 7  | Next Page >