Search Results

Search found 12772 results on 511 pages for 'the little schemer'.

Page 62/511 | < Previous Page | 58 59 60 61 62 63 64 65 66 67 68 69  | Next Page >

  • How do you use indent in vim for web development?

    - by Somebody still uses you MS-DOS
    I'm starting to use Linux and Vim at work. I'm starting to read vims documentation and creating my own .vimrc file and such. I'm a web developer working with HTML, XML, CSS, JS, Python, PHP, ZPT, DTML and SQL. I would like to have an indent feature like this one: for each language/set, a corresponding indent solution. So, in js, writing function test(){|} would turn in function test(){ | } If php, writing <?php function test(){|}: <?php function test(){ | } <?php> ...and such. Writing a function definition in Python, and then creating a for loop sentece, it would automatically create an indent. I'm starting with autoindent, smartindent, cindent but I'm a little confused about their differences. How do the indent in vim works? Am I supposed to download plugins for each language? Is the behavior I described possible with already existing plugins you're used to or do I have to create it? I keep seeing people using Vim and I'm trying to do this as well since the machine I'm using is too limited, but I'm afraid I won't be able to have a decent auto indenting solution in it. (I have used autoindenting in a little small project in Visual Studio, and really liked their approach. Is there a plugin for that?)

    Read the article

  • Linking Apache to Tomcat with multiple domains.

    - by Royce Thigpen
    Okay, so I've been working for a while on this, and have been searching, but so far I have not found any answers that actually answer what I want to know. I'm a little bit at the end of my rope with this one, but I'm hoping I can figure this out sometime soon. So I have Apache 2 installed and serving up standard webpages, but I also have that linked to a Tomcat instance for one of my domains currently supported. However, I want to add another domain to the server via Apache that points to a separate code base from the one I already have. I have been coming at this from several different angles, and I have determined that I just don't know enough about setting up these servers to really do what I want to do. Little information on my server: Currently running a single Tomcat5.5 instance with Apache 2, using mod_jk to connect them together. I have a worker in workers.properties that points it's "host" field to "localhost" with the correct port my Tomcat instance, so that all works. In my Tomcat server.xml file, I have a host defined as "localhost" that points at my webapp that I am currently serving up, with that host set as the defaultHost as well. One thought I had was that I could add a new worker with a different host than "localhost" (i.e. host2) and then define a new host in my server.xml file called "host2" to match it, but after reading around some on the internet, It seems the "host" of the worker must point to a server, and not a hostname in the Tomcat instance, is this correct? Again, a simple rundown of what I want: Setup in apache/tomcat combo such that www.domain1.com points at "webapp1" and www.domain2.com points at "webapp2".

    Read the article

  • Abstracting the interpretation of MVC checkboxes values received by the FormsCollection object

    - by Simon_Weaver
    In ASP.NET MVC a checkbox is generated by the HtmlHelper code here: <%= Html.CheckBox("List_" + mailingList.Key, true) %> as this HTML: <input id="List_NEW_PRODUCTS" name="List_NEW_PRODUCTS" type="checkbox" value="true" /> <input name="List_NEW_PRODUCTS" type="hidden" value="false" /> In case you're wondering why is there an extra hidden field? - then read this. Its definitely a solution that makes you first think 'hmmmmm' but then you realize its a pretty elegant one. The problem I have is when I'm trying to parse the data on the backend. Well its not so much of a problem as a concern if anything in future were to change in the framework. If I'm using the built in binding everything is great - its all done for me. But in my case I'm dynamically generating checkboxes with unknown names and no corresponding properties in my model. So i end up having to write code like this : if (forms["List_RETAIL_NOTIFICATION"] == "true,false") { } or this: if (forms.GetValues("List_RETAIL_NOTIFICATION")[0] == "true") { } Both of which i still look at and cringe - especially since theres no guarantee this will always be the return value. I'm wondering if theres a way to access the layer of abstraction used by the model binders - or if I'm stuck with my controller 'knowing' this much about HTTP POST hacks. Yes I'm maybe being a little picky - but perhaps theres a better clever way using the model binders that I can employ to read dynamically created checkbox parameters. In addition i was hoping this this post might help others searcheing for : "true,false". Even though I knew why it does this I just forgot and it took me a little while to realize 'duh'. FYI: I tried another few things, and this is what I found : forms["List_RETAIL_NOTIFICATION"] evaluates to "true,false" forms.GetValues("List_RETAIL_NOTIFICATION")[0] evaluates to "true" (forms.GetValue("List_RETAIL_NOTIFICATION").RawValue as string[])[0] evaluates to "true" forms.GetValues("List_RETAIL_NOTIFICATION").FirstOrDefault() evaluates to "true"

    Read the article

  • Ajax div can't access address bar variable

    - by Elaine Adams
    Can someone please advise me on how my Ajax div can get an address bar variable. The usual way just doesn't work. My address bar currently looks like this: http://localhost/social3/browse/?locationName=Cambridge Usually, I would use a little php and do this: $searchResult = $_POST['locationName']; echo $searchResult; But because I'm in an Ajax div, I can't seem to get to the variable. Do I need to add some JavaScript wizardry to my Ajax coding? (I have little knowledge of this) My Ajax: <script> window.onload = function () { var everyone = document.getElementById('everyone'), searching = document.getElementById('searching'), searchingSubmit = document.getElementById('searchingSubmit'); everyone.onclick = function() { loadXMLDoc('indexEveryone'); everyone.className = 'filterOptionActive'; searching.className = 'filterOption'; } searching.onclick = function() { loadXMLDoc('indexSearching'); searching.className = 'filterOptionActive'; everyone.className = 'filterOption'; } searchingSubmit.onclick = function() { loadXMLDoc('indexSearchingSubmit'); } function loadXMLDoc(pageName) { var xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("leftCont").innerHTML=xmlhttp.responseText; } } function get_query(){ var url = location.href; var qs = url.substring(url.indexOf('?') + 1).split('&'); for(var i = 0, result = {}; i < qs.length; i++){ qs[i] = qs[i].split('='); result[qs[i][0]] = decodeURIComponent(qs[i][1]); } return result; } xmlhttp.open("GET","../browse/" + pageName + ".php?user=" + get_query()['user'],true); xmlhttp.send(); } } </script> <!-- ends ajax script -->

    Read the article

  • CDN for Images in ASP.NET

    - by Chris
    I am in the process of moving all of the images in my web application over to a CDN but I want to easily be able to switch the CDN on or off without having to hard code the path to the images. My first thought was to add an HttpHandler for image extensions that depending whether a variable in the web.config (something like ) will serve the image from the server or from the CDN. But after giving this a little though I think I've essentially ruled this out as it will cause ASP.NET to handle the request for every single image, thus adding overhead, and it might actually completely mitigate the benefits of using a CDN. An alternative approach is, since all of my pages inherit from a base page class, I could create a function in the base class that determines what path to serve the files from based off the web.config variable. I would then do something like this in the markup: <img src='<%= GetImagePath()/image.png' /> I think this is probably what I'll have to end up doing, but it seems a little clunky to me. I also envision problems with the old .NET error of not being able to modify the control collection because of the "<%=" though the "<%#" solution will probably work. Any thoughts or ideas on how to implement this?

    Read the article

  • Custom Image Button and Radio/Toggle Button from Common Base Class

    - by Wonko the Sane
    Hi All, I would like to create a set of custom controls that are basically image buttons (it's a little more complex than that, but that's the underlying effect I'm going for) that I've seen a few different examples for. However, I would like to further extend that to also allow radio/toggle buttons. What I'd like to do is have a common abstract class called ImageButtonBase that has default implementations for ImageSource and Text, etc. That makes a regular ImageButton implementation pretty easy. The issue I am having is creating the RadioButton flavor of it. As I see it, there are at least three options: It would be easy to create something that derives from RadioButton, but then I can't use the abstract class I've created. I could change the abstract class to an interface, but then I lose the abstract implementations, and will in fact have duplication of code. I could derive from my abstract class, and re-implement the RadioButton-type properties and events (IsChecked, GroupName, etc.), but that certainly doesn't seem like a great idea. Note: I have seen http://stackoverflow.com/questions/2362641/how-to-get-a-group-of-toggle-buttons-to-act-like-radio-buttons-in-wpf, but what I want to do is a little more complex. I'm just wondering if anybody has an example of an implementation, or something that might be adapted to this kind of scenario. I can see pros and cons of each of the ideas above, but each comes with potential pitfalls. Thanks, wTs

    Read the article

  • Basic SWIG C++ use for Java

    - by duckworthd
    I've programmed a couple years in both C++ and Java, but I've finally come to a point where I need to bring a little unification between the two -- ideally, using SWIG. I've written a tiny and fairly pointless little class called Example: #include <stdio.h> class Example { public: Example(); ~Example(); int test(); }; #include "example.h" Example::Example() { printf("Example constructor called\n"); } Example::~Example() { printf("Example destructor called\n"); } int Example::test() { printf("Holy sh*t, I work!\n"); return 42; } And a corresponding interface file: /* File: example.i */ %module test %{ #include "example.h" %} %include "example.h" Now I have questions. Firstly, when I want to actually run SWIG initially, am I supposed to use the example_wrap.c (from swig -java example.i) or example_wrap.cxx (from swig -c++ example.i) file when recompiling with my original example.cpp? Or perhaps both? I tried both and the latter seemed most likely, but when I recompile as so: g++ example.cpp example_wrap.cxx -I/usr/lib/jvm/java-6-sun-.../include/ I get a host of errors regarding TcL of all things, asking me for the tcl.h header. I can't even wrap my mind around why it wants that much less needs it, and as such have found myself where I don't even know how to begin using SWIG.

    Read the article

  • Proper Memory Management for Objective-C Method

    - by Justin
    Hi, I'm programming an iPhone app and I had a question about memory management in one of my methods. I'm still a little new to managing memory manually, so I'm sorry if this question seems elementary. Below is a method designed to allow a number pad to place buttons in a label based on their tag, this way I don't need to make a method for each button. The method works fine, I'm just wondering if I'm responsible for releasing any of the variables I make in the function. The application crashes if I try to release any of the variables, so I'm a little confused about my responsibility regarding memory. Here's the method: FYI the variable firstValue is my label, it's the only variable not declared in the method. -(IBAction)inputNumbersFromButtons:(id)sender { UIButton *placeHolderButton = [[UIButton alloc] init]; placeHolderButton = sender; NSString *placeHolderString = [[NSString alloc] init]; placeHolderString = [placeHolderString stringByAppendingString:firstValue.text]; NSString *addThisNumber = [[NSString alloc] init]; int i = placeHolderButton.tag; addThisNumber = [NSString stringWithFormat:@"%i", i]; NSString *newLabelText = [[NSString alloc] init]; newLabelText = [placeHolderString stringByAppendingString:addThisNumber]; [firstValue setText:newLabelText]; //[placeHolderButton release]; //[placeHolderString release]; //[addThisNumber release]; //[newLabelText release]; } The application works fine with those last four lines commented out, but it seems to me like I should be releasing these variables here. If I'm wrong about that I'd welcome a quick explanation about when it's necessary to release variables declared in functions and when it's not. Thanks.

    Read the article

  • Obtaining command line arguments in a QT application

    - by morpheous
    The following snippet is from a little app I wrote using the QT framework. The idea is that the app can be run in batch mode (i.e. called by a script) or can be run interactively. It is important therefore, that I am able to parse command line arguments in order to know which mode in which to run etc. [Edit] I am debugging using QTCreator 1.3.1 on Ubuntu Karmic. The arguments are passed in the normal way (i.e. by adding them via the 'Project' settings in the QTCreator IDE). When I run the app, it appears that the arguments are not being passed to the application. The code below, is a snippet of my main() function. int main(int argc, char *argv[]) { //Q_INIT_RESOURCE(application); try { QApplication the_app(argc, argv); //trying to get the arguments into a list QStringList cmdline_args = QCoreApplication::arguments(); // Code continues ... } catch (const MyCustomException &e) { return 1; } return 0; } [Update] I have identified the problem - for some reason, although argc is correct, the elements of argv are empty strings. I put this little code snippet to print out the argv items - and was horrified to see that they were all empty. for (int i=0; i< argc; i++){ std::string s(argv[i]); //required so I can see the damn variable in the debugger std::cout << s << std::endl; } Does anyone know what on earth is going on (or a hammer)?

    Read the article

  • S3 file Uploading from Mac app though PHP?

    - by Ilija Tovilo
    I have asked this question before, but it was deleted due too little information. I'll try to be more concrete this time. I have an Objective-C mac application, which should allow users to upload files to S3-storage. The s3 storage is mine, the users don't have an Amazon account. Until now, the files were uploaded directly to the amazon servers. After thinking some more about it, it wasn't really a great concept, regarding security and flexibility. I want to add a server in between. The user should authenticate with my server, the server would open a session if the authentication was successful, and the file-sharing could begin. Now my question. I want to upload the files to S3. One option would be to make a POST-request and wait until the server would receive the file. Problems here are, that there would be a delay, when the file is being uploaded from my server to the S3 servers, and it would double the uploading time. Best would be, if I could validate the request, and then redirecting it, so the client uploads it directly to the s3-storage. Not sure if this is possible somehow. Uploading directly to S3 doesn't seem to be very smart. After looking into other apps like Droplr and Dropmark, it looks like they don't do this. Btw. I did this using Little Snitch. They have their api on their own web-server, and that's it. Could someone clear things up for me? EDIT How should I transmit my files to S3? Is there a way to "forward" it, or do I have to upload it to my server and then upload it from there to S3? Like I said, other apps can do this efficiently and without the need of communicating with S3 directly.

    Read the article

  • Is it acceptable to wrap PHP library functions solely to change the names?

    - by Carson Myers
    I'm going to be starting a fairly large PHP application this summer, on which I'll be the sole developer (so I don't have any coding conventions to conform to aside from my own). PHP 5.3 is a decent language IMO, despite the stupid namespace token. But one thing that has always bothered me about it is the standard library and its lack of a naming convention. So I'm curious, would it be seriously bad practice to wrap some of the most common standard library functions in my own functions/classes to make the names a little better? I suppose it could also add or modify some functionality in some cases, although at the moment I don't have any examples (I figure I will find ways to make them OO or make them work a little differently while I am working). If you saw a PHP developer do this, would you think "Man, this is one shoddy developer?" Additionally, I don't know much (or anything) about if/how PHP is optimized, and I know that usually PHP performace doesn't matter. But would doing something like this have a noticeable impact on the performance of my application?

    Read the article

  • Console in VS 2012 Express for C++?

    - by Live2Code
    I'm very new to programming, so be nice. I was using Eclipse for C/C++ devs for a while, but it seemed quite buggy so I was advised to switch to Visual Studio Express. I'm just testing out with a simple "Hello World" program #include <iostream> #include <string> using namespace std; int main( int argc, char ** argv ) { string response; cout << "Gimme a string: " << flush; cin >> response; cout << "The string is: " << response << endl; system("pause"); return 0; } not much to go wrong there anyway, I noticed that there is no "console" like in Eclipse. All of the text pops up in a little command prompt window. And, also, this window closes right after displaying new text if there is no other things to do after it (like a cin). I have been told that I can use system("pause") but there has to be a better way. In Eclipse, the text would not suddenly disappear because the console window closed. i know this question might be a little confusing, comment and I'll try to explain what I'm saying. Or paste the codes into your Visual Studio 2012 Express Edition. But is there a way to display all of my text and whatever in a "console" as opposed to a command prompt-type window; and why does it always close before I can read the last thing?

    Read the article

  • Creating a network adapter - how hard is it?

    - by Vilx-
    I'm interested in building a little (commercial) device on top of Arduino. I want it to be able to interface with network. Network as in standard Ethernet, Cat5, RJ-45, etc. I know that there is an Ethernet Shield, but it costs even more than the Arduino itself, and it's pretty big. Naturally, I want my device to be as small and as cheap as possible. So I'm thinking about recreating an Ethernet module myself. The problem is - I haven't got any experience with Ethernet, nor do I have a good idea where to start looking. Thus I can't even say if my ideas are feasible. Ultimately I would like the device to have three ports - one for incoming signal, two for outgoing, so the device is essentially a little switch where it is plugged in itself as well. The switching capabilities need not be very fast - the volume of data will be low. 10Mbit is more than enough, can be even slower. If that is not possible, a single port for controlling the device itself will also do. Another possibility I'm considering is power line communications - sending information through power lines. That's another area I've no experience with. What hardware should I be looking at, and where can I find information about the necessary software? So - can anyone tell me if these ideas are feasible, and if yes - where should I start looking?

    Read the article

  • Image Gurus: Optimize my Python PNG transparency function

    - by ozone
    I need to replace all the white(ish) pixels in a PNG image with alpha transparency. I'm using Python in AppEngine and so do not have access to libraries like PIL, imagemagick etc. AppEngine does have an image library, but is pitched mainly at image resizing. I found the excellent little pyPNG module and managed to knock up a little function that does what I need: make_transparent.py pseudo-code for the main loop would be something like: for each pixel: if pixel looks "quite white": set pixel values to transparent otherwise: keep existing pixel values and (assuming 8bit values) "quite white" would be: where each r,g,b value is greater than "240" AND each r,g,b value is within "20" of each other This is the first time I've worked with raw pixel data in this way, and although works, it also performs extremely poorly. It seems like there must be a more efficient way of processing the data without iterating over each pixel in this manner? (Matrices?) I was hoping someone with more experience in dealing with these things might be able to point out some of my more obvious mistakes/improvements in my algorithm. Thanks!

    Read the article

  • On checkbox checked show radio button

    - by aDameToKillFor
    Hello, I would like to ask for a little help here, since I haven't got any big knowledge in Javascript, nor in jQuery. I need to show 5 radio buttons when a checkbox is checked, the checkboxes represent languages that the user speaks, so for each of the selected, there should appear 5 separate radio buttons for how good they speak it(1 to 5). I tried to do it with jQuery, but I did not manage to get very far away... This is where my checkboxes are created(dynamically): <% for(int i = 0; i < Model.Languages.Count; i++) { %> <input id="applang" name="applang" type="checkbox" value="<%: Model.Languages[i].languageID%>" /> <%: Model.Languages[i].name.ToString() %><br /> <%} %> So, I tried to add this script, but it's not working: <script type="text/javascript"> $("input[@name='applang']").click(function () { $("input[type='radio']").show(); }); I also tried this way - to use this javascript: <script type="text/javascript"> function toggle_visibility(id) { var e = document.getElementById(id); if (e.style.display == 'block') e.style.display = 'none'; else e.style.display = 'block'; } And it works, but it works on already present controls, and I guess I need to create mine dynamically, or maybe not? And I tried to hide a present control with CSS, but then when the script shows it, it is there, only invisible :) Also, I would want to get the name and value of the radio buttons from my database, i.e. Model(this is ASP.NET MVC).. Can someone help me a little bit, please?

    Read the article

  • PHP OO vs Procedure with AJAX

    - by vener
    I currently have a AJAX heavy(almost everything) intranet webapp for a business. It is highly modularized(components and modules ala Joomla), with plenty of folders and files. ~ 80-100 different viewing pages (each very unique in it's own sense) on last count and will likely to increase in the near future. I based around the design around commands and screens, the client request a command and sends the required data and receives the data that is displayed via javascript on the screen. That said, there are generally two types of files, a display files with html, javascript, and a little php for templating. And also a php backend file with a single switch statement with actions such as, save, update and delete and maybe other function. There is very little code reuse. Recently, I have been adding an server sided undo function that requires me to reuse some code. So, I took the chance to try out OOP but I notice that some functions are so simple, that creating a class, retrieving all the data then update all the related rows on the database seems like overkill for a simple action as speed is quite critical. Also I noticed there is only one class in an entire file. So, what if the entire php is a class. So, between creating a class and methods, and using global variables and functions. Which is faster?

    Read the article

  • When to use reinterpret_cast?

    - by HeretoLearn
    I am little confused with the applicability of reinterpret_cast vs static_cast. From what I have read the general rules are to use static cast when the types can be interpreted at compile time hence the word static. This is the cast the C++ compiler uses internally for implicit casts also. reinterpret_cast are applicable in two scenarios, convert integer types to pointer types and vice versa or to convert one pointer type to another. The general idea I get is this is unportable and should be avoided. Where I am a little confused is one usage which I need, I am calling C++ from C and the C code needs to hold on to the C++ object so basically it holds a void*. What cast should be used to convert between the void * and the Class type? I have seen usage of both static_cast and reinterpret_cast? Though from what I have been reading it appears static is better as the cast can happen at compile time? Though it says to use reinterpret_cast to convert from one pointer type to another?

    Read the article

  • [javascript] Populating jsTree based on XML data uploaded to server folder

    - by PFM
    tl:dr How can I populate jsTree based on a folder location instead of an exact XML url? I'm looking for a little direction on this project. Currently I am trying to copy file structures of hard drives as XML files and recreate them using jsTree on the webserver for a completely independent version of the file structure. I have some python script that outputs XML files that are formed to jsTree and automatically uploads to a folder on the server. The problem is now I am a little lost because I have to manually enter each XML file into jsTree code for it to display so I have multiple entries like this: $("#tree1") .jstree({ "plugins" : [ "themes", "xml_data", "ui", "search", "types" ], "xml_data" : { "ajax" : { "url" : "./XML_DATA/DRIVE1.xml" }, "xsl" : "nest" }, I see in the documentation that instead of populated by the direct file the folders are populated by "server.php" but no where in the php code does it point to any directories or files. After considering the problem I thought of a few solutions and could use some advice on them: Should I be trying to write php code to automatically look through my XML_DATA folder to upload each XML file? Should I just upload all the XML to mySQL and populate my tree based on that? Should the javascript be the code looking through the server's folder for XML files? All the XML is formed the same way but the number of XML files on the server will increase and will have to be refreshed as well as they will be overwritten with changes. Any direction would be appreciated, thanks.

    Read the article

  • Is this method of static file serving safe in node.js? (potential security hole?)

    - by MikeC8
    I want to create the simplest node.js server to serve static files. Here's what I came up with: fs = require('fs'); server = require('http').createServer(function(req, res) { res.end(fs.readFileSync(__dirname + '/public/' + req.url)); }); server.listen(8080); Clearly this would map http://localhost:8080/index.html to project_dir/public/index.html, and similarly so for all other files. My one concern is that someone could abuse this to access files outside of project_dir/public. Something like this, for example: http://localhost:8080/../../sensitive_file.txt I tried this a little bit, and it wasn't working. But, it seems like my browser was removing the ".." itself. Which leads me to believe that someone could abuse my poor little node.js server. I know there are npm packages that do static file serving. But I'm actually curious to write my own here. So my questions are: Is this safe? If so, why? If not, why not? And, if further, if not, what is the "right" way to do this? My one constraint is I don't want to have to have an if clause for each possible file, I want the server to serve whatever files I throw in a directory.

    Read the article

  • Can I get away with this or is it just too crude and unpractical ?

    - by The_AlienCoder
    I spent the whole of last night searching for a free AspNet web chat control that I could simply drag into my website. Well the search was in vain as I could not find a control that matched my needs i.e List of users, 1 to 1 chat, Ability to kick out users.. In the end I decided to create my own control from scractch. Although it works well on my machine Im concerned that It maybe a little crude and unpractical on a shared hosting enviroment. Basically this is what I did : Created an sql database that stores the chat messages. Wrote the stored procedures and and included a statement that clears old messages Then the 'crude' part : Dragged an update panel and timer control on my page Dragged a Repeater databound to the chat messages table inside the update panel Dragged another update panel and inside it put a textbox and a button Configured the timer control to tick every 5 seconds. ..and then I made it all work like this In the timer tick event I 'refreshed' the messages display by invoking Databind() on my repeater i.e protected void Timer1_Tick(object sender, EventArgs e) { MyRepeater.DataBind(); } Then in my send button click event protected void btnSend_Click(object sender, EventArgs e) { MyDataLayer.InsertMessage(Message, Sender, CurrTime); } Well It works well on my machine and Ive got the other functionalities(users list, kick out user..) to work by simply creating more tables. But like I said it seems a little crude to me. so I need a proffesional opinion. Should I run with this or try another Approach ?

    Read the article

  • How come JFrame window size in Java does not produce the size of window specified?

    - by typoknig
    Hi all, I am just messing around trying to make a game right now, but I have had this problem before too. When I specify a specific window size (1024 x 768 for instance) the window produced is just a little larger than what I specified. Very annoying. Is there a reason for this? How do I correct it so the window created is actually the size I want instead of being just a little bit bigger? Up till now I have always just gone back and manually adjusted the size a few pixels at a time until I got the result I wanted, but that is getting old. If there was even a formula I could use that would tell me how many pixels I needed to add/subtract from my my variable that would be excellent! P.S. I don't know if my OS could be a factor in this, but I am using W7X64. private int windowWidth = 1024; private int windowHeight = 768; public SomeWindow() { this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setSize(windowWidth, windowHeight); this.setResizable(false); this.setLocation(0,0); this.setVisible(true); }

    Read the article

  • Context.Items.Add on an XML return type?

    - by Scott Schluer
    So I have the following code contained within an HttpModule in an application I've been asked to support: app.Context.Response.ContentType = "text/xml"; app.Context.Items.Add("IpixRoomId", ipixRoomId); app.Context.Items.Add("IpixId", ipixId); app.Context.Response.Cache.SetCacheability(HttpCacheability.NoCache); app.Context.RewritePath(rewriteUrl, true); What's the purpose of adding data to Context.Items when the content type is XML? EDIT: For clarification, I'm calling up this URL: http://website.com/virtualtour/1971/6284/panorama2flash.swf I assume the SWF file (I know very little about Flash) makes another call to http://website.com/virtualtour/config.xml. The code I pasted above only executes on calls to config.xml. So since it's only the SWF file and config.xml being requested from the server, I'm a little confused. Can the .SWF file have access to HttpContext.Current.Items? Other than the HttpModule, there is no .NET involved in the code, it's a straight request to the SWF file which triggers a call to config.xml but it seems that those Context.Items contain the data needed to make the SWF file display the right virtual tour. I'm just missing where that link happens. It can't happen in the XML, so maybe in Flash?

    Read the article

  • Parsing Windows Event Logs, is it possible?

    - by xceph
    Hello, I am doing a little research into the feasibility of a project I have in mind. It involves doing a little forensic work on images of hard drives, and I have been looking for information on how to analyze saved windows event log files. I do not require the ability to monitor current events, I simply want to be able to view events which have been created, and record the time and application/process which created those events. However I do not have much experience in the inner workings of the windows system specifics, and am wondering if this is possible? The plan is to create images of a hard drive, and then do the analysis on a second machine. Ideally this would be done in either Java or Python, as they are my most proficient languages. The main concerns I have are as follows: Is this information encrypted in anyway? Are there any existing API for parsing this data directly? Is there information available regarding the format in which these logs are stored, and how does it differ from windows versions? This must be possible from analyzing the drive itself, as ideally the installation of windows on the drive would not be running, (as it would be a mounted image on another system) The closest thing I could find in my searches is http://www.j-interop.org/ but that seems to be aimed at remote clients. Ideally nothing would have to be installed on the imaged drive. The other solution which seemed to also pop up is the JNI library, but that also seems to be more so in the area of monitoring a running system. Any help at all is greatly appreciated. :)

    Read the article

  • i want to move div back left

    - by user1280074
    i have my BG image set to center & i wanna move my main content's div back to the left a little on that BG image. changing the width of the div wont do it. that just allows me to scroll more to the right. but i need it to move back left a little. but i still need that image center. how do i code this? bada-bing <style> body { background-image:url; background-repeat:no-repeat; background-position:center top; } </style> bada-boom <center> <div style="position: relative; left: 0px; top: 0px; width: 1200px; height: 1511px;"> <img src=""position: relative; top: 100px; left: -350px;"/> </div> </center> help me please

    Read the article

  • STLifying C++ classes

    - by shambulator
    I'm trying to write a class which contains several std::vectors as data members, and provides a subset of vector's interface to access them: class Mesh { public: private: std::vector<Vector3> positions; std::vector<Vector3> normals; // Several other members along the same lines }; The main thing you can do with a mesh is add positions, normals and other stuff to it. In order to allow an STL-like way of accessing a Mesh (add from arrays, other containers, etc.), I'm toying with the idea of adding methods like this: public: template<class InIter> void AddNormals(InIter first, InIter last); Problem is, from what I understand of templates, these methods will have to be defined in the header file (seems to make sense; without a concrete iterator type, the compiler doesn't know how to generate object code for the obvious implementation of this method). Is this actually a problem? My gut reaction is not to go around sticking huge chunks of code in header files, but my C++ is a little rusty with not much STL experience outside toy examples, and I'm not sure what "acceptable" C++ coding practice is on this. Is there a better way to expose this functionality while retaining an STL-like generic programming flavour? One way would be something like this: (end list) class RestrictedVector<T> { public: RestrictedVector(std::vector<T> wrapped) : wrapped(wrapped) {} template <class InIter> void Add(InIter first, InIter last) { std::copy(first, last, std::back_insert_iterator(wrapped)); } private: std::vector<T> wrapped; }; and then expose instances of these on Mesh instead, but that's starting to reek a little of overengineering :P Any advice is greatly appreciated!

    Read the article

< Previous Page | 58 59 60 61 62 63 64 65 66 67 68 69  | Next Page >