Search Results

Search found 2312 results on 93 pages for 'whats your favourite'.

Page 77/93 | < Previous Page | 73 74 75 76 77 78 79 80 81 82 83 84  | Next Page >

  • Is there a default way to get hold of an internal property in jQueryUi widget?

    - by prodigitalson
    Im using an existing widget from the jquery-ui labs call selectmenu. It has callback options for the events close and open. The problem is i need in these event to animate a node that is part of the widget but not what its connected to. In order to do this i need access to this node. for example if i were to actually modify the widget code itself: // ... other methods/properties "open" : function(event){ // ... the original logic // this is my animation $(this.list).slideUp('slow'); // this is the orginal call to _trigger this._trigger('open', event, $this._uiHash()); }, // ... other methods/properties However when in the scope of the event handler i attach this is the orginal element i called the widget on. I need the widget instance or specifically the widget instance's list property. $('select#custom').selectmenu({ 'open': function(){ // in this scope `this` is an HTMLSelectElement not the ui widget } }); Whats the best way to go about getting the list property from the widget?

    Read the article

  • How to code a 'Next in Results' within search results in PHP

    - by thebluefox
    Right, bit of a head scratcher, although I've got a feeling there's an obvious answer and I'm just not seeing the wood for the trees. Baiscally, using Solr as a search engine for my site, bringing back 15 results per page. When you click on a result, you get a detail page, that has a "Next in Results" link on it, which obviously forwards you on to the next result. Whats the best way of doing this? I've come up with a few solutions but they're either too inpractical or just don't work. I could store all the ids in a session array, then grab the one after the current one and put that in the link. But with possibly hundreds/thousands of results, the memory that array would need, and the performance hit of dealing with it isn't practical. I could take the same approach and put it into the db, but I'll still have to deal with a potentially huge array when I grab them out of the db. Or; I could do the search again, only returning the id's, and grab the one after the one we're currently looking at. I think this could be the best option? Although it does seem kind of messy, namely because of when I have to select the id thats on a different 'page' (ie the 16th, 31st etc result). Unless I pass through where it was in the results, and select from there, but that still doesn't seem like the right way to do it. I'm really sorry if this is just complete nonsense, any help is massively appreciated as always, Cheers guys!

    Read the article

  • Main Function Error C++

    - by Arjun Nayini
    I have this main function: #ifndef MAIN_CPP #define MAIN_CPP #include "dsets.h" using namespace std; int main(){ DisjointSets s; s.uptree.addelements(4); for(int i=0; i<s.uptree.size(); i++) cout <<uptree.at(i) << endl; return 0; } #endif And the following class: class DisjointSets { public: void addelements(int x); int find(int x); void setunion(int x, int y); private: vector<int> uptree; }; #endif My implementation is this: void DisjointSets::addelements(int x){ for(int i=0; i<x; i++) uptree.push_back(-1); } //Given an int this function finds the root associated with that node. int DisjointSets::find(int x){ //need path compression if(uptree.at(x) < 0) return x; else return find(uptree.at(x)); } //This function reorders the uptree in order to represent the union of two //subtrees void DisjointSets::setunion(int x, int y){ } Upon compiling main.cpp (g++ main.cpp) I'm getting these errors: dsets.h: In function \u2018int main()\u2019: dsets.h:25: error: \u2018std::vector DisjointSets::uptree\u2019 is private main.cpp:9: error: within this context main.cpp:9: error: \u2018class std::vector \u2019 has no member named \u2018addelements\u2019 dsets.h:25: error: \u2018std::vector DisjointSets::uptree\u2019 is private main.cpp:10: error: within this context main.cpp:11: error: \u2018uptree\u2019 was not declared in this scope I'm not sure exactly whats wrong. Any help would be appreciated.

    Read the article

  • Give a reference to a python instance attribute at class definition

    - by Guenther Jehle
    I have a class with attributes which have a reference to another attribute of this class. See class Device, value1 and value2 holding a reference to interface: class Interface(object): def __init__(self): self.port=None class Value(object): def __init__(self, interface, name): self.interface=interface self.name=name def get(self): return "Getting Value \"%s\" with interface \"%s\""%(self.name, self.interface.port) class Device(object): interface=Interface() value1=Value(interface, name="value1") value2=Value(interface, name="value2") def __init__(self, port): self.interface.port=port if __name__=="__main__": d1=Device("Foo") print d1.value1.get() # >>> Getting Value "value1" with interface "Foo" d2=Device("Bar") print d2.value1.get() # >>> Getting Value "value1" with interface "Bar" print d1.value1.get() # >>> Getting Value "value1" with interface "Bar" The last print is wrong, cause d1 should have the interface "Foo". I know whats going wrong: The line interface=Interface() line is executed, when the class definition is parsed (once). So every Device class has the same instance of interface. I could change the Device class to: class Device(object): interface=Interface() value1=Value(interface, name="value1") value2=Value(interface, name="value2") def __init__(self, port): self.interface=Interface() self.interface.port=port So this is also not working: The values still have the reference to the original interface instance and the self.interface is just another instance... The output now is: >>> Getting Value "value1" with interface "None" >>> Getting Value "value1" with interface "None" >>> Getting Value "value1" with interface "None" So how could I solve this the pythonic way? I could setup a function in the Device class to look for attributes with type Value and reassign them the new interface. Isn't this a common problem with a typical solution for it? Thanks!

    Read the article

  • Suggestion on UPnP presentation

    - by Microkernel
    Hi all, I am working on an embedded device (bit higher end in terms of system resources but still an embedded one) which has lot of media content in it. I am trying to make it UPnP complaint and want to be able to control this device using a UPnP complaint control point/companion device like ipad. The step towards this is to be able to present the playlist content to the user. We thought of using HTML5 as a format to use. But as I am a noob in web technologies, I am not sure whats the best way to produce and present rich dynamic web pages. The content thats presented are video/audio listing that device can play and want this listing to be generated using the user's input criteria. So, what would be the best way to generate these dynamic pages which are rich and rendered as HTML5 pages. (looked at XML & XSLT, but there seems to be some limitations in how well one can use XSLT from some rewviews I saw). Thanks Microkernel PS: This may be silly or very basic as I am a embedded systems developer and not even a noob in web technologoes...

    Read the article

  • Button Template does not render Image clearly.

    - by Akash Kava
    Here is my button template, <Microsoft_Windows_Themes:ButtonChrome x:Name="Chrome" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" RenderDefaulted="{TemplateBinding IsDefaulted}" RenderMouseOver="{TemplateBinding IsMouseOver}" RenderPressed="{TemplateBinding IsPressed}"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto"/> <ColumnDefinition/> </Grid.ColumnDefinitions> <Image Source="{TemplateBinding ImageSource}" RenderOptions.BitmapScalingMode="NearestNeighbor" SnapsToDevicePixels="True" HorizontalAlignment="Center" VerticalAlignment="Center" Stretch="None" /> <ContentPresenter Grid.Column="1" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" RecognizesAccessKey="True"/> </Grid> </Microsoft_Windows_Themes:ButtonChrome> Now you can see as per this question My Images are blurry on StackOverflow I tried .. RenderOptions.BitmapScalingMode="NearestNeighbor" On all levels, grid, chrome .. and tried various combinations of SnapsToDevicePixels but images just wont show up correctly. I set Stretch=None, image is aligned at center, still why it stretches automatically? here is the output and its very frustrating. Actual size of the image is 16x16 but I some how figured out by using Windows Maginifier that no matter what I do, the image is actually trying to render as 20x20, for the bigger images its even cropping the right most and bottom part. I think image should be rendered correctly 16x16 when Stretch=None, can anyone clarify whats problem here?

    Read the article

  • Dynamic Collapsable Flow Chart Online

    - by Simon
    Been looking through a number of other related posts relating to flowchart software. I have been asked to put together a document outlining some of the typical problems our users encounter with our software product. What I would like to do, is create an interactive/online flowchart that lets users choose from 4-5 overall headings on whats wrong. Then for this to dynamically expand more choices on pinpointing the problem, and so on and so on, until they can get a resolution to their problem. The key thing that I have not been able to find in some of the flowchart software out there, is having the click + expand element. - I dont want all options to appear to the end-user in a huge flow chart as it will distract away from their specific issue. - I want them to be able to click away and go down a specific avenue that will end up giving them some good things to try, based on their decisions/clicks. I was originally thinking of perhaps putting something in Flex or Silverlight (ideally someone would have a template out there) but am now thinking of taking advantage of 3rd party (ideally free) software. This will need to be hosted in a browser. Any ideas?

    Read the article

  • Doing coding in Linux through a virtual machine on Windows VS partitioning

    - by ihaveitnow
    I already have experience with setting up virtual machines, running them and other minor tasks. Im a gamer, so I wont get rid of windows (for now at least...) but I do want to be a great programmer and to be involved with the Open-Source community. Id like to know if its a good idea to do my programming in linux through a virtual machine, vs giving it a partitioned section of the HDD. Id like to know about performance pros and cons and functionality. All responses are appreciated, thanks in advance. The type of programming I intend to dive into : Android Dev, Web Dev, Desktop Dev...More Android and Web right now though. So im looking at C#,C,C++,Java,PHP,HTML,MySQL...Off the top of the dome. I do web designing as well, so dreamweaver is added as an "essential". But im sure I can do dreamweaver files and upload them to the server after programming in Linux...Right? And any info on IDE's in Linux for the above mentioned are appreciated, but i would prefer going the coding route and understanding the essence of whats happening "under the covers" Thanks to all for reading, I appreciate it. Hope this isnt confusing :S

    Read the article

  • LINQ-SQL Updating Multiple Rows in a single transaction

    - by RPM1984
    Hi guys, I need help re-factoring this legacy LINQ-SQL code which is generating around 100 update statements. I'll keep playing around with the best solution, but would appreciate some ideas/past experience with this issue. Here's my code: List<Foo> foos; int userId = 123; using (DataClassesDataContext db = new FooDatabase()) { foos = (from f in db.FooBars where f.UserId = userId select f).ToList(); foreach (FooBar fooBar in foos) { fooBar.IsFoo = false; } db.SubmitChanges() } Essentially i want to update the IsFoo field to false for all records that have a particular UserId value. Whats happening is the .ToList() is firing off a query to get all the FooBars for a particular user, then for each Foo object, its executing an UPDATE statement updating the IsFoo property. Can the above code be re-factored to one single UPDATE statement? Ideally, the only SQL i want fired is the below: UPDATE FooBars SET IsFoo = FALSE WHERE UserId = 123 EDIT Ok so looks like it cant be done without using db.ExecuteCommand. Grr...! What i'll probably end up doing is creating another extension method for the DLINQ namespace. Still require some hardcoding (ie writing "WHERE" and "UPDATE"), but at least it hides most of the implementation details away from the actual LINQ query syntax.

    Read the article

  • POSTmethod and PHP- login verification

    - by Neethusha
    I wrote a code for login verification..I got output with GET. But i need output with POST since it is more secure.pls let me know if there is any error in my code. javascript code: var xml; function verifyusernamepasswd(pass) { //pass is password that will be passed as parameter xml=new XMLHttpRequest(); var url="http://localhost/loginvalidate.php"; var para="q="+username+"&p="+pass;//username is global xml.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xml.setRequestHeader("Content-length", para.length); xml.setRequestHeader("Connection", "close"); xml.open("POST",url,true); xml.onreadystatechange=statechanged1; xml.send(para); } function statechanged1() { if(xml.readyState==4) alert(xml.responseText); } php code: <?php $username=$_POST["q"]; $password=$_POST["p"]; $con=mysql_connect("localhost","root","blaze"); if(!$con) { die('Could not connect: '.mysql.error()); } mysql_select_db("BLAZE",$con) or die("No such Db"); $result=mysql_query("SELECT Passwword FROM USERTABLE WHERE Userhandle='$username'"); if($result==null) echo "false"; else if($result!=null) { $row=mysql_fetch_array($result); if((strcmp($row['Passwword'],$password)==0)) echo "true"; else echo "false"; } ?> the verification does not return anything, cos my alert is not displayed at all...pls tell me whats wrong....

    Read the article

  • Having Issue with Bounded Wildcards in Generic

    - by Sanjiv
    I am new to Java Generics, and I'm currently experimenting with Generic Coding....final goal is to convert old Non-Generic legacy code to generic one... I have defined two Classes with IS-A i.e. one is sub-class of other. public class Parent { private String name; public Parent(String name) { super(); this.name = name; } } public class Child extends Parent{ private String address; public Child(String name, String address) { super(name); this.address = address; } } Now, I am trying to create a list with bounded Wildcard. and getting Compiler Error. List<? extends Parent> myList = new ArrayList<Child>(); myList.add(new Parent("name")); // compiler-error myList.add(new Child("name", "address")); // compiler-error myList.add(new Child("name", "address")); // compiler-error Bit confused. please help me on whats wrong with this ?

    Read the article

  • Changing html content of a div before and after ajax request

    - by R27
    I am trying to change the button "ADD" (in a div) to some text/img as soon as it is clicked. And after the ajax request is processed, in the success block , I want the div to get the button back. I see the ajax request is itself not getting processed. Can someone explain whats my mistake. I just removed the jsfiddle link and pasting the script here to avoid confusion about the dependencies. JS script var ajax_load = "Please wait..."; jQuery(document).ready(function($) { $("#add_button").click(function(event){ var st = $("#add_div").html(); $("#add_div").html(ajax_load); $("#sform").validate({ errorClass: "error", submitHandler: function (form) { alert('inside submit'); $.ajax({ type: "GET", url: 'form.cgi', data: $("#sform").serialize(), success: function (msg) { alert('msg'); $("#add_div").html(st); $("#sform")[0].reset(); } }); } }); }); }); And the html piece is <form id=sform>LABEL <input id=field1 type=text> <div id="add_div"> <input type="button" value="ADD" id="add_button"> </div> </form> I have jquery.validate.min.js script included.

    Read the article

  • problem with drag and drop for the winform using c#

    - by karthik
    I dont have the title bar in my winform, so i need to code drag and drop for the entire form. I am using the below code to do it, which works fine. I have two panels in my form, PanelA and PanelB. During the startup i show PanelA where the drag and drop works perfectly. Later when the user clicks the button in PannelA, i need to make PanelA visible false and show the PanelB My drag and drop is not working when the PanelB is loaded in form. Whats the problem here ? private void SerialPortScanner_MouseUp(object sender, MouseEventArgs e) { this.drag = false; } private void SerialPortScanner_MouseDown(object sender, MouseEventArgs e) { this.drag = true; this.start_point = new Point(e.X, e.Y); } private void SerialPortScanner_MouseMove(object sender, MouseEventArgs e) { if (this.drag) { Point p1 = new Point(e.X, e.Y); Point p2 = this.PointToScreen(p1); Point p3 = new Point(p2.X - this.start_point.X, p2.Y - this.start_point.Y); this.Location = p3; } }

    Read the article

  • iphone nsarray problem?

    - by Brodie4598
    Okay maybe i just need another set of eyes on this, but I have the following lines of code in one of my view controllers. It takes some data from a file, and populates it into an array using "\n" as a separator. I then use that array to make an NSDictionary, which is used to populate a tableview. It's very simple. However it isnt working. Here's the code: NSString *dataString = [NSString stringWithContentsOfFile:checklistPath encoding: NSUTF8StringEncoding error:NULL]; if ([dataString hasPrefix:@"\n"]) { dataString = [dataString substringFromIndex:1]; } NSArray *tempArray = [dataString componentsSeparatedByString:@"\n"]; NSLog(@"datastring:%@",dataString); NSLog(@"temp array:",tempArray); NSLog(@"%i",[tempArray count]); NSDictionary *temporaryDictionary = [NSDictionary dictionaryWithObject: tempArray forKey:@"User Generated Checklist"]; self.names = temporaryDictionary; NSLog(@"names:%@",names); so in the log, datastring is correct, so it's correctly pulling the data from a file. however for tempArray, i get: 2010-05-17 19:15:55.825 MyApp[7309:207] temp array: for the tempArray count i get: 2010-05-17 19:15:55.826 myApp[7309:207] 5 which is the correct number of strings in the array So i'm stumped. I have the EXACT same few lines of code in a different view controller and it works perfectly. Whats crazier is the last NSLog, that shows the final NSDictionary (names) displays this, which looks correct: 2010-05-17 19:15:55.827 FS Companion[7309:207] names:{ "User Generated Checklist" = ( "System|||ACTION", "System|||ACTION", "System|||ACTION", "System|||ACTION", "System|||ACTION" ); \ am i missing something really obvious??

    Read the article

  • 2-Way databinding with Entity Framework and WPF DataGrid , is Possible ?

    - by Panindra
    i am working on POS application using SQL CE , WPF , Entity framework 3.5sp2 and iam trying to use data grid as my Order Entry Control for User to enter Products Order . Iam plannning to bind this to enitiy frmae work model , abd looking for 2 way updating ? private void button1_Click(object sender, RoutedEventArgs e) { using (MasterEntities nwEntities = new MasterEntities()) { var users = from d in nwEntities.Companies select new { d.CompanyId, d.CompanyName, d.Place }; listBox1.DataContext = users; dataGrid1.DataContext = users; // foreach (String c in customers) // { // MessageBox.Show(c.ToString()); // } } } When try to double clikc on the datagrid it through s a error with Caption " Invalid Operation Execption was unhandled " and Message " A TwoWay or OneWayToSource binding cannot work on the read-only property 'CompanyId' of type '<f__AnonymousType0`3[System.Int32,System.String,System.String]'. whats wrong here and my xaml coding goes like this <Grid> <ListBox Name="listBox1" ItemsSource="{Binding}" /> <Button Content="Show " Name="button1" Click="button1_Click" /> <DataGrid AutoGenerateColumns="False" Name="dataGrid1" ItemsSource="{Binding}" > <DataGrid.Columns> <DataGridTextColumn Header=" ID" Binding="{Binding CompanyId}"/> <DataGridTextColumn Header="Company Name" Binding="{Binding CompanyName}"/> <DataGridTextColumn Header="Place" Binding="{Binding Place}" /> </DataGrid.Columns> </DataGrid> </Grid> EDITED : i made the changes shown by @vorrtex, But, then i added another button to save the chages and in button click event i added follwing code , butit showing Updating error private void button2_Click(object sender, RoutedEventArgs e) { nwEntities.SaveChanges(); }

    Read the article

  • PHP classes totally forgotten something today - sorry

    - by russp
    Hi guys, really sorry about being "totally thick today" but I have forgotten how to do something simple - too much time not in php recently. Want to use the OS phpapi How do I print out the individual rows - see told you I was being thick today // The fields we will be fetching. if (isset($_GET['test']) && $_GET['test'] == 'plaxo') { // plaxo is a PortableContacts end-point so doesn't know about the OpenSocial specific fields $profile_fields = array(); } else { $profile_fields = array( 'aboutMe', 'displayName', 'bodyType', 'currentLocation', 'drinker', 'happiestWhen', 'lookingFor' ); } // The number of friends to fetch. $friend_count = 2; $batch = $osapi->newBatch(); // Fetch the current user. $self_request_params = array( 'userId' => $userId, // Person we are fetching. 'groupId' => '@self', // @self for one person. 'fields' => $profile_fields // Which profile fields to request. ); $batch->add($osapi->people->get($self_request_params), 'self'); // Fetch the friends of the user $friends_request_params = array( 'userId' => $userId, // Person whose friends we are fetching. 'groupId' => '@friends', // @friends for the Friends group. 'fields' => $profile_fields, // Which profile fields to request. 'count' => $friend_count // Max friends to fetch. ); $batch->add($osapi->people->get($friends_request_params), 'friends'); // Get supportedFields Request $batch->add($osapi->people->getSupportedFields(), 'supportedFields'); // Send the batch request. $result = $batch->execute(); Say I wanted to print out "aboutMe", whats the echo? cos echo $result['aboutMe'] doesn't work.

    Read the article

  • WPF: ComboBox SelectedIndex = -1 ??

    - by msfanboy
    Hello, I am using a MVVM Wizard with several pages. When I set a value in the combobox and go to the next page and switch back I want to reset the value I set before. But all whats happening is that the combobox is empty at top and the index is -1 ? What do I wrong? <ComboBox ItemsSource="{Binding Path=LessonNumbers}" SelectedIndex="{Binding SelectedLessonNumber}" /> private ReadOnlyCollection<int> _lessonNumbers; public ReadOnlyCollection<int> LessonNumbers { get { if (_lessonNumbers == null) this.CreateLessonNumbers(); return _lessonNumbers; } } private void CreateLessonNumbers() { var list = new List<int>(); for (int i = 1; i < 24; i++) { list.Add(i); } _lessonNumbers = new ReadOnlyCollection<int>(list); } private int _selectedLessonNumber; public int SelectedLessonNumber { get { return _selectedLessonNumber; } set { if (_selectedLessonNumber == value) return; _selectedLessonNumber = value; this.OnPropertyChanged("SelectedLessonNumber"); } }

    Read the article

  • C++ converting back and forth from derived and base classes

    - by user127817
    I was wondering if there is a way in C++ to accomplish the following: I have a base class called ResultBase and two class that are Derived from it, Variable and Expression. I have a few methods that do work on vector<ResultBase> . I want to be able to pass in vectors of Variable and Expression into these methods. I can achieve this by creating a vector<ResultBase> and using static_cast to fill it with the members from my vector of Variable/Expression. However, once the vector has run through the methods, I want to be able to get it back as the vector of Result/Expression. I'll know for sure which one I want back. static_cast won't work here as there isn't a method to reconstruct a Variable/Expression from a ResultBase, and more importantly I wouldn't have the original properties of the Variables/Expressions The methods modify some of the properties of the ResultBase and I need those changes to be reflected in the original vectors. (i.e. ResultBase has a property called IsLive, and one of the methods will modify this property. I want this IsLive value to be reflected in the derived class used to create the ResultBase Whats the easiest way to accomplish this?

    Read the article

  • Cant print contents of a custom file

    - by ZaZu
    Hello, Im trying to scan contents from a random file into an array in a structure. Then I want to print those contents on screen. (NOTE: The following code is from a bigger program, this is just a sample, but all structures and arrays used are needed as declared ) The contents of the file being tested are simply: 5 4 3 2 5 3 4 2 #include<stdio.h> #define first 500 #define sec 500 struct trial{ int f; int r; float what[first][sec]; }; int trialtest(trial *test); int trialdisplay(trial *test); main(){ trial test; trialtest(&test); trialdisplay(&test); } int trialtest(trial *test){ int z,x,i; FILE *inputf; inputf=fopen("randomfile.txt","r"); for(i=0;i<5;i++){ fscanf(inputf,"%f",&(*test).what[z][x]); } fclose(inputf); return 0; } int trialdisplay(trial *test){ int i,z,x; printf("printing\n\n\n"); for (i=0;i<10;i++){ printf("%f",(*test).what[z][x]); } return 0; } The problem is, I get this error whenever I run the code .. I cant really understand whats going on : Any suggestions ? Thanks alot !

    Read the article

  • How to start with entity framework and service oriented architecture?

    - by citronas
    At work I need to create a new web application, that will connection to an MySql Database. (So far I only have expercience with Linq-To-Sql classes and MSSQL Servers.) My superior tells me to use the entity framework (he probably refers to Linq-To-Entity) and provide everything as a service based architecture. Unfortunatly nobody at work has experience with that framework and with a real nice server oriented architecture. (till now no customer wanted to pay for architecture that he can't see. This speficic project I'm leading will be long-term, meaning multiple years, so it would be best to design it the way, that multiple targetting plattforms like asp.net, c# wpf, ... could use it) For now, the main target plattform is ASP.net So I do have the following questions: 1) Where can I read best what's really behind service oriented architecture (but for now beginner tutorials work fine as well) and how to do it in best practise? 2) So far I can't seem a real difference between Linq-To-Sql classes and the information I've google so far on the 'entity framework'. So, whats the difference? Where do I find nice tutorials for it. 3) Is there any difference in the entity framework regarding the database server (MSSQL or MySQL). If not, does that mean that code snipperts I will stumble across will word database independent? 4) I do you Visual Studio 2010. Do I have to regard something specific?

    Read the article

  • Dynamically resizing navigation div to main content

    - by theZod
    Greetings and Hello I am trying to put together a wordpress site, now because the content in the main div is going to be a different height with every page I need the navigation sidebar to stretch to the same height. So with a little javascript tom-foolery I can get the sidebar to be the same height with the following code function adjust(){ hgt=document.getElementById('content').offsetHeight; document.getElementById('sidebar').style.height=hgt+'px'; } window.onload=adjust; window.onresize=adjust; Now that's all good for a long page but if the content is smaller then the sidebar stuff gets all messy. So I have tried an if statement like so function adjust() { if (document.getElementById('content').style.height < document.getElementById('sidebar').style.height){ hgt=document.getElementById('content').offsetHeight; document.getElementById('sidebar').style.height=hgt+'px'; else hgt=document.getElementById('sidebar').offsetHeight; document.getElementById('content').style.height=hgt+'px'; } } window.onload=adjust; window.onresize=adjust; But that just doesn't do anything, so any ideas whats going on?

    Read the article

  • webpart context.session is null

    - by tbischel
    I've been using the session array to store a state variable for my webpart... so I have a property like this: public INode RootNode { get { return this.Context.Session["RootNode"] as INode; } set { this.Context.Session["RootNode"] = value as object; } } This usually works fine. I've discovered that sometimes, the context.session variable will be null. I'd like to know what are the conditions that cause the session to be null in the first place, and whats the best way to persist my object when this happens? Can I just assign a new HttpSessionState object to the context, or does that screw things up? Edit: Ok, so its not just the session that is null... the whole context is screwed up. When the webpart enters the init, the context is fine... but when it reaches the dropbox selectedindexchange postback event (the dropbox contains node id's to use to set the rootnode variable), the context contains mostly null properties. also, it only seems to happen when certain id's are selected. This looks more like some kind of weird bug on my end than a problem with my understanding of the session.

    Read the article

  • Prime Numbers in C?

    - by Ali Azam Rana
    FIRST PROGRAM #include<stdio.h> void main() { int n,c; printf("enter a numb"); scanf("%i",n); for(c=2;c<=n;c++) { if(n%c==0) break; } if(c==n) printf("\nprime\n"); else printf("\nnot prime\n"); getchar(); } SECOND PROGRAM #include <stdio.h> int main() { printf("Enter a Number\n"); int in,loop,rem,chk; scanf("%d",&in); for (loop = 1; loop <=in; loop++) { rem = in % loop; if(rem == 0) chk = chk +1; } if (chk == 2) printf("\nPRIME NUM ENTERED\n"); else printf("\nNUM ENTERED NOT PRIME\n"); getchar(); } the 2nd program works other was the one my friend wrote the program looks fine but on checking it by stepping into we found that the if condition in first program is coming true under every input so whats the logical error here please help me found out......

    Read the article

  • C# function called after dependency property have been set

    - by mizipzor
    My code currently looks like this: private Foo myFoo; public Foo CurrentFoo { get { return myFoo; } set { SetFoo(value); } } private void SetFoo(Foo newFoo) { // Do stuff // Here be dragons myFoo = newFoo; } To be able to bind it in XAML/WPF I need to turn Foo into a dependency property: public static DependencyProperty CurrentFooProperty = DependencyProperty.Register("CurrentFoo", typeof(Foo), typeof(FooHandler), new PropertyMetadata(false)); public Foo CurrentFoo { get { return (Foo)GetValue(CurrentFooProperty); } set { SetValue(CurrentFooProperty, value); } } Ive heard that you shouldnt do magic inside the actual C# property set {}, since it might not be called but the value is written directly to the dependency property. If this is false, let me know, it seems like the most obvious and simple route to take. I know I can add a validation function to the dependency property but I assume that it shouldnt be used for this? I need to communicate the change to legacy systems that cannot yet be bound in XAML. Whats the best way to approach this problem?

    Read the article

  • Why does my Android App crash when loading image from gallery the 2nd time?

    - by Sebastian
    Hi folks, I've written an app, thats loading images either using the android gallery app or by taking a photo using the cam. When I now load an image using the gallery, everything is fine. When the code is being executed a second time (for loading another image), the application crashes. try { Uri data = intent.getData(); ContentResolver cr = this.getContentResolver(); Bitmap mBitmap = null; mBitmap = Media.getBitmap(cr, data); imageView.setImageBitmap(mBitmap); } catch(Exception e){ showToast(this, "Failed loading image from gallery"); return; } The code crashes at the line mBimap = Media.getBitmap(cr, data);. Everything is initialized, there are no null values etc. The strange thing is: no exception is thrown, I don't get into the catch block to determine whats going wrong. Does anyone have an idea about this? Am I not allowed to "re-use" the content resolver? Do I have to free it after the first usage or something like this?

    Read the article

< Previous Page | 73 74 75 76 77 78 79 80 81 82 83 84  | Next Page >