Search Results

Search found 19688 results on 788 pages for 'con current'.

Page 53/788 | < Previous Page | 49 50 51 52 53 54 55 56 57 58 59 60  | Next Page >

  • How do I underline parent menu item but not children?

    - by Steven
    Using Wordpress menu "builder", I get the following code: //Pseaudo code <ul id="main-menu-main"> <li class="menu-item"><a></a></li> <li class="menu-item current-menu-ancestor"> <a></a> <ul class="sub-menu"> <li class="menu-item"><a></a></li> <li class="menu-item current-menu-item"><a></a></li> </ul> </li> </ul> // and I use the following CSS #menu-main-menu a:hover { text-decoration: underline; } #menu-main-menu .current-menu-ancestor a { text-decoration: underline; } The problem with my last css line, is that all a elements under current-menu-ancestor are underlined. I only want the link in current-menu-ancestor to be underlined. I think this should be pretty simple, but right now my head is not focused :-/ The full code for parent / child looks like this: <ul id="menu-main-menu" class="menu"> <li id="menu-item-401" class="menu-item-first menu-item menu-item-type-post_type menu-item-object-page current-page-ancestor current-menu-ancestor current-menu-parent current-page-parent current_page_parent current_page_ancestor menu-item-401"> <a>menu 1</a> <ul class="sub-menu"> <li id="menu-item-444" class="menu-item menu-item-type-post_type menu-item-object-page current-menu-item page_item page-item-415 current_page_item menu-item-444"> <a> sub 1</a> </li> </ul> </li>

    Read the article

  • how to refer to the current struct in an overloaded operator?

    - by genesys
    Hi! I have a struct for which i want to define a relative order by defining < , , <= and = operators. actually in my order there won't be any equality, so if one struct is not smaller than another, it's automatically larger. I defined the first operator like this: struct MyStruct{ ... ... bool operator < (const MyStruct &b) const {return (somefancycomputation);} }; now i'd like to define the other operators based on this operator, such that <= will return the same as < and the other two will simply return the oposite. so for example for the operator i'd like to write something like bool operator > (const MyStruct &b) const {return !(self<b);} but i don't know how to refere to this 'self' since i can refere only to the fields inside the current struct. whole is in C++ hope my question was understandable :) thank you for the help!

    Read the article

  • Undefined referencec to ...

    - by Patrick LaChance
    I keep getting this error message every time I try to compile, and I cannot find out what the problem is. any help would be greatly appreciated: C:\DOCUME~1\Patrick\LOCALS~1\Temp/ccL92mj9.o:main.cpp:(.txt+0x184): undefined reference to 'List::List()' C:\DOCUME~1\Patrick\LOCALS~1\Temp/ccL92mj9.o:main.cpp:(.txt+0x184): undefined reference to 'List::add(int)' collect2: ld returned 1 exit status code: //List.h ifndef LIST_H define LIST_H include //brief Definition of linked list class class List { public: /** \brief Exception for operating on empty list */ class Empty : public std::exception { public: virtual const char* what() const throw(); }; /** \brief Exception for invalid operations other than operating on an empty list */ class InvalidOperation : public std::exception { public: virtual const char* what() const throw(); }; /** \brief Node within List */ class Node { public: /** data element stored in this node */ int element; /** next node in list / Node next; /** previous node in list / Node previous; Node (int element); ~Node(); void print() const; void printDebug() const; }; List(); ~List(); void add(int element); void remove(int element); int first()const; int last()const; int removeFirst(); int removeLast(); bool isEmpty()const; int size()const; void printForward() const; void printReverse() const; void printDebug() const; /** enables extra output for debugging purposes */ static bool traceOn; private: /** head of list */ Node* head; /** tail of list */ Node* tail; /** count of number of nodes */ int count; }; endif //List.cpp I only included the parts of List.cpp that might be the issue include "List.h" include include using namespace std; List::List() { //List::size = NULL; head = NULL; tail = NULL; } List::~List() { Node* current; while(head != NULL) { current = head- next; delete current-previous; if (current-next!=NULL) { head = current; } else { delete current; } } } void List::add(int element) { Node* newNode; Node* current; newNode-element = element; if(newNode-element head-element) { current = head-next; } else { head-previous = newNode; newNode-next = head; newNode-previous = NULL; return; } while(newNode-element current-element) { current = current-next; } if(newNode-element <= current-element) { newNode-previous = current-previous; newNode-next = current; } } //main.cpp include "List.h" include include using namespace std; //void add(int element); int main (char** argv, int argc) { List* MyList = new List(); bool quit = false; string value; int element; while(quit==false) { cinvalue; if(value == "add") { cinelement; MyList-add(element); } if(value=="quit") { quit = true; } } return 0; } I'm doing everything I think I'm suppose to be doing. main.cpp isn't complete yet, just trying to get the add function to work first. Any help will be greatly appreciated.

    Read the article

  • IsAuthenticated is false! weird behaviour + review question

    - by Naor
    This is the login function (after I validate user name and password, I load user data into "user" variable and call Login function: public static void Login(IUser user) { HttpResponse Response = HttpContext.Current.Response; HttpRequest Request = HttpContext.Current.Request; FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, user.UserId.ToString(), DateTime.Now, DateTime.Now.AddHours(12), false, UserResolver.Serialize(user)); HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, FormsAuthentication.Encrypt(ticket)); cookie.Path = FormsAuthentication.FormsCookiePath; Response.Cookies.Add(cookie); string redirectUrl = user.HomePage; Response.Redirect(redirectUrl, true); } UserResolver is the following class: public class UserResolver { public static IUser Current { get { IUser user = null; if (HttpContext.Current.User.Identity.IsAuthenticated) { FormsIdentity id = (FormsIdentity)HttpContext.Current.User.Identity; FormsAuthenticationTicket ticket = id.Ticket; user = Desrialize(ticket.UserData); } return user; } } public static string Serialize(IUser user) { StringBuilder data = new StringBuilder(); StringWriter w = new StringWriter(data); string type = user.GetType().ToString(); //w.Write(type.Length); w.WriteLine(user.GetType().ToString()); StringBuilder userData = new StringBuilder(); XmlSerializer serializer = new XmlSerializer(user.GetType()); serializer.Serialize(new StringWriter(userData), user); w.Write(userData.ToString()); w.Close(); return data.ToString(); } public static IUser Desrialize(string data) { StringReader r = new StringReader(data); string typeStr = r.ReadLine(); Type type=Type.GetType(typeStr); string userData = r.ReadToEnd(); XmlSerializer serializer = new XmlSerializer(type); return (IUser)serializer.Deserialize(new StringReader(userData)); } } And the global.asax implements the following: void Application_PostAuthenticateRequest(Object sender, EventArgs e) { IPrincipal p = HttpContext.Current.User; if (p.Identity.IsAuthenticated) { IUser user = UserResolver.Current; Role[] roles = user.GetUserRoles(); HttpContext.Current.User = Thread.CurrentPrincipal = new GenericPrincipal(p.Identity, Role.ToString(roles)); } } First question: Am I do it right? Second question - weird thing! The user variable I pass to Login has 4 members: UserName, Password, Name, Id. When UserResolver.Current executed, I got the user instance. I descided to change the user structure - I add an array of Warehouse object. Since that time, when UserResolver.Current executed (after Login), HttpContext.Current.User.Identity.IsAuthenticated was false and I couldn't get the user data. When I removed the Warehouse[] from user structure, it starts to be ok again and HttpContext.Current.User.Identity.IsAuthenticated become true after I Login. What is the reason to this weird behaviour?

    Read the article

  • How do I [legally] get the current first responder on the screen on an iPhone?

    - by Anthony D
    I submitted my app a little over a week ago and got the dreaded rejection email today. It reads as follows: Dear -----------, Thank you for submitting --------- to the App Store. Unfortunately it cannot be added to the App Store because it is using a private API. Use of non-public APIs, which as outlined in the iPhone Developer Program License Agreement section 3.3.1 is prohibited: "3.3.1 Applications may only use Documented APIs in the manner prescribed by Apple and must not use or call any private APIs." The non-public API that is included in your application is firstResponder. Regards, iPhone Developer Program Now, the offending API call is actually a solution I found here on SO: UIWindow *keyWindow = [[UIApplication sharedApplication] keyWindow]; UIView *firstResponder = [keyWindow performSelector:@selector(firstResponder)]; So this is my question; How do I get the current first responder on the screen? I'm looking for a legal way that won't get my app rejected. Thanks. I figured this out based on the solution provided by Thomas below. Here is what the final code looks like: @implementation UIView (FindFirstResponder) - (UIView *)findFirstResonder { if (self.isFirstResponder) { return self; } for (UIView *subView in self.subviews) { UIView *firstResponder = [subView findFirstResonder]; if (firstResponder != nil) { return firstResponder; } } return nil; } @end

    Read the article

  • How do I search a NTEXT column for XML attributes and update the values? MS SQL 2005

    - by Alan
    Duplicate: this exact question was asked by the same author in http://stackoverflow.com/questions/1221583/how-do-i-update-a-xml-string-in-an-ntext-column-in-sql-server. Please close this one and answer in the original question. I have a SQL table with 2 columns. ID(int) and Value(ntext) The value rows have all sorts of xml strings in them. ID Value -- ------------------ 1 <ROOT><Type current="TypeA"/></ROOT> 2 <XML><Name current="MyName"/><XML> 3 <TYPE><Colour current="Yellow"/><TYPE> 4 <TYPE><Colour current="Yellow" Size="Large"/><TYPE> 5 <TYPE><Colour current="Blue" Size="Large"/><TYPE> 6 <XML><Name current="Yellow"/><XML> How do I: A. List the rows where <TYPE><Colour current="Yellow", bearing in mind that there is an entry <XML><Name current="Yellow"/><XML> B. Modify the rows that contain <TYPE><Colour current="Yellow" to be <TYPE><Colour current="Purple" Thanks! 4 your help

    Read the article

  • Operation is not valid due to the current state of the object?

    - by Bill
    I am programming in C#; the code was working about a week ago, however it throws an exception and I don't understand at all what could be wrong with it. Var root = new CalculationNode(); -> Throw exception. In the call stack thats the only thing listed, I've been told that it could be that I need a clean build, but I am open to any ideas or suggestions. Thanks, -Bill Update: Exception's Detail System.InvalidOperationException was unhandled by user code Message=Operation is not valid due to the current state of the object. Source=Calculator.Logic StackTrace: at ~.Calculator.Logic.MyBaseExpressionParser.Parse(String expression) in ~\Source\Calculator.Logic\MyBaseExpressionParser.cs:line 44 at ~.Calculator.Logic.Tests.MyBaseCalculatorServiceTests.BasicMathDivision() in ~\Projects\Tests\Calculator.Logic.Tests\MyBaseCalculatorServiceTests.cs:line 60 InnerException: CalculationNode's code: public sealed calss CalculationNode { public CalculationNode() { this.Left = null; this.Right = null; this.Element = new CalculationElement(); } public CalculationNode Left {get;set;} public CalculationNode Right {get;set;} public CalculationElement Element {get; set;} } CalculationElement's code: public sealed class CalculationElement { public CalculationElement() { Value = string.Empty; IsOperator = false; } public string Value {get; set} public bool IsOperator {get; set} }

    Read the article

  • Java Binary Tree. Priting InOrder traversal

    - by user69514
    I am having some problems printing an inOrder traversal of my binary tree. Even after inserting many items into the tree it's only printing 3 items. public class BinaryTree { private TreeNode root; private int size; public BinaryTree(){ this.size = 0; } public boolean insert(TreeNode node){ if( root == null) root = node; else{ TreeNode parent = null; TreeNode current = root; while( current != null){ if( node.getData().getValue().compareTo(current.getData().getValue()) <0){ parent = current; current = current.getLeft(); } else if( node.getData().getValue().compareTo(current.getData().getValue()) >0){ parent = current; current = current.getRight(); } else return false; if(node.getData().getValue().compareTo(parent.getData().getValue()) < 0) parent.setLeft(node); else parent.setRight(node); } } size++; return true; } /** * */ public void inOrder(){ inOrder(root); } private void inOrder(TreeNode root){ if( root.getLeft() !=null) this.inOrder(root.getLeft()); System.out.println(root.getData().getValue()); if( root.getRight() != null) this.inOrder(root.getRight()); } }

    Read the article

  • What is the current status of LOGO? (The programming language)

    - by Workshop Alex
    In another Q I saw someone mention LOGO and it reminded me of some programming language from the past, mostly used for educational purposes. Basically, you would have to program a turtle with a pen through it's back. By telling it where to move, the pen would draw lines. It could also lift the pen to move without drawing lines. I have fond memories of this language, since it was one of the first I've ever used, about 30 years ago. (Yeah, I'm old.) Well, I only programmed with LOGO for two days or so, but it got me hooked to programming. But I wonder if the LOGO information on it's Wikipedia page is still correct. And more importantly, are there versions that will create .NET binaries? Are there only LOGO Interpreters and no compilers? What is the current status of this educational language? And more interestingly, are there more experts here at SO who have experimented with LOGO in the past? Yeah, I know. Nowadays this language is a bit antique but I got some warm and comfortable memories when I remembered this interesting language from my history. For a teenager back then, it was fun!

    Read the article

  • How to change the css class="current" when using page jumping (single page website)?

    - by Bryan
    Morning, I must be asking google all the wrong questions, because I can't find anything similar. I have a standard navigation list, but I'm using page jumping because I wanted a single web page. <ul> <li><a href="#livestream">Livestream</a></li> <li><a href="#media">Media</a></li> <li><a href="#crew">Crew</a></li> <li><a href="#services">Services</a></li> <li><a href="#contact">Contact</a></li> </ul> But I can't for the life of me figure out how to make the class="current" when using page jumping. I've tried this bit of jquery because it appears to be what I'm looking for, but it did nothing. I don't think it'll work for #links. Any ideas?

    Read the article

  • A Star Path finding endless loop

    - by PoeHaH
    I have implemented A* algorithm. Sometimes it works, sometimes it doesn't, and it goes through an endless loop. After days of debugging and googling, I hope you can come to the rescue. This is my code: The algorythm: public ArrayList<Coordinate> findClosestPathTo(Coordinate start, Coordinate goal) { ArrayList<Coordinate> closed = new ArrayList<Coordinate>(); ArrayList<Coordinate> open = new ArrayList<Coordinate>(); ArrayList<Coordinate> travelpath = new ArrayList<Coordinate>(); open.add(start); while(open.size()>0) { Coordinate current = searchCoordinateWithLowestF(open); if(current.equals(goal)) { return travelpath; } travelpath.add(current); open.remove(current); closed.add(current); ArrayList<Coordinate> neighbors = current.calculateCoordAdjacencies(true, rowbound, colbound); for(Coordinate n:neighbors) { if(closed.contains(n) || map.isWalkeable(n)) { continue; } int gScore = current.getGvalue() + 1; boolean gScoreIsBest = false; if(!open.contains(n)) { gScoreIsBest = true; n.setHvalue(manhattanHeuristic(n,goal)); open.add(n); } else { if(gScore<n.getGvalue()) { gScoreIsBest = true; } } if(gScoreIsBest) { n.setGvalue(gScore); n.setFvalue(n.getGvalue()+n.getHvalue()); } } } return null; } What I have found out is that it always fails whenever there's an obstacle in the path. If I'm running it on 'open terrain', it seems to work. It seems to be affected by this part: || map.isWalkeable(n) Though, the isWalkeable function seems to work fine. If additional code is needed, I will provide it. Your help is greatly appreciated, Thanks :)

    Read the article

  • How to inherit the current path when invoking Maven's exec-maven-plugin?

    - by wishihadabettername
    I have an <exec-maven-plugin> which calls an external command (in this case, svnversion). The command is in the path for the current user. However, when a separate shell is spawned by the plugin, the path is not initialized. I don't want to hardcode or define a variable for each external command (there would be too much to maintain, especially that there are both Windows and *nix users). My pom.xml contains the following: <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.1</version> <executions> <execution> <id>svnversion-exec</id> <phase>process-resources</phase> <goals> <goal>exec</goal> </goals> <configuration> <executable>svnversion</executable> <arguments> <argument><![CDATA[ >version.txt ]]></argument> </arguments> </configuration> </execution> </executions> </plugin> Currently I get the following output: [INFO] [exec:exec {execution: svnversion-exec}] 'svnversion' is not recognized as an internal or external command, operable program or batch file. [ERROR] BUILD ERROR: Result of cmd.exe /X /C "svnversion >version.txt" execution is: '1'. Thank you!

    Read the article

  • Deleting a node in a circular linked list c++?

    - by angad Soni
    I was wondering if anyone could help me understand if this code for deleting a node from a circular linked list would work, or if there is something i'm missing out on. using c++ to code. void circularList::deleteNode(int x) { node *current; node *temp; current = this-start; while(current->next != this->start) { if(current->next->value == x) { temp = current->next; current->next = current->next->next; delete current->next; } } }

    Read the article

  • Can't sent xml file from Web Application on Internet Explorer

    - by nCdy
    Error is something like that : Can't load Items.aspx from 192.168.0.172 And a text is Can't open this web-site. It can't be found. Try later code : HttpContext.Current.Response.Clear(); HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache); HttpContext.Current.Response.Charset = System.Text.Encoding.Unicode.EncodingName; HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.Unicode; HttpContext.Current.Response.BinaryWrite(System.Text.Encoding.Unicode.GetPreamble()); HttpContext.Current.Response.ContentType = "application/vnd.ms-excel"; HttpContext.Current.Response.AddHeader( "content-disposition", string.Format( "attachment; filename={0}",fileName)); .... table.RenderControl(htw); HttpContext.Current.Response.Write(sw.ToString()); HttpContext.Current.Response.End(); Trouble with this file is only for Internet Explorer (works on opera / firefox ... ) And so it works for HTML with no HttpContext.Current.Response.ContentType = "application/vnd.ms-excel"; this string

    Read the article

  • SSRS How to access the current value within a list control?

    - by Dale Burrell
    In SQL Server Reporting Services I have a report which has a list control which groups on currency. Within the list control I display the detailed rows of all records filtered to those with a value = £500. i.e. the top earners. However for each row I need to calculate the percentage of its amount over the total of the entire dataset. Because I am filtering it I can't use Sum(Fields!Amount.Value) as that only sums the data after filtering, so I am trying a conditional sum over the entire dataset, but am struggling with the correct condition e.g =100.00*Fields!Amount.Value/Sum((IIf(Fields!Currency.Value = "£", Fields!Amount.Value, CDec(0))),"DataSet") So where the hardcoded currency symbol is I need to access the current value of currency for the list control, but because my sum is scoped at dataset level any field access is dataset level. Ideally I'd like something like the following, otherwise any other ideas on how to solve this problem. =100.00*Fields!Amount.Value/Sum((IIf(Fields!Currency.Value = myListControl.Value, Fields!Amount.Value, CDec(0))),"DataSet") In fact, thinking about it, it would work if I just could access the row level data at that point, but how to do that when its at dataset scope within the sum statement? Hope that makes sense, any help appreciated.

    Read the article

  • NFS compound failed for server foosrv: error 7 (RPC: Authentication error)

    - by automatthias
    I'm setting up an Ubuntu NFS server with a Solaris 10 client. The basic configuration looks okay to me, and it was also working for some time. I'm getting an "RPC: Authentication error" message on the client. server /etc/exports: /export/opencsw-future 192.168.3.0/24(rw,nohide,insecure,no_subtree_check,async) /export/opencsw-current 192.168.3.0/24(rw,nohide,insecure,no_subtree_check,async) $ ls -ld /export/opencsw-current drwxr-xr-x 7 maciej maciej 4096 2012-02-05 14:55 /export/opencsw-current client $ grep opencsw /etc/vfstab foosrv:/opencsw-current - /export/opencsw-current nfs - yes - $ sudo mount /export/opencsw-current NFS compound failed for server foosrv: error 7 (RPC: Authentication error) (...repeated...) nfs mount: mount: /export/opencsw-current: Permission denied My server host name resolves to both IPv4 and IPv6 addresses.

    Read the article

  • XSLT: Using a different way of processing within the current way of processing.

    - by krisvandenbergh
    Below I'm trying to match certain nodes. <xsl:template match="nodes"> <element> <xsl:apply-templates select="nodes" mode="different" /> </element> </xsl:template> Now, there are multiple ways of processing for the same nodes. I want to use this different way of processing within the current way of processing. That's why I perform apply-templates on the same selection, which is nodes, however the mode is different now. Here's how the different mode could look like: <xsl:template match="nodes" mode="different"> <!-- another way of processing these nodes --> </xsl:template> Now, this does not work. Only the first type of processing is processed and the apply-templates call is simply not applied. What am I doing wrong, how can I get what I want using XSLT? What could be another approach to solve this problem?

    Read the article

  • chrome extension: get specific part of the current tab page in DOM object and display it in either popup.html or new html page?

    - by sandeep
    IS there any way so that i can convert any DOM object into HTML page within the script ? suppose I have dom object like this: content script.js chrome.extension.onRequest.addListener(function(request, sender, sendResponse) { if (request.method == "fromPopup") { console.log("got Request from Popup"); var myDivObj = document.getElementById("definition"); //sendResponse({data: "from Content Script to Popup"}); if ( myDivObj ) { sendResponse({data:myDivObj}); } else{ sendResponse({data:"Empty or No Tag"}); } console.log("sent Response1"); } else { sendResponse({}); // snub them. console.log("sent Response2"); } }); here is my popup.html <body> <Div>Searching..</Div> <Div id="output">Response??</Div> <script> console.log("Pop UP Clicked"); chrome.tabs.getSelected(null, function(tab) { chrome.tabs.sendRequest(tab.id, {method: "fromPopup", tabid: tab.id}, function(response) { console.log("got Response from Content Script"); document.getElementById("output").innerHTML=response.data; }); }); </script> </body> I know we can send onaly JSON type of data to the popup.html page.. am i right ? If yes is ther any way that I can creat HTML page with DOM Object( myDivObj ) which I collected.. Any alternative solution..? In short i want get only specific part of the current tab page in DOM object and display it in either popup.html or separate html page..

    Read the article

  • Tree iterator, can you optimize this any further?

    - by Ron
    As a follow up to my original question about a small piece of this code I decided to ask a follow up to see if you can do better then what we came up with so far. The code below iterates over a binary tree (left/right = child/next ). I do believe there is room for one less conditional in here (the down boolean). The fastest answer wins! The cnt statement can be multiple statements so lets make sure this appears only once The child() and next() member functions are about 30x as slow as the hasChild() and hasNext() operations. Keep it iterative <-- dropped this requirement as the recursive solution presented was faster. This is C++ code visit order of the nodes must stay as they are in the example below. ( hit parents first then the children then the 'next' nodes). BaseNodePtr is a boost::shared_ptr as thus assignments are slow, avoid any temporary BaseNodePtr variables. Currently this code takes 5897ms to visit 62200000 nodes in a test tree, calling this function 200,000 times. void processTree (BaseNodePtr current, unsigned int & cnt ) { bool down = true; while ( true ) { if ( down ) { while (true) { cnt++; // this can/will be multiple statesments if (!current->hasChild()) break; current = current->child(); } } if ( current->hasNext() ) { down = true; current = current->next(); } else { down = false; current = current->parent(); if (!current) return; // done. } } }

    Read the article

  • Client Side pagination with jQuery

    - by TheNone
    I have tried to write a script for pagination contents of an element with jQuery: <script type="text/javascript"> $(document).ready(function(){ var per_page = 2; var num_item = $('#en1').children().size(); var num_page = Math.ceil(num_item/per_page); $('#current_page').val(0); $('#per_page').val(per_page); var navigation_html = ''; var current = 0; while(num_page > current){ navigation_html += '<a class="page_link" href="javascript:paginate(' + current +')" longdesc="' + current +'">'+ (current + 1) +'</a>'; current++; } $('#page_navigation').html(navigation_html); $('#page_navigation .page_link:first').addClass('active_page'); $('#en1').children().css('display', 'none'); $('#en1').children().slice(0, per_page).css('display', 'block'); }); function paginate(page_num){ var per_page = parseInt($('#per_page').val()); start = page_num * per_page; finish= start + per_page; $('#en1').children().css('display', 'none').slice(start, finish).css('display', 'block'); $('.page_link[longdesc=' + page_num +']').addClass('active_page').siblings('.active_page').removeClass('active_page'); $('#current_page').val(page_num); } </script> http://jsfiddle.net/kqfyL/9/ This script paginate the contents of element by id "en1". I want to paginate 4-5 element (en2, en3, ...). When I insert code inside o document ready in a function, pagination doesnt work: function init(myId){ var ID = document.getElementById("myId"); var per_page = 6; var num_item = $(ID).children().size(); var num_page = Math.ceil(num_item/per_page); $('#current_page').val(0); $('#per_page').val(per_page); var navigation_html = ''; var current = 0; while(num_page > current){ navigation_html += '<a class="page_link" href="javascript:paginate(' + current +')" longdesc="' + current +'">'+ (current + 1) +'</a>'; current++; } $('#page_navigation').html(navigation_html); $('#page_navigation .page_link:first').addClass('active_page'); $('#ID').children().css('display', 'none'); $('#ID').children().slice(0, per_page).css('display', 'block'); } init(en1); What is wrong in init function? Thanks in advance

    Read the article

  • XNA Xbox 360 Content Manager Thread freezing Draw Thread

    - by Alikar
    I currently have a game that takes in large images, easily bigger than 1MB, to serve as backgrounds. I know exactly when this transition is supposed to take place, so I made a loader class to handle loading these large images in the background, but when I load the images it still freezes the main thread where the drawing takes place. Since this code runs on the 360 I move the thread to the 4th hardware thread, but that doesn't seem to help. Below is the class I am using. Any thoughts as to why my new content manager which should be in its own thread is interrupting the draw in my main thread would be appreciated. namespace FileSystem { /// <summary> /// This is used to reference how many objects reference this texture. /// Everytime someone references a texture we increase the iNumberOfReferences. /// When a class calls remove on a specific texture we check to see if anything /// else is referencing the class, if it is we don't remove it. If there isn't /// anything referencing the texture its safe to dispose of. /// </summary> class TextureContainer { public uint uiNumberOfReferences = 0; public Texture2D texture; } /// <summary> /// This class loads all the files from the Content. /// </summary> static class FileManager { static Microsoft.Xna.Framework.Content.ContentManager Content; static EventWaitHandle wh = new AutoResetEvent(false); static Dictionary<string, TextureContainer> Texture2DResourceDictionary; static List<Texture2D> TexturesToDispose; static List<String> TexturesToLoad; static int iProcessor = 4; private static object threadMutex = new object(); private static object Texture2DMutex = new object(); private static object loadingMutex = new object(); private static bool bLoadingTextures = false; /// <summary> /// Returns if we are loading textures or not. /// </summary> public static bool LoadingTexture { get { lock (loadingMutex) { return bLoadingTextures; } } } /// <summary> /// Since this is an static class. This is the constructor for the file loadeder. This is the version /// for the Xbox 360. /// </summary> /// <param name="_Content"></param> public static void Initalize(IServiceProvider serviceProvider, string rootDirectory, int _iProcessor ) { Content = new Microsoft.Xna.Framework.Content.ContentManager(serviceProvider, rootDirectory); Texture2DResourceDictionary = new Dictionary<string, TextureContainer>(); TexturesToDispose = new List<Texture2D>(); iProcessor = _iProcessor; CreateThread(); } /// <summary> /// Since this is an static class. This is the constructor for the file loadeder. /// </summary> /// <param name="_Content"></param> public static void Initalize(IServiceProvider serviceProvider, string rootDirectory) { Content = new Microsoft.Xna.Framework.Content.ContentManager(serviceProvider, rootDirectory); Texture2DResourceDictionary = new Dictionary<string, TextureContainer>(); TexturesToDispose = new List<Texture2D>(); CreateThread(); } /// <summary> /// Creates the thread incase we wanted to set up some parameters /// Outside of the constructor. /// </summary> static public void CreateThread() { Thread t = new Thread(new ThreadStart(StartThread)); t.Start(); } // This is the function that we thread. static public void StartThread() { //BBSThreadClass BBSTC = (BBSThreadClass)_oData; FileManager.Execute(); } /// <summary> /// This thread shouldn't be called by the outside world. /// It allows the File Manager to loop. /// </summary> static private void Execute() { // Make sure our thread is on the correct processor on the XBox 360. #if WINDOWS #else Thread.CurrentThread.SetProcessorAffinity(new int[] { iProcessor }); Thread.CurrentThread.IsBackground = true; #endif // This loop will load textures into ram for us away from the main thread. while (true) { wh.WaitOne(); // Locking down our data while we process it. lock (threadMutex) { lock (loadingMutex) { bLoadingTextures = true; } bool bContainsKey = false; for (int con = 0; con < TexturesToLoad.Count; con++) { // If we have already loaded the texture into memory reference // the one in the dictionary. lock (Texture2DMutex) { bContainsKey = Texture2DResourceDictionary.ContainsKey(TexturesToLoad[con]); } if (bContainsKey) { // Do nothing } // Otherwise load it into the dictionary and then reference the // copy in the dictionary else { TextureContainer TC = new TextureContainer(); TC.uiNumberOfReferences = 1; // We start out with 1 referece. // Loading the texture into memory. try { TC.texture = Content.Load<Texture2D>(TexturesToLoad[con]); // This is passed into the dictionary, thus there is only one copy of // the texture in memory. // There is an issue with Sprite Batch and disposing textures. // This will have to wait until its figured out. lock (Texture2DMutex) { bContainsKey = Texture2DResourceDictionary.ContainsKey(TexturesToLoad[con]); Texture2DResourceDictionary.Add(TexturesToLoad[con], TC); } // We don't have the find the reference to the container since we // already have it. } // Occasionally our texture will already by loaded by another thread while // this thread is operating. This mainly happens on the first level. catch (Exception e) { // If this happens we don't worry about it since this thread only loads // texture data and if its already there we don't need to load it. } } Thread.Sleep(100); } } lock (loadingMutex) { bLoadingTextures = false; } } } static public void LoadTextureList(List<string> _textureList) { // Ensuring that we can't creating threading problems. lock (threadMutex) { TexturesToLoad = _textureList; } wh.Set(); } /// <summary> /// This loads a 2D texture which represents a 2D grid of Texels. /// </summary> /// <param name="_textureName">The name of the picture you wish to load.</param> /// <returns>Holds the image data.</returns> public static Texture2D LoadTexture2D( string _textureName ) { TextureContainer temp; lock (Texture2DMutex) { bool bContainsKey = false; // If we have already loaded the texture into memory reference // the one in the dictionary. lock (Texture2DMutex) { bContainsKey = Texture2DResourceDictionary.ContainsKey(_textureName); if (bContainsKey) { temp = Texture2DResourceDictionary[_textureName]; temp.uiNumberOfReferences++; // Incrementing the number of references } // Otherwise load it into the dictionary and then reference the // copy in the dictionary else { TextureContainer TC = new TextureContainer(); TC.uiNumberOfReferences = 1; // We start out with 1 referece. // Loading the texture into memory. try { TC.texture = Content.Load<Texture2D>(_textureName); // This is passed into the dictionary, thus there is only one copy of // the texture in memory. } // Occasionally our texture will already by loaded by another thread while // this thread is operating. This mainly happens on the first level. catch(Exception e) { temp = Texture2DResourceDictionary[_textureName]; temp.uiNumberOfReferences++; // Incrementing the number of references } // There is an issue with Sprite Batch and disposing textures. // This will have to wait until its figured out. Texture2DResourceDictionary.Add(_textureName, TC); // We don't have the find the reference to the container since we // already have it. temp = TC; } } } // Return a reference to the texture return temp.texture; } /// <summary> /// Go through our dictionary and remove any references to the /// texture passed in. /// </summary> /// <param name="texture">Texture to remove from texture dictionary.</param> public static void RemoveTexture2D(Texture2D texture) { foreach (KeyValuePair<string, TextureContainer> pair in Texture2DResourceDictionary) { // Do our references match? if (pair.Value.texture == texture) { // Only one object or less holds a reference to the // texture. Logically it should be safe to remove. if (pair.Value.uiNumberOfReferences <= 1) { // Grabing referenc to texture TexturesToDispose.Add(pair.Value.texture); // We are about to release the memory of the texture, // thus we make sure no one else can call this member // in the dictionary. Texture2DResourceDictionary.Remove(pair.Key); // Once we have removed the texture we don't want to create an exception. // So we will stop looking in the list since it has changed. break; } // More than one Object has a reference to this texture. // So we will not be removing it from memory and instead // simply marking down the number of references by 1. else { pair.Value.uiNumberOfReferences--; } } } } /*public static void DisposeTextures() { int Count = TexturesToDispose.Count; // If there are any textures to dispose of. if (Count > 0) { for (int con = 0; con < TexturesToDispose.Count; con++) { // =!THIS REMOVES THE TEXTURE FROM MEMORY!= // This is not like a normal dispose. This will actually // remove the object from memory. Texture2D is inherited // from GraphicsResource which removes it self from // memory on dispose. Very nice for game efficency, // but "dangerous" in managed land. Texture2D Temp = TexturesToDispose[con]; Temp.Dispose(); } // Remove textures we've already disposed of. TexturesToDispose.Clear(); } }*/ /// <summary> /// This loads a 2D texture which represnets a font. /// </summary> /// <param name="_textureName">The name of the font you wish to load.</param> /// <returns>Holds the font data.</returns> public static SpriteFont LoadFont( string _fontName ) { SpriteFont temp = Content.Load<SpriteFont>( _fontName ); return temp; } /// <summary> /// This loads an XML document. /// </summary> /// <param name="_textureName">The name of the XML document you wish to load.</param> /// <returns>Holds the XML data.</returns> public static XmlDocument LoadXML( string _fileName ) { XmlDocument temp = Content.Load<XmlDocument>( _fileName ); return temp; } /// <summary> /// This loads a sound file. /// </summary> /// <param name="_fileName"></param> /// <returns></returns> public static SoundEffect LoadSound( string _fileName ) { SoundEffect temp = Content.Load<SoundEffect>(_fileName); return temp; } } }

    Read the article

  • Why does KeyDown event not have access to the current value of bound variable?

    - by Edward Tanguay
    In the example below: I start program, type text, click button, see text above. Press ENTER see text again. BUT: I start program, type text, press ENTER, see no text. It seems that the KeyDown event doesn't get access to the current value of the bound variable, as if it is always "one behind". What do I have to change so that when I press ENTER I have access to the value that is in the textbox so I can add it to the chat window? XAML: <Window x:Class="TestScroll.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="290" Width="300" Background="#eee"> <StackPanel Margin="10"> <ScrollViewer Height="200" Width="260" Margin="0 0 0 10" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto"> <TextBlock Text="{Binding TextContent}" Background="#fff"/> </ScrollViewer> <StackPanel HorizontalAlignment="Left" Orientation="Horizontal"> <TextBox x:Name="TheLineTextBox" Text="{Binding TheLine}" Width="205" Margin="0 0 5 0" KeyDown="TheLineTextBox_KeyDown"/> <Button Content="Enter" Click="Button_Click"/> </StackPanel> </StackPanel> </Window> Code-Behind: using System; using System.Windows; using System.Windows.Input; using System.ComponentModel; namespace TestScroll { public partial class Window1 : Window, INotifyPropertyChanged { #region ViewModelProperty: TextContent private string _textContent; public string TextContent { get { return _textContent; } set { _textContent = value; OnPropertyChanged("TextContent"); } } #endregion #region ViewModelProperty: TheLine private string _theLine; public string TheLine { get { return _theLine; } set { _theLine = value; OnPropertyChanged("TheLine"); } } #endregion public Window1() { InitializeComponent(); DataContext = this; TheLineTextBox.Focus(); } private void Button_Click(object sender, RoutedEventArgs e) { AddLine(); } void AddLine() { TextContent += TheLine + Environment.NewLine; } private void TheLineTextBox_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Return) { AddLine(); } } #region INotifiedProperty Block public event PropertyChangedEventHandler PropertyChanged; protected void OnPropertyChanged(string propertyName) { PropertyChangedEventHandler handler = PropertyChanged; if (handler != null) { handler(this, new PropertyChangedEventArgs(propertyName)); } } #endregion } }

    Read the article

  • Contract developer trying to get outsourcing contract with current client.

    - by Mike
    I work for a major bank as a contract software developer. I've been there a few months, and without exception this place has the worst software practices I've ever seen. The software my team makes has no formal testing, terrible code (not reusable, hard to read, etc), minimal documentation, no defined development process and an absolutely sickening amount of waste due to bureaucratic overhead. Part of my contract is to maintain a group of thousands of very poorly written batch jobs. When one of the jobs fails (read: crashes), it's a developers job to look at the source, figure out what's wrong, fix it, and check it in. There is no quality assurance process or auditing of the results whatsoever. Once the developer says "it works" a manager signs off and it goes into production. What's disturbing is that these jobs essentially grab market data and put it into a third-party risk management system, which provides the bank with critical intelligence. I've discovered the disturbing truth that this has been happening since the 90s and nobody really has evidence the system is getting the correct data! Without going into details, an issue arose on Friday that was so horrible I actually stormed out of the place. I was ready to quit, but I decided to just get out to calm my nerves and possibly go back Monday. I've been reflecting today on how to handle this. I have realized that, in probably less than 6 months, I could (with 2 other developers) remake a large component of this system. The new system would provide them with, as primary benefits, a maintainable codebase less prone to error and a solid QA framework. To do it properly I would have to be outside the bank, the internal bureaucracy is just too much. And moreover, I think a bank is fundamentally not a place that can make good software. This is my plan. Write a report explaining in depth all the problems with their current system Explain why their software practices fail and generate a tremendous amount of error and waste. Use this as the basis for claiming the project must be developed externally. Write a high level development plan, including what resources I will require Hand 1,2,3 to my manager, hopefully he passes it up the chain. Worst case he fires me, but this isn't so bad. Convinced Executive decides to award my company a contract for the new system I have 8 years experience as a software contractor and have delivered my share of successful software products, but all working in-house for small/medium sized companies. When I read this over, I think I have a dynamite plan. But since this is the first time doing something this bold so I have my doubts. My question is, is this a good idea? If you think not, please spare no detail.

    Read the article

  • Experienced developer trying to get outsourcing contract with current client.

    - by Mike
    I work for a major bank as a contract software developer. I've been there a few months, and without exception this place has the worst software practices I've ever seen. The software my team makes has no formal testing, terrible code (not reusable, hard to read, etc), minimal documentation, no defined development process and an absolutely sickening amount of waste due to bureaucratic overhead. Part of my contract is to maintain a group of thousands of very poorly written batch jobs. When one of the jobs fails (read: crashes), it's a developers job to look at the source, figure out what's wrong, fix it, and check it in. There is no quality assurance process or auditing of the results whatsoever. Once the developer says "it works" a manager signs off and it goes into production. What's disturbing is that these jobs essentially grab market data and put it into a third-party risk management system, which provides the bank with critical intelligence. I've discovered the disturbing truth that this has been happening since the 90s and nobody really has evidence the system is getting the correct data! Without going into details, an issue arose on Friday that was so horrible I actually stormed out of the place. I was ready to quit, but I decided to just get out to calm my nerves and possibly go back Monday. I've been reflecting today on how to handle this. I have realized that, in probably less than 6 months, I could (with 2 other developers) remake a large component of this system. The new system would provide them with, as primary benefits, a maintainable codebase less prone to error and a solid QA framework. To do it properly I would have to be outside the bank, the internal bureaucracy is just too much. And moreover, I think a bank is fundamentally not a place that can make good software. This is my plan. Write a report explaining in depth all the problems with their current system Explain why their software practices fail and generate a tremendous amount of error and waste. Use this as the basis for claiming the project must be developed externally. Write a high level development plan, including what resources I will require Hand 1,2,3 to my manager, hopefully he passes it up the chain. Worst case he fires me, but this isn't so bad. Convinced Executive decides to award my company a contract for the new system I have 8 years experience as a software contractor and have delivered my share of successful software products, but all working in-house for small/medium sized companies. When I read this over, I think I have a dynamite plan. But since this is the first time doing something this bold so I have my doubts. My question is, is this a good idea? If you think not, please spare no detail.

    Read the article

  • How do I get the current time in a Windows 7 gadget?

    - by norlando02
    For my first windows gadget I'm trying to make one that displays the current time and date. The code below is what I have, but I can't figure out why the javascript is not running. Any ideas? <html> <head> http-equiv="Content-Type" content="text/html; charset=Unicode" /> <title>Clock</title> <style type="text/css"> body { width: 130px; height: 60px; margin: 1 1 1 2; } body { font-family: Segoe UI, Arial; font-size: 11px; font-weight: bold; white-space: nowrap; } </style> <script type="text/javascript"> var background; var interval; var connection_id; var timeZone; var now; function load() { try { interval = 1000; connection_id = 0; timeZone = System.Time.currentTimeZone; update(); } catch(e){} } function update() { try { now = new Date(Date.parse(System.Time.getLocalTime(timeZone))); curDate.innerHTML = now.format('M jS, Y'); curTime.innerHTML = now.format('h:i:s A'); clearTimeout(connection_id); connection_id = setTimeout("update()", interval); } catch(e) {} </script> </head> <body onload="load()"> <div id="curDate"> </div> <div id="curTime"> </div> </body> </html>

    Read the article

< Previous Page | 49 50 51 52 53 54 55 56 57 58 59 60  | Next Page >