Search Results

Search found 14344 results on 574 pages for 'path'.

Page 164/574 | < Previous Page | 160 161 162 163 164 165 166 167 168 169 170 171  | Next Page >

  • Proper way to set PYTHONPATH (including precedence)

    - by Wells
    In .bashrc I have: export PYTHONPATH=/home/wells/py-mlb I've verified this is actually being set. so, in this directory is another directory called 'py_mlb'- the actual module. So I go python -v and then import py_mlb but it does: >>> import py_mlb import py_mlb # directory /usr/local/lib/python2.6/dist-packages/py_mlb Then I do import sys and print sys.path and I see: >>> print sys.path ['', '/usr/local/lib/python2.6/dist-packages/python_memcached-1.44-py2.6.egg', '/usr/local/lib/python2.6/dist-packages/pymc-2.1alpha-py2.6-linux-i686.egg', '/usr/local/lib/python2.6/dist-packages/nose-0.11.1-py2.6.egg', '/home/wells/py-mlb', '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old', '/usr/lib/python2.6/lib-dynload', '/usr/lib/python2.6/dist-packages', '/usr/local/lib/python2.6/dev-packages', '/usr/lib/pymodules/python2.6', '/usr/lib/pymodules/python2.6/gtk-2.0', '/usr/local/lib/python2.6/dist-packages'] So my path from .bashrc IS in there, and from the look of it it's even before dist-packages but it's importing the module from dist-packages. How can I finagle this so the PYTHONPATH as defined by .bashrc takes precedence? Thanks!

    Read the article

  • WPF DataValidation on a DataTemplate object in an ItemsControl

    - by Matt H.
    I have two datatemplates, both very similar... here is one of them: <DataTemplate x:Key="HeadingTemplate"> <Grid x:Name="mainHeadingGrid" Margin="5,5,30,0" HorizontalAlignment="Stretch"> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" /> <ColumnDefinition /> </Grid.ColumnDefinitions> <TextBlock Grid.Column="1" Margin="30,3,10,0" Foreground="Black" FontWeight="Bold" HorizontalAlignment="Left" TextWrapping="Wrap"> <TextBlock.Text> <MultiBinding Converter="{StaticResource myHeadingConverter}" ConverterParameter="getRNHeadingTitle" Mode="TwoWay"> <Binding Path="num"/> <Binding Path="name"/> </MultiBinding> </TextBlock.Text> </TextBlock> <TextBox Grid.Column="1" Text="{Binding Path=moreInfo}"/> </Grid> </DataTemplate> I use an selector in my ItemsControl to choose between the two, based on the object it is bound to. I want to use validation to check through all of the properties and put a big exclamation point in front of the whole datatemplate as it is displayed in the itemscontrol. how do I do this? All of the examples I've found explain how to set a ValidationRule on a specific control in the datatemplate, in that control's binding. I want to apply my validation rule to the entire template... Help! :)

    Read the article

  • WPF: Same line drawn different?

    - by stefan.at.wpf
    Hello, I have a canvas and in it I'm drawing some lines: for (int i = 1; i >= 100; i++) { // Line LineGeometry line = new LineGeometry(); line.StartPoint = new Point(i * 100, 0); line.EndPoint = new Point(i * 100, 100 * 100); // Path Path myPath = new Path(); myPath.Stroke = Brushes.Black; myPath.StrokeThickness = 1; // Add to canvas myPath.Data = line; canvas1.Children.Add(myPath); } Well, nothing special, but it makes problems - the lines are drawn different! The canvas is inside a scrollviewer, the following image shows different positions of the canvas, however the lines should look the same? Hell, how is this possible? The code above is the only code I've written by hand and it's the only content in the canvas. Anyone knows why this happens and how to prevent this? Thank you very much! Screenshot: http://www.imagebanana.com/view/c01nrd6i/lines.png

    Read the article

  • Help with SDL_mixer (no sound)

    - by Kaizoku
    Hello, I have this strange problem with SDL_mixer, it doesn't want to play music. It doesn't throw any error, it just skips it. Any advice? I am compiling on linux with libvorbis. audio.h #ifndef AUDIO_H #define AUDIO_H #include <string> #include <SDL/SDL_mixer.h> class Audio { private: Mix_Music *music; public: Audio(); virtual ~Audio(); public: void setMusic(std::string path); void playMusic(); }; #endif /* AUDIO_H */ audio.cpp #include "Audio.h" #include <stdexcept> Audio::Audio() { if (0 == Mix_Init(MIX_INIT_OGG)) throw std::runtime_error(Mix_GetError()); if (-1 == Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, MIX_DEFAULT_CHANNELS, 4096)) throw std::runtime_error(Mix_GetError()); } Audio::~Audio() { Mix_FreeMusic(music); Mix_Quit(); } void Audio::setMusic(std::string path) { music = Mix_LoadMUS(path.c_str()); if (NULL == music) throw std::runtime_error(Mix_GetError()); } void Audio::playMusic() { if (NULL != music) { if (-1 == Mix_PlayMusic(music, -1)) throw std::runtime_error(Mix_GetError()); } }

    Read the article

  • Isolated storage misunderstand

    - by Costa
    Hi this is a discussion between me and me to understand isolated storage issue. can you help me to convince me about isolated storage!! This is a code written in windows form app (reader) that read the isolated storage of another win form app (writer) which is signed. where is the security if the reader can read the writer's file, I thought only signed code can access the file! If all .Net applications born equal and have all permissions to access Isolated storage, where is the security then? If I can install and run Exe from isolated storage, why I don't install a virus and run it, I am trusted to access this area. but the virus or what ever will not be trusted to access the rest of file system, it only can access the memory, and this is dangerous enough. I cannot see any difference between using app data folder to save the state and using isolated storage except a long nasty path!! I want to try give low trust to Reader code and retest, but they said "Isolated storage is actually created for giving low trusted application the right to save its state". Reader code: private void button1_Click(object sender, EventArgs e) { String path = @"C:\Documents and Settings\All Users\Application Data\IsolatedStorage\efv5cmbz.ewt\2ehuny0c.qvv\StrongName.5v3airc2lkv0onfrhsm2h3uiio35oarw\AssemFiles\toto12\ABC.txt"; StreamReader reader = new StreamReader(path); var test = reader.ReadLine(); reader.Close(); } Writer: private void button1_Click(object sender, EventArgs e) { IsolatedStorageFile isolatedFile = IsolatedStorageFile.GetMachineStoreForAssembly(); isolatedFile.CreateDirectory("toto12"); IsolatedStorageFileStream isolatedStorage = new IsolatedStorageFileStream(@"toto12\ABC.txt", System.IO.FileMode.Create, isolatedFile); StreamWriter writer = new StreamWriter(isolatedStorage); writer.WriteLine("Ana 2akol we ashrab kai a3eesh wa akbora"); writer.Close(); writer.Dispose(); }

    Read the article

  • Force ListViewItem Background colour to change when bound item it is bound to changes.

    - by hayrob
    My ItemContainerStyle works perfectly when a ListViewItem is added: <Style x:Key="ItemContStyle" TargetType="{x:Type ListViewItem}"> <Style.Resources> <SolidColorBrush x:Key="lossBrush" Color="Red" /> <SolidColorBrush x:Key="newPartNo" Color="LightGreen" /> <SolidColorBrush x:Key="noSupplier" Color="Yellow" /> <Orders:OrderItemStatusConverter x:Key="OrderItemConverter" /> </Style.Resources> <Style.Triggers> <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=DataContext, Converter={StaticResource OrderItemConverter}}" Value="-1"> <Setter Property="Background" Value="{StaticResource lossBrush}" /> </DataTrigger> <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self},Path=DataContext, Converter={StaticResource OrderItemConverter}}" Value="-2"> <Setter Property="Background" Value="{StaticResource newPartNo}" /> </DataTrigger> <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self},Path=DataContext, Converter={StaticResource OrderItemConverter}}" Value="-3"> <Setter Property="Background" Value="{StaticResource noSupplier}" /> </DataTrigger> </Style.Triggers> </Style> However when the source item changes, the trigger is not fired and the background colour is not what I expect. How can I make the trigger fire?

    Read the article

  • get column names from a table where one of the column name is a key word.

    - by syedsaleemss
    Im using c# .net windows form application. I have created a database which has many tables. In one of the tables I have entered data. In this table I have 4 columns named key, name,age,value. Here the name "key" of the first column is a key word. Now I am trying to get these column names into a combo box. I am unable to get the name "key". It works for "key" when I use this code: private void comboseccolumn_SelectedIndexChanged(object sender, EventArgs e) { string dbname = combodatabase.SelectedItem.ToString(); string path = @"Data Source=" + textBox1.Text + ";Initial Catalog=" + dbname + ";Integrated Security=SSPI"; //string path=@"Data Source=SYED-PC\SQLEXPRESS;Initial Catalog=resources;Integrated Security=SSPI"; SqlConnection con = new SqlConnection(path); string tablename = comboBox2.SelectedItem.ToString(); //string query= "Select * from" +tablename+; //SqlDataAdapter adp = new SqlDataAdapter(" Select [Key] ,value from " + tablename, con); SqlDataAdapter adp = new SqlDataAdapter(" Select [" + combofirstcolumn.SelectedItem.ToString() + "]," + comboseccolumn.SelectedItem.ToString() + "\t from " + tablename, con); DataTable dt = new DataTable(); adp.Fill(dt); dataGridView1.DataSource = dt; } This is beacuse I am using "[" in the select query. But it wont work for non keys. Or if I remove the "[" it is not working for key . Please suggest me so that I can get both key as well as nonkey column names.

    Read the article

  • script to find "deny" ACE in ACLs, and remove it

    - by Tom
    On my 100TB cluster, I need to find dirs and files that have a "deny" ACE within their ACL, then remove that ACE on each instance. I'm using the following: # find . -print0 | xargs -0 ls -led | grep deny -B4 and get this output (partial, for example only) -r--rw---- 1 chris GroupOne 4096 Mar 6 18:12 ./directoryA/fileX.txt OWNER: user:chris GROUP: group:GroupOne 0: user:chris allow file_gen_read,std_write_dac,file_write_attr 1: user:chris deny file_write,append,file_write_ext_attr,execute -- -r--rwxrwx 1 chris GroupOne 14728221 Mar 6 18:12 ./directoryA/subdirA/fileZ.txt OWNER: user:chris GROUP: group:GroupOne 0: user:chris allow file_gen_read,std_write_dac,file_write_attr 1: user:chris deny file_write,append,file_write_ext_attr,execute -- OWNER: user:bob GROUP: group:GroupTwo 0: user:bob allow dir_gen_read,dir_gen_write,dir_gen_execute,std_write_dac,delete_child,object_inherit,container_inherit 1: group:GroupTwo allow std_read_dac,std_write_dac,std_synchronize,dir_read_attr,dir_write_attr,object_inherit,container_inherit 2: group:GroupTwo deny list,add_file,add_subdir,dir_read_ext_attr,dir_write_ext_attr,traverse,delete_child,object_inherit,container_inherit -- As you can see, depending on where the "deny" ACE is, I can see/not-see the path. I could increase the -B value (I've seen up to 8 ACEs on a file) but then I would get more output to distill from... What I need to do next is extract $ACENUMBER and $PATHTOFILE so that I can execute this command: chmod -a# $ACENUMBER $PATHTOFILE Additional issue is that the find command (above) gives a relative path, whereas I need the full path. I guess that would need to be edited somehow. Any guidance on how to accomplish this?

    Read the article

  • Kohana 3, 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

    Read the article

  • VBScript Catching Erroring Varialble Value

    - by Soren
    I have a VB Script (.vbs file) that is just a simple directory listing of a drive. It will the base of a drive back up script. But when running it as it is below, I am getting a Permission Denied error on some folder. What I need to find is what that folder is so I can figure out what the problem is with the folder. The line that is giving the error is "For Each TempFolder In MoreFolders". So what I am trying to figure out is how to WScript.Echo the current path (objDirectory) if there is an error. I am not sure if it matters much, but just in case, the error that I am getting is Permission Denied 800A0046 on line 12. So some folder, I do not know which one, is not letting me look inside. Set WSShell = WScript.CreateObject("WScript.Shell") Set objFSO = CreateObject ("Scripting.FileSystemObject") Dim FolderArr() FolderCount = 0 TopCopyFrom = "G:\" Sub WorkWithSubFolders(objDirectory) Set MoreFolders = objDirectory.SubFolders 'The next line is where the error occurs (line 12) For Each TempFolder In MoreFolders FolderCount = FolderCount + 1 ReDim Preserve FolderArr(FolderCount) FolderArr(FolderCount) = TempFolder.Path ' WScript.Echo TempFolder.Path WorkWithSubFolders(TempFolder) Next End Sub ReDim Preserve FolderArr(FolderCount) FolderArr(FolderCount) = TopCopyFrom Set objDirectory = objFSO.GetFolder(TopCopyFrom) WorkWithSubFolders(objDirectory) Set objDirectory = Nothing WScript.Echo "FolderCount = " & FolderCount WScript.Sleep 30000 Set objFSO = Nothing Set WSShell = Nothing

    Read the article

  • Where to put external archives to configure running in Eclipse?

    - by Buggieboy
    As a Java/Eclipse noob coming from a Visual Studio .NET background, I'm trying to understand how to set up my run/debug environment in the Eclipse IDE so I can start stepping through code. I have built my application with separate src and bin hierarchies for each library project, and each project has its own jar. For example, in a Windows environment, I have something like: c:\myapp\myapp_main\src\com\mycorp\myapp\main ...and a parallel "bin" tree like this: c:\myapp\myapp_main\bin\com\mycorp\myapp\main Other supporting projects are, similarly: **c:\myapp\myapp_util\src\com\mycorp\myapp\uti**l (and a parallel "bin" tree.) ... etc. So, I end up with, e.g., myapp_util.jar in the ...\myapp_util\bin... path and then add that as an external archive to my myapp_main project. I also use utilities like gluegen-rt.jar, which I add ad external dependencies to the projects requiring them. I have been able to run outside of the Eclipse environment, by copying all my project jars, gluegen-rt DLL, etc., into a "lib" subfolder of some directory and executing something like: java -Djava.library.path=lib -DfullScreen=false -cp lib/gluegen-rt.jar;lib/myapp_main.jar;lib/myapp_util.jar; com.mycorp.myapp.Main When I first pressed F11 to debug, however, I got a message about something like /com/sun/../glugen... not being found by the class loader. So, to debug, or even just run, in Ecplipse, I tried setting up my VM arguments in the Galileo Debug - (Run/Debug) Configurations to be the command line above, beginning at "-Djava.libary.path...". I've put a lib subdirectory - just like the above with all jars and the native gluegen DLL - in various places, such as beneath the folder that my main jar is built in and as a subfolder of my Ecplipse starting workspace folder, but now Eclipse can't find the main class: java.lang.NoClassDefFoundError: com.mycorp.myapp.Main Although the Classpath says that it is using the "default classpath", whatever that is. Bottom line, how do I assemble the constituent files of a multi-project application so that I can run or debug in Ecplipse?

    Read the article

  • Problems with Acitivity LifeCycle with VideoView playback.

    - by Alex Volovoy
    Hi all i've ran into another problems with VideoView. Then video is playing, and i put device asleep, using hard button, onPause is called. But it followed by 03-17 11:26:33.779: WARN/ActivityManager(884): Activity pause timeout for HistoryRecord{4359f620 com.package/com.package.VideoViewActivity} And then i have onStart/onResume again and Video starts playing. I've try to move code around onStart/onStop - doesn't seems to make difference. sample code : public class VideoViewActivity extends Activity { private String path = ""; private VideoView mVideoView; private static final String MEDIA_URL = "media_url"; @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.videoview); mVideoView = (VideoView)findViewById(R.id.surface_view); path = getIntent().getStringExtra(MEDIA_URL); } @Override public void onResume() { super.onResume(); mVideoView.setVideoPath(path); mVideoView.setMediaController(new MediaController(this)); mVideoView.requestFocus(); mVideoView.start(); } @Override public void onPause() { super.onPause(); mVideoView.stopPlayback(); mVideoView.setMediaController(null); } }

    Read the article

  • not a valid AllXsd value

    - by jun
    I got this from a Soap client request: Exception: SoapFault exception: [soap:Client] Server was unable to read request. --- There is an error in XML document (2, 273). --- The string '2010-5-24' is not a valid AllXsd value. in /path/filinet.php:21 Stack trace: #0 [internal function]: SoapClient-__call('SubIdDetailsByO...', Array) #1 /path/filinet.php(21): SoapClient-SubIdDetailsByOfferId(Array) #2 {main} Seems like I am sending an incorrect value, how do I format my value in an AllXsd in php? Here is my code: <?php $start = isset($_GET['start']) ? $_GET['start'] : date("Y-m-d"); $end = isset($_GET['end']) ? $_GET['end'] : date("Y-m-d"); //define parameter array $param = array('userName'=>'user', 'password'=>'pass', 'startDate' => $start, 'endDate' => $end, 'promotionId' => ''); //Get wsdl path $serverPath = "https://webservices.filinet.com/affiliate/reports.asmx?WSDL"; //Declare Soap client $client = new SoapClient($serverPath); try { //make the call $result = $client->SubIdDetailsByOfferId($param); //If error found display error if(isset($fault)) { echo "Error: ". $fault; } //If no error display response else { //Used to display raw XML in the Web Browser header("Content-Type: text/xml;"); //SubIdDetailsResult = XML results echo $result->SubIdDetailsByOfferIdResult; } } catch(SoapFault $ex) { echo "<b>Exception:</b> ". $ex; } unset($client); ?>

    Read the article

  • Process Close does not close a process when performed in a SetTimer label

    - by NbdNnm
    The script below creates a child process to perform FileExist() separately from the main script so that it avoids halting the script when an unknown network path is passed. However, the command, Process close, does not close the given process despite its ErrorLevel indicates it succeeded to close. Task Manager shows the child process still exists. FileExistTimeout() ; this checks if the necessary parameters are passed ; this checks if the given path exists by creating a child process with the given timeout PathToCheck := "\\1.2.3.4\test" msgbox, 64, Test Result, % FileExistTimeout(PathToCheck) "`n" ErrorLevel FileExistTimeout(strPath="", nTimeout=1000, strSwitch="/fe") { global strParam1 = %1% strParam2 = %2% ; if the function is used to check the script parameters if (strPath="") { if (strParam2 = strSwitch) && strParam1 ; this means the function is placed at the beginning of the script. ExitApp % (FileExist(strParam1) != "") + 1 ; Return 1 or 2. Return } ; create a child process to check the path tooltip, RunWait is performing.... SetTimer, FileExistTimeout, % -1 * nTimeout RunWait "%A_AhkPath%" "%A_ScriptFullPath%" "%strPath%" "%strSwitch%",,, nPID SetTimer, FileExistTimeout, Off ; Disable the timer (if it hasn't fired already). tooltip ; ErrorLevel contains the exit code of the process (from RunWait). if ErrorLevel = 2 ; found return true else if ErrorLevel = 1 ; not found return return ; timeout FileExistTimeout: Process Close, %nPID% ; Timed out - terminate the process. tooltip, % "Process Closed: " ErrorLevel "`n" "Used Pid: " nPID,,, 2 return }

    Read the article

  • Problem with DataTrigger binding - setters are not being called

    - by aoven
    I have a Command bound to a Button in XAML. When executed, the command changes a property value on the underlying DataContext. I would like the button's Content to reflect the new value of the property. This works*: <Button Command="{x:Static Member=local:MyCommands.TestCommand}" Content="{Binding Path=TestProperty, Mode=OneWay}" /> But this doesn't: <Button Command="{x:Static Member=local:MyCommands.TestCommand}"> <Button.Style> <Style TargetType="{x:Type Button}"> <Style.Triggers> <DataTrigger Binding="{Binding Path=TestProperty, Mode=OneWay}" Value="True"> <DataTrigger.Setters> <Setter Property="Content" Value="Yes"/> </DataTrigger.Setters> </DataTrigger> <DataTrigger Binding="{Binding Path=TestProperty, Mode=OneWay}" Value="False"> <DataTrigger.Setters> <Setter Property="Content" Value="No"/> </DataTrigger.Setters> </DataTrigger> </Style.Triggers> </Style> </Button.Style> </Button> Why is that? * By "works" I mean the Content gets updated whenever I click the button. TIA

    Read the article

  • Overlaying 2D paths on UIImage without scaling artifacts

    - by tat0
    I need to draw a path along the shape of an image in a way that it is always matching its position on the image independent of the image scale. Think of this like the hybrid view of Google Maps where streets names and roads are superimposed on top of the aerial pictures. Furthermore, this path will be drawn by the user's finger movements and I need to be able to retrieve the path keypoints on the image pixel coordinates. The user zooms-in in order to more precisely set the paths location. I manage to somehow make it work using this approach: -Create a custom UIView called CanvasView that handles touches interaction and delivers scaling, rotation, translation values to either the UIImageView or PathsView (see bellow) depending on a flag: deliverToImageOrPaths. -Create a UIImageView holding the base image. This is set as a children of CanvasView -Create a custom UIView called PathsView that keeps track of the 2D paths geometry and draws itself with a custom drawRect. This is set as children of the UIImageView. So hierarchy: CanvasView - UIImageView -PathsView In this way when deliverToImageOrPaths is YES, finger gestures transforms both the UIImageView and its child PathsView. When deliverToImageOrPaths is NO the gestures affect only the PathsView altering its geometry. So far so good. QUESTION: The problem I have is that when scaling the base UIImageView (via its .transform property) the PathsView is scaled with aliasing artifacts. drawRect is still being called on the PathsView but I guess it's performing the drawing using the original buffer size and then interpolating. How can I solve this issue? Are there better ways to implement these features? PS: I tried changing the PathsView layer class to CATiledLayer with levelsOfDetailBias 4 and levelsOfDetail 4. It solves the aliasing problem to some extent but it's unacceptable slow to render.

    Read the article

  • Django Template tag, generating template block tag

    - by Issy
    Hi Guys, Currently a bit stuck, wondering if anyone can assist. I am using django-adminfiles. Which is a near little application. I want to use it to insert images into posts/articles/pages for a site i am building. How django-adminfiles works is it inserts a placeholder i.e <<< ImageFile and this gets rendered using a django template. It also has the feature of inserting custom options i.e (Insert Medium Image) , i figured i would used this to automatically resize images and include it in the post (similar to how WP does it). Django-adminfiles makes use of sorl.thumbnail app to generate thumbnails. So i have tried testing generating thumbnails: The current template that is used to render the inserted image is: {% spaceless %} <img src="{{ upload.upload.url }}" width="{{ upload.width }}" height="{{ upload.height }}" class="{{ options.class }}" class="{{ options.size }}" alt="{% if options.alt %}{{ options.alt }}{% else %}{{ upload.title }}{% endif %}" /> {% endspaceless %} I tried modifying this to: {% load thumbnail %} {% spaceless %} <img src="{% thumbnail upload.upload.url 200x50 %}" width="{{ upload.width }}" height="{{ upload.height }}" class="{{ options.class }}" class="{{ options.size }}" alt="{% if options.alt %}{{ options.alt }}{% else %}{{ upload.title }}{% endif %}" /> {% endspaceless %} I get the error: Exception Value: Caught an exception while rendering: Source file: '/media/uploads/DSC_0014.jpg' does not exist. I figured the thumbnail needs the absolute path so tried putting that in the template, and that works. i.e this works: {% thumbnail '/Users/me/media/uploads/DSC_0014.jpg' 200x50 %} So basically i need to generate the absolute path to the file give the relative path (to web root). You could do this by passing the MEDIA_ROOT setting to the template, but the reason i want to do a template tag is to programmatically set the image size.

    Read the article

  • Set-Cookie error appearing in logs when deployed to google appengine

    - by Jesse
    I have been working towards converting one of our applications to be threadsafe. When testing on the local dev app server everything is working as expected. However, upon deployment of the application it seems that Cookies are not being written correctly? Within the logs there is an error with no stack trace: 2012-11-27 16:14:16.879 Set-Cookie: idd_SRP=Uyd7InRpbnlJZCI6ICJXNFdYQ1ZITSJ9JwpwMAou.Q6vNs9vGR-rmg0FkAa_P1PGBD94; expires=Wed, 28-Nov-2012 23:59:59 GMT; Path=/ Here is the block of code in question: # area of the code the emits the cookie cookie = Cookie.SimpleCookie() if not domain: domain = self.__domain self.__updateCookie(cookie, expires=expires, domain=domain) self.__updateSessionCookie(cookie, domain=domain) print cookie.output() Cookie helper methods: def __updateCookie(self, cookie, expires=None, domain=None): """ Takes a Cookie.SessionCookie instance an updates it with all of the private persistent cookie data, expiry and domain. @param cookie: a Cookie.SimpleCookie instance @param expires: a datetime.datetime instance to use for expiry @param domain: a string to use for the cookie domain """ cookieValue = AccountCookieManager.CookieHelper.toString(self.cookie) cookieName = str(AccountCookieManager.COOKIE_KEY % self.partner.pid) cookie[cookieName] = cookieValue cookie[cookieName]['path'] = '/' cookie[cookieName]['domain'] = domain if not expires: # set the expiry date to 1 day from now expires = datetime.date.today() + datetime.timedelta(days = 1) expiryDate = expires.strftime("%a, %d-%b-%Y 23:59:59 GMT") cookie[cookieName]['expires'] = expiryDate def __updateSessionCookie(self, cookie, domain=None): """ Takes a Cookie.SessionCookie instance an updates it with all of the private session cookie data and domain. @param cookie: a Cookie.SimpleCookie instance @param expires: a datetime.datetime instance to use for expiry @param domain: a string to use for the cookie domain """ cookieValue = AccountCookieManager.CookieHelper.toString(self.sessionCookie) cookieName = str(AccountCookieManager.SESSION_COOKIE_KEY % self.partner.pid) cookie[cookieName] = cookieValue cookie[cookieName]['path'] = '/' cookie[cookieName]['domain'] = domain Again, the libraries in use are: Python 2.7 Django 1.2 Any suggestion on what I can try?

    Read the article

  • CAShapeLayer slowing down interface rotation

    - by MrMage
    Hi, I am trying to move some custom drawing code from a view into a CAShapeLayer, which then get added as a sublayer to the original view's CALayer. This also works well, but when rotating the device, the animation starts to stutter, e.g. you just see the frame in the original orientation and then the final orientation, with at most one frame in between - not smooth at all. Slide-in and slide-out animations of the corresponding UIViewController are a bit jerky, too (but not that much). All the CAShapeLayer has in its path is one CGPathAddRect, it is set to be opaque, its opacity is 1.0f and the fillColor is set to opaque blue. When drawing the path directly in the views drawRect method, however, the animation is smooth. So I suppose it has something to do with the CAShapeLayer being animated during the rotation. Could you tell me how to either get rid of those jerkiness or just hide the CAShapeLayer when animating? Getting back to just draw CGPaths directly is not an option to me because I rely on the ability of CAShapeLayer to animate its path (it is not animated in my tries with rotating the view). /update: this also happens when the rotating UIViewControllers view contains a view with a subclass of CAGradientLayer as its layerClass (e.g. a view with a gradient layer as background). Cheers MrMage

    Read the article

  • There is no attachment in the sent mail by iPhone

    - by naruhodo
    I'm trying to send a recorded sound file as attachment with MFMailComposeViewController. The sound file is OK. The picker shows the correct file name, shows the audio file icon as attachment, sends the mail, but there is no attachment in the result. I attached below the source of the sent mail. There is a "text/plain" content type part instead of "Content-Disposition: attachment;" as expected. This is my code code to define the path and attach the audio file. What could be wrong? #define DOCUMENTS_FOLDER [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] #define FILEPATH [DOCUMENTS_FOLDER stringByAppendingPathComponent:[self dateString]] ... NSURL *url = [NSURL fileURLWithPath:FILEPATH]; self.recorder = [[AVAudioRecorder alloc] initWithURL:url settings:settings error:&error]; ... MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init]; picker.mailComposeDelegate = self; NSURL *url = [NSURL fileURLWithPath: [NSString stringWithFormat:@"%@", [self.recorder url]]]; NSData *audioData = [NSData dataWithContentsOfFile:[url path]]; [picker addAttachmentData:audioData mimeType:@"audio/wav" fileName:[[url path] lastPathComponent]]; and the source of the sent mail: Content-type: multipart/mixed; boundary=Apple-Mail-1-614960740 Content-transfer-encoding: 7bit MIME-version: 1.0 (iPod Mail 7E18) Subject: Sound message: Date: Sun, 11 Apr 2010 11:58:56 +0200 X-Mailer: iPod Mail (7E18) --Apple-Mail-1-614960740 Content-Type: text/plain;     charset=us-ascii;     format=flowed Content-Transfer-Encoding: 7bit It is a text here --Apple-Mail-1-614960740 Content-Type: text/plain;     charset=us-ascii;     format=flowed Content-Transfer-Encoding: 7bit Sent from my iPod --Apple-Mail-1-614960740--

    Read the article

  • UnicodeDecodeError on attempt to save file through django default filebased backend

    - by Ivan Kuznetsov
    When i attempt to add a file with russian symbols in name to the model instance through default instance.file_field.save method, i get an UnicodeDecodeError (ascii decoding error, not in range (128) from the storage backend (stacktrace ended on os.exist). If i write this file through default python file open/write all goes right. All filenames in utf-8. I get this error only on testing Gentoo, on my Ubuntu workstation all works fine. class Article(models.Model): file = models.FileField(null=True, blank=True, max_length = 300, upload_to='articles_files/%Y/%m/%d/') Traceback: File "/usr/lib/python2.6/site-packages/django/core/handlers/base.py" in get_response 100. response = callback(request, *callback_args, **callback_kwargs) File "/usr/lib/python2.6/site-packages/django/contrib/auth/decorators.py" in _wrapped_view 24. return view_func(request, *args, **kwargs) File "/var/www/localhost/help/wiki/views.py" in edit_article 338. new_article.file.save(fp, fi, save=True) File "/usr/lib/python2.6/site-packages/django/db/models/fields/files.py" in save 92. self.name = self.storage.save(name, content) File "/usr/lib/python2.6/site-packages/django/core/files/storage.py" in save 47. name = self.get_available_name(name) File "/usr/lib/python2.6/site-packages/django/core/files/storage.py" in get_available_name 73. while self.exists(name): File "/usr/lib/python2.6/site-packages/django/core/files/storage.py" in exists 196. return os.path.exists(self.path(name)) File "/usr/lib/python2.6/genericpath.py" in exists 18. st = os.stat(path) Exception Type: UnicodeEncodeError at /edit/ Exception Value: ('ascii', u'/var/www/localhost/help/i/articles_files/2010/03/17/\u041f\u0440\u0438\u0432\u0435\u0442', 52, 58, 'ordinal not in range(128)')

    Read the article

  • Capturing exit status from STDIN in Perl

    - by zigdon
    I have a perl script that is run with a command like this: /path/to/binary/executable | /path/to/perl/script.pl The script does useful things to the output for the binary file, then exits once STDIN runs out (< returns undef). This is all well and good, except if the binary exits with a non-zero code. From the script's POV, it thinks the script just ended cleanly, and so it cleans up, and exits, with a code of 0. Is there a way for the perl script to see what the exit code was? Ideally, I'd want something like this to work: # close STDIN, and if there was an error, exit with that same error. unless (close STDIN) { print "error closing STDIN: $! ($?)\n"; exit $?; } But unfortunately, this doesn't seem to work: $ (date; sleep 3; date; exit 1) | /path/to/perl/script.pl /tmp/test.out Mon Jun 7 14:43:49 PDT 2010 Mon Jun 7 14:43:52 PDT 2010 $ echo $? 0 Is there a way to have it Do What I Mean?

    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

  • ShSetFolderPath works on win7, doesn't on XP

    - by pipboy3k
    Hey. I'm trying to use ShSetFolderPath function in C#. I work on Win7, I've managed to use ShSetKnownFolderPath and it works fine. Since this function is unavaible in WinXP, i tried to invoke ShSetFolderPath. Because i'm not familiar with invoking, I've done some searching and found something on some French forum. I don't speak French, but this declaration makes sense (as written in Remarks of function documentation in MSDN library): [DllImport( "Shell32.dll", CharSet = CharSet.Unicode, EntryPoint = "#232" ) ] private static extern int SHSetFolderPath( int csidl, IntPtr hToken, uint flags, string path ); I call it like that: private static int CSIDL_DESKTOP = 0x0000; public static void SetDesktopPath(string path) { int ret; ret = SHSetFolderPath(CSIDL_DESKTOP, IntPtr.Zero, 0, path); if (ret != 0) { Console.WriteLine(ret); Console.WriteLine(Marshal.GetExceptionForHR(ret)); } } It works in Win7, but in XP function returns -2147024809, which means "Value does not fall within the expected range". My guess is, it's something wrong with Dll importing. Any idea?

    Read the article

  • Elegant way to take basename of directory in Python?

    - by user248237
    I have several scripts that take as input a directory name, and my program creates files in those directories. Sometimes I want to take the basename of a directory given to the program and use it to make various files in the directory. For example, # directory name given by user via command-line output_dir = "..." # obtained by OptParser, for example my_filename = output_dir + '/' + os.path.basename(output_dir) + '.my_program_output' # write stuff to my_filename The problem is that if the user gives a directory name with a trailing slash, then os.path.basename will return the empty string, which is not what I want. What is the most elegant way to deal with these slash/trailing slash issues in python? I know I can manually check for the slash at the end of output_dir and remove it if it's there, but there seems like there should be a better way. Is there? Also, is it OK to manually add '/' characters? E.g. output_dir + '/' os.path.basename() or is there a more generic way to build up paths? Thanks.

    Read the article

< Previous Page | 160 161 162 163 164 165 166 167 168 169 170 171  | Next Page >