Search Results

Search found 1214 results on 49 pages for 'jack sparrow'.

Page 27/49 | < Previous Page | 23 24 25 26 27 28 29 30 31 32 33 34  | Next Page >

  • Force sending a user to custom QuerySet.

    - by Jack M.
    I'm trying to secure an application so that users can only see objects which are assigned to them. I've got a custom QuerySet which works for this, but I'm trying to find a way to force the use of this additional functionality. Here is my Model: class Inquiry(models.Model): ts = models.DateTimeField(auto_now_add=True) assigned_to_user = models.ForeignKey(User, blank=True, null=True, related_name="assigned_inquiries") objects = CustomQuerySetManager() class QuerySet(QuerySet): def for_user(self, user): return self.filter(assigned_to_user=user) (The CustomQuerySetManager is documented over here, if it is important.) I'm trying to force everything to use this filtering, so that other methods will raise an exception. For example: Inquiry.objects.all() ## Should raise an exception. Inquiry.objects.filter(pk=69) ## Should raise an exception. Inquiry.objects.for_user(request.user).filter(pk=69) ## Should work. inqs = Inquiry.objects.for_user(request.user) ## Should work. inqs.filter(pk=69) ## Should work. It seems to me that there should be a way to force the security of these objects by allowing only certain users to access them. I am not concerned with how this might impact the admin interface.

    Read the article

  • Fluxbox compiling problems after making a change.

    - by Jack
    I'm trying to make the change here: http://fluxbox-wiki.org/index.php?title=Howto_Make_dblclick_titlebar_maximize I am using the current git version of the fluxbox source. I assume that those instructions are perhaps no longer valid for the current git version. In the void FluxboxWindow::setupWindow() function I can see no references to CommandRef or frame. I would like to know if it is possible that I could work out where they should go in that function, with only having a limited knowledge? I am still trying to learn programming and don't know enough just yet to work out where they should go. I assume I can't just paste in the suggested lines anywhere in that function, but why not? I can paste the source if needed, but I am unsure where to paste to.

    Read the article

  • Storing a reference to an object in C#

    - by Jack
    I was wondering how one could store a reference to an object in .net. That is, I would like something like the following code (note, of course, that the following code may be way off from how to actually do it): class Test { private /*reference to*/ Object a; public Test(ref int a) { this.a = a; this.a = ((int)this.a) + 1; } public Object getA() { return this.a; } } /* * ... */ static void Main(string[] args) { int a; a=3; Test t = new Test(ref a); Console.WriteLine(a); Console.WriteLine(t.getA()); Console.ReadKey(); } To produce the following output: 4 4 Ideally, I would like to do this without writing a wrapper class around the integer. In other words, I think I want pointers in .Net.

    Read the article

  • Is block style really this important?

    - by Jack Roscoe
    I just watched a video of Douglas Crockford's presentation about his 2009 book JavaScript: The Good Parts. In the video, he explains that the following block is dangerous because it produces silent errors: return { ok: false }; And that it should actually be written like this (emphasising that although seemingly identical the behavioural difference is crucial): return { ok: false }; You can see his comments around 32 minutes into the video here: http://www.youtube.com/watch?v=hQVTIJBZook&feature=player_embedded#!&start=1920 I have not heard this before, and was wondering if this rule still applies or if this requirement in syntax has been overcome by JavaScript developments since this statement was made. I found this very interesting as I have NOT been writing my code this way, and wanted to check that this information was not out of date.

    Read the article

  • How to center list tags inside an unordered list?

    - by Jack
    How can list tags that are given a display:block and are floated left, be centered inside an unordered list. The HTML: <div id="navigation"> <ul> <li>Home</li> <li>About Us</li> <li>Contact</li> <li>News</li> <li>Events</li> <li>Video</li> <li>Photos</li> </ul> </div><!-- navigation --> The CSS: #navigation { border: 3px solid orange; overflow: hidden; } #navigation ul { list-style-type: none; text-align: center; } #navigation ul li { float: left; display: block; padding: 10px 8px; border: 1px solid green; }

    Read the article

  • MySQL won't use index for query?

    - by Jack Sleight
    I have this table: CREATE TABLE `point` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `siteid` INT(11) NOT NULL, `lft` INT(11) DEFAULT NULL, `rgt` INT(11) DEFAULT NULL, `level` SMALLINT(6) DEFAULT NULL, PRIMARY KEY (`id`), KEY `point_siteid_site_id` (`siteid`), CONSTRAINT `point_siteid_site_id` FOREIGN KEY (`siteid`) REFERENCES `site` (`id`) ON DELETE CASCADE ) ENGINE=INNODB AUTO_INCREMENT=35 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci And this query: SELECT * FROM `point` WHERE siteid = 1; Which results in this EXPLAIN information: +----+-------------+-------+------+----------------------+------+---------+------+------+-------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+-------------+-------+------+----------------------+------+---------+------+------+-------------+ | 1 | SIMPLE | point | ALL | point_siteid_site_id | NULL | NULL | NULL | 6 | Using where | +----+-------------+-------+------+----------------------+------+---------+------+------+-------------+ Question is, why isn't the query using the point_siteid_site_id index?

    Read the article

  • How to translate a config.ini file into C#.NET objects

    - by JACK IN THE CRACK
    config.ini: [globalloads] plugin.SWPlugin = 1 plugin.SWPlugin.params.1 = true plugin.SWPlugin.params.2 = 10 [testz : globballoads] plugin.SWPlugin.params.2 = 20 Simple enough? // load testz config and programmatically create this equivalent code: SWPluginAbstract p = new SWPlugin(true, 20); If a different config.ini setup is needed to do that, it's not a problem...

    Read the article

  • How to create a complete binary tree of height 'h' using Python?

    - by Jack
    Here is the node structure class Node: def __init__(self, data): # initializes the data members self.left = None self.right = None self.parent = None self.data = data complete binary tree Definition: A binary tree in which every level, except possibly the deepest, is completely filled. At depth n, the height of the tree, all nodes must be as far left as possible. -- http://www.itl.nist.gov/div897/sqg/dads/HTML/completeBinaryTree.html I am looking for an efficient algorithm.

    Read the article

  • cakephp why can't I have an admin route and a superuser route?

    - by Jack B Nimble
    In core.php I can define Configure::write('Routing.admin', 'admin'); and /admin/controller/index will work. but if I define both Configure::write('Routing.admin', 'admin'); Configure::write('Routing.superuser', 'superuser'); and try to look at /superuser/blah/index/ instead of it saying the controller doesn't exist it says Error: SuperuserController could not be found. instead of saying Error: BlahController could not be found. When I first read the documentation I was under the impression I could run both routes, and not just one or the other. Is there something more I need to do?

    Read the article

  • c++ defining a static member of a template class with type inner class pointer

    - by Jack
    I have a template class like here (in a header) with a inner class and a static member of type pointer to inner class template <class t> class outer { class inner { int a; }; static inner *m; }; template <class t> outer <t>::inner *outer <t>::m; when i want to define that static member i says "error: expected constructor, destructor, or type conversion before '*' token" on the last line (mingw32-g++ 3.4.5)

    Read the article

  • CSS style info library

    - by Bobby Jack
    Is anyone aware of a good javascript library to obtain original (i.e. not computed) style for a given element in the DOM? In other words, something one could use to produce the results in Firebug's style tab. Like Firebug, it should take into account inheritance, shortcut properties, and all the other nuances of CSS.

    Read the article

  • iOS - Rotating view reveals background.

    - by Jack
    Hi, I have created a view that I want to be able to rotate. The two views are: containerView and this has a .backgroundColor of red and BackgroundImage as a subview. Here is my code for rotating: - (void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { [self adjustViewsForOrientation:toInterfaceOrientation]; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return YES; } - (void) adjustViewsForOrientation:(UIInterfaceOrientation)orientation { if (orientation == UIInterfaceOrientationLandscapeLeft || orientation == UIInterfaceOrientationLandscapeRight) { backgroundImage.image = [UIImage imageNamed:@"landscape.jpg"]; backgroundImage.frame = CGRectMake(0, 0, 1024, 704); containerView.frame = CGRectMake(0, 0, 1024, 704); self.title = @"landscape"; } else if (orientation == UIInterfaceOrientationPortrait || orientation == UIInterfaceOrientationPortraitUpsideDown) { backgroundImage.image = [UIImage imageNamed:@"portrait.jpg"]; backgroundImage.frame = CGRectMake(0, 0, 768, 960); containerView.frame = CGRectMake(0, 0, 768, 960); self.title = @"portrait"; } } The problem is that the image rotates, but the background color is shown whilst the view rotates. Is there a nice solution to this problem (I know that I could create the images to blend into a color and set the background to the same color, but this is not what I would like). A Video of the problem can be seen here:http://tinypic.com/r/2quj24g/6 PS the images are from the OmniGroup GitHub repo and are just used for the demo.

    Read the article

  • Javascript CS-PRNG - 64-bit random

    - by Jack
    Hi, I need to generate a cryptographically secure 64-bit unsigned random integer in Javascript. The first problem is that Javascript only allows 64-bit signed integers, so 9223372036854775808 is the biggest supported integer without going into floating point use I think? To fix this I can use a big number library, no problem. My Method: var randNum = SHA256( randBigInt(128, 0) ) % 2^64; Where SHA256() is a secure hash function and randBigInt() is defined below as a non-crypto PRNG, im giving it a 128bit seed so brute force shouldn't be a problem. randBigInt(n,s) //return an n-bit random BigInt (n>=1). If s=1, then the most significant of those n bits is set to 1. Is this a secure method to generate a cryptographically secure 64-bit random int? And importantly does taking the 2^64 mod guarantee 100% I have a 64-bit number? An abstract example, say this number is prime (it isn't i know), I will use it in the Galois Field [2^p], where p must be 64bits so that every possible 1-63bit number is a field element. In this query, my random int must be larger than any 63-bit number. And Im not sure im correct in taking the 2^64 mod of a 256bit hash output. Thanks (hope that makes sense)

    Read the article

  • c++ use of winmain()

    - by Jack
    Hi, I just started learning programming for windows in c++. I had this crazy image, that win32 programming is based on calling windows functions and sending parameters to and from them. Like, when you want to create window, you call some win32 function that handles windows GUI and say "Hi, please, create me new window, 100 x 100 px, with two buttons", and that GUI function says "Hi, no problem, when something happends, like user clicks one button, I will change this variable xy located in this location". So, I thought that it will be very similiar to console programming. But the very first instruction surprised me. I always thought that every program executes main() function first. So, when I launch app, windows stores some parameters on top of stack and run that application. So I assumed that initializing main() is just a c++ way to tell the compiler where the first instruction should be. But in win32 programming, there is function called winmain() which starts first. So I am little confused. I thought it´s rule that compiler must have main() to start with, that main just defines where ti start, like some start point identifier. So, please, why is there winmain() function instead of main()? When I thought that C++ programming is as logical as assembler, it confuses me once again.

    Read the article

  • c++ use of winmain()

    - by Jack
    Hi, I just started learning programming for windows in c++. I had this crazy image, that win32 programming is based on calling windows functions and sending parameters to and from them. Like, when you want to create window, you call some win32 function that handles windows GUI and say "Hi, please, create me new window, 100 x 100 px, with two buttons", and that GUI function says "Hi, no problem, when something happends, like user clicks one button, I will change this variable xy located in this location". So, I thought that it will be very similiar to console programming. But the very first instruction surprised me. I always thought that every program executes main() function first. So, when I launch app, windows stores some parameters on top of stack and run that application. So I assumed that initializing main() is just a c++ way to tell the compiler where the first instruction should be. But in win32 programming, there is function called winmain() which starts first. So I am little confused. I thought it´s rule that compiler must have main() to start with, that main just defines where ti start, like some start point identifier. So, please, why is there winmain() function instead of main()? When I thought that C++ programming is as logical as assembler, it confuses me once again.

    Read the article

  • web service client authentication

    - by Jack
    I want to consume Java based web service with c#.net client. The problem is, I couldnt authenticate to the service. it didnt work with this: mywebservice.Credentials = new System.Net.NetworkCredential(userid, userpass); I tried to write base class for my client method. public class ClientProtocols : SoapHttpClientProtocol { protected override WebRequest GetWebRequest(Uri uri) { System.Net.WebRequest request = base.GetWebRequest(uri); if (null != Credentials) request.Headers.Add("Authorization", GetAuthHeader()); return request; } protected override WebResponse GetWebResponse(WebRequest request) { WebResponse response = base.GetWebResponse(request); return response; } private string GetAuthHeader() { StringBuilder sb = new StringBuilder(); sb.Append("Basic "); NetworkCredential cred = Credentials.GetCredential(new Uri(Url), "Basic"); string s = string.Format("{0}:{1}", cred.UserName, cred.Password); sb.Append(Convert.ToBase64String(Encoding.ASCII.GetBytes(s))); return sb.ToString(); } } How can I use this class and authorize to the web service? Thanks.

    Read the article

  • Crystal Report with mutliple row columns.

    - by Jack
    I'm not sure if the title properly explains what I'm trying to do. I'm trying to move from using SQL Reporting Services to a Crystal Reports Web App. I've gotten some reports to design properly because they are simple cross-tab reports that require nothing special. I'm running into a little problem of a user matrix report. Here's how the report looks on SQL Reporting Services: group1 group2 group3 username1 first1 last1 title1 X X username2 first2 last2 title2 X X 2 1 1 Normally in VS2008 with a SQL rdl, I would right click on the row and Insert Column. However, i don't see a way to do this in Crystal Reports. I've tried setting up multiple row groups, but that adds mutliple groupings like: group1 Total ... Username Total ... first Total ... last ...

    Read the article

  • How to disable html button using JavaScript?

    - by Jack Roscoe
    Hi, I've read that you can disable (make physically unclickable) a html button simply but appending 'disable' to its tag, but not as an attribute, as follows: <input type="button" name=myButton value="disable" disabled> Since this setting is not an attribute, how can I add this in dynamically via JavaScript to disable a button that was previously enabled?

    Read the article

  • Some good websites to learn about JavaScript and programming architecture?

    - by Jack Roscoe
    I'm not sure if 'architecture' is the correct term, but I've been looking for some articles online which talk about programming design and more about how best to use languages such as JavaScript in a code design sense rather than the actual syntax itself. I have found many websites but a lot seem to be very out dated, and I'm not sure what developments have taken place with JavaScript over the years so do not know how old is too old. If anybody could suggest some great websites, or maybe specific articles you think would be useful, that would be highly appreciated. I am a beginner programmer currently using JavaScript with XML and of course HTML & CSS, and I'm currently trying to get further into and learn more about web development.

    Read the article

  • How do CUDA devices handle immediate operands?

    - by Jack Lloyd
    Compiling CUDA code with immediate (integer) operands, are they held in the instruction stream, or are they placed into memory? Specifically I'm thinking about 24 or 32 bit unsigned integer operands. I haven't been able to find information about this in any of the CUDA documentation I've examined so far. So references to any documents on specific uarch details like this would be perfect, as I don't currently have a good model for how CUDA works at this level.

    Read the article

  • Nhibernate.Bytecode.Castle Trust Level on IIS

    - by jack london
    Trying to deploy the wcf service, depended on nhibernate. And getting the following exception On Reflection activator. [SecurityException: That assembly does not allow partially trusted callers.] System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Assembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed) +150 System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck) +0 System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache) +86 System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache) +230 System.Activator.CreateInstance(Type type, Boolean nonPublic) +67 NHibernate.Bytecode.ActivatorObjectsFactory.CreateInstance(Type type) +8 NHibernate.Driver.ReflectionBasedDriver.CreateConnection() +28 NHibernate.Connection.DriverConnectionProvider.GetConnection() +56 NHibernate.Tool.hbm2ddl.SchemaExport.Execute(Action`1 scriptAction, Boolean export, Boolean justDrop) +376 in IIS configuration service's trust level is Full-trust also application's web config's trust level is full. how could i make this service in working state?

    Read the article

  • Unsure how to design JavaScript / jQuery functionality which uses XML to create HTML objects

    - by Jack Roscoe
    Hi, I'm using JavScript and jQuery to read an XML document and subsequently use the information from the XML to create HTML objects. The main 'C' nodes in the XML document all have a type attribute, and depending on the type I want to run a function which will create a new html object using the other attributes assigned to that particular 'C' node node. Currently, I have a for loop which extracts each 'C' node from the XML and also it's attributes (e.g. width, height, x, y). Also inside the for loop, I have an if statement which checks the 'type' attribute of the current 'C' node being processed, and depending on the type it will run a different function which will then create a new HTML object with the attributes which have been drawn from the XML. The problem is that there may be more than one 'C' node of the same type, so for example when I'm creating the function that will run when a 'C' node of 'type=1' is detected, I cannot use the 'var p = document.createElement('p')' because if a 'C' node of the same type comes up later in the loop it will clash and override that element with that variable that has just been created. I'm not really sure how to approach this? Here is my entire script. If you need me to elaborate on any parts please ask, I'm sure it's not written in the nicest possible way: var arrayIds = new Array(); $(document).ready(function(){ $.ajax({ type: "GET", url: "question.xml", dataType: "xml", success: function(xml) { $(xml).find("C").each(function(){ arrayIds.push($(this).attr('ID')); }); var svgTag = document.createElement('SVG'); // Create question type objects function ctyp3(x,y,width,height,baC) { alert('test'); var r = document.createElement('rect'); r.x = x; r.y = y; r.width = width; r.height = height; r.fillcolor = baC; svgTag.appendChild(r); } // Extract question data from XML var questions = []; for (j=0; j<arrayIds.length; j++) { $(xml).find("C[ID='" + arrayIds[j] + "']").each(function(){ // pass values questions[j] = { typ: $(this).attr('typ'), width: $(this).find("I").attr('wid'), height: $(this).find("I").attr('hei'), x: $(this).find("I").attr('x'), y: $(this).find("I").attr('x'), baC: $(this).find("I").attr('baC'), boC: $(this).find("I").attr('boC'), boW: $(this).find("I").attr('boW') } alert($(this).attr('typ')); if ($(this).attr('typ') == '3') { ctyp3(x,y,width,height,baC); // alert('pass'); } else { // Add here // alert('fail'); } }); } } }); });

    Read the article

  • Can I make valgrind ignore glibc libraries?

    - by Jack
    Is it possible to tell valgrind to ignore some set of libraries? Specifically glibc libraries.. Actual Problem: I have some code that runs fine in normal execution. No leaks etc. When I try to run it through valgrind, I get core dumps and program restarts/stops. Core usually points to glibc functions (usually fseek, mutex etc). I understand that there might be some issue with incompatible glibc / valgrind version. I tried various valgrind releases and glibc versions but no luck. Any suggestions?

    Read the article

  • Leak caused by fread

    - by Jack
    I'm profiling code of a game I wrote and I'm wondering how it is possible that the following snippet causes an heap increase of 4kb (I'm profiling with Heapshot Analysis of Xcode) every time it is executed: u8 WorldManager::versionOfMap(FILE *file) { char magic[4]; u8 version; fread(magic, 4, 1, file); <-- this is the line fread(&version,1,1,file); fseek(file, 0, SEEK_SET); return version; } According to the profiler the highlighted line allocates 4.00Kb of memory with a malloc every time the function is called, memory which is never released. This thing seems to happen with other calls to fread around the code, but this was the most eclatant one. Is there anything trivial I'm missing? Is it something internal I shouldn't care about? Just as a note: I'm profiling it on an iPhone and it's compiled as release (-O2).

    Read the article

< Previous Page | 23 24 25 26 27 28 29 30 31 32 33 34  | Next Page >