Daily Archives

Articles indexed Saturday January 15 2011

Page 14/28 | < Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >

  • Using AJAX in Rails: How do I change a button as soon as it's clicked?

    - by sdc
    Hey! I'm teaching myself Ruby, and have been stuck on this for a couple days: I'm currently using MooTools-1.3-compat and Rails 3. I'd like to replace one button (called "Follow") with another (called "Unfollow") as soon as someone clicks on it. I'm using :remote = true and have a file ending in .js.erb that's being called...I just need help figuring out what goes in this .js file The "Follow" button is in a div with id="follow_form", but there are many buttons on the page, and they all have an id = "follow_form"...i.e. $("follow_form").set(...) replaces the first element and that's not correct. I need help replacing the button that made the call. I looked at this tutorial, but the line below doesn't work for me. Could it be because I'm using MooTools instead of Prototype? $("follow_form").update("<%= escape_javascript(render('users/unfollow')) %") ps. This is what I have so far, and this works: in app/views/shared: <%= form_for current_user.subscriptions.build(:event => @event), :remote => true do |f| %> <div><%= f.hidden_field :event %></div> <div class="actions"><%= f.submit "Follow" %></div> <% end %> in app/views/events/create.js.erb alert("follow!"); //Temporary...this is what I'm trying to replace *in app/controllers/subscriptions_controller.rb* def create @subscription = current_user.subscriptions.build(params[:subscription]) @subscription.save respond_to do |format| format.html { redirect_to(..) } format.js {render :layout} end Any help would be greatly, greatly appreciated!

    Read the article

  • Simplest possible Ubuntu GUI app.

    - by Chris Becke
    On Windows, no matter which framework you use, all the frameworks need, ultimately, to call the user mode user32::CreateWindowEx API to actually create a window on the desktop. On Ubuntu, or indeed Linux systems in general, it seems that the choices are to use a widget framework like Wx or Qt or GTK+ to create a GUI application, but all these frameworks feel like they are wrapping something more fundamental. Do these all talk directly to X on Linux? I thought Ubuntu was moving to a non X window manager, so what are they going to use then? What library would I use to access the window manager all these frameworks use?

    Read the article

  • Building InstallShield based Installers using Team Build 2010

    - by jehan
    Last few weeks, I have been working on Application Packaging stuff using all the widely used tools like InstallShield, WISE, WiX and Visual Studio Installer. So, I thought it would be good to post about how to Build the Installers developed using these tools with Team Build 2010. This post will focus on how to build the InstallShield generated packages using Team Build 2010. For the release of VS2010, Microsoft has partnered with Flexera who are the makers of InstallShield to create InstallShield Limited Edition, especially for the customers of Visual Studio. First Microsoft planned to release WiX (Windows Installer Xml) with VS2010, but later Microsoft dropped  WiX from VS2010 due to reasons which are best known to them and partnered with InstallShield for Limited Edition. It disappointed lot of people because InstallShield Limited Edition provides only few features of InstallShield and it may not feasable to build complex installer packages using this and it also requires License, where as WiX is an open source with no license costs and it has proved efficient in building most complex packages. Only the last three features are available in InstallShield Limited Edition from the total features offered by InstallShield as shown in below list.                                                                                            Feature Limited Edition for Visual Studio 2010 Standalone Build System Maintain a clean build machine by using only the part of InstallShield that compiles the installations. InstallShield Best Practices Validation Suite Avoid common installation issues. Try and Die Functionality RCreate a fully functional trial version of your product. InstallShield Repackager Create Windows Installer setups from any legacy installation. Multilingual Support Present installation text in up to 35 languages. Microsoft App-V™ Support Deploy your applications as App-V virtual packages that run without conflict. Industry-Standard InstallScript Achieve maximum flexibility in your installations. Dialog Editor Modify the layout of existing end-user dialogs, create new custom dialogs, and more. Patch Creation Build updates and patches for your products. Setup Prerequisite Editor Easily control prerequisite restart behavior and source locations. String Editor View Control the localizable text strings displayed at run time with this spreadsheet-like table. Text File Changes View Configure search-and-replace actions for content in text files to be modified at run time. Virtual Machine Detection Block your installations from running on virtual machines. Unicode Support Improve multi-language installation development. Support for 64-Bit COM Extraction Extract COM data from a 64-bit COM server. Windows Installer Installation Chaining Add MSI packages to your main installation and chain them together. XML Support Save time by quickly testing XML configuration changes to installation projects. Billboard Support for Custom Branding Display Adobe Flash billboards and other graphic files during the install process. SaaS Support (IIS 7 and SSL Technologies) Easily deploy Windows-based Web applications. Project Assistant Jumpstart a project by using a simplified set of views. Support for Digital Signatures Save time by digitally signing all your files at build time. Easily Run Custom Actions Schedule a custom action to run at precisely the right moment in your installation. Installation Prerequisites Check for and install prerequisites before your installation is executed. To create a InstallShield project in Visual Studio and Build it using Team Build 2010, first you have to add the InstallShield Project template  to your Solution file. If you want to use InstallShield Limited edition you can add it from FileàNewà project àother Project Types àSetup and Deploymentà InstallShield LE and if you are using other versions of InstallShield, then you have to add it from  from FileàNewà project àInstallShield Projects. Here, I’m using  InstallShield 2011 Premier edition as I already have it Installed. I have created a simple package for TailSpin Application which has a Feature called Web, few components and a IIS Web Site for  TailSpin application.   Before started working on this, I thought I may need to build the package by calling invoke process activity in build process template or have to create a new custom activity. But, it got build without any changes to build process template. But, it was failing with below error message. C:\Program Files (x86)\MSBuild\InstallShield\2011\InstallShield.targets (68): The "InstallShield.Tasks.InstallShield" task could not be loaded from the assembly C:\Program Files (x86)\MSBuild\InstallShield\2010Limited\InstallShield.Tasks.dll. Could not load file or assembly 'file:///C:\Program Files(x86)\MSBuild\InstallShield\2011\InstallShield.Tasks.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. This error is due to 64-bit build machine which I’m using. This issue will be replicable if you are queuing a build on a 64-bit build machine. To avoid this you have to ensure that you configured the build definition for your InstallShield project to load the InstallShield.Tasks.dll file (which is a 32-bit file); otherwise, you will encounter this build error informing you that the InstallShield.Tasks.dll file could not be loaded. To select the 32-bit version of MSBuild, click the Process tab of your build definition in Team Explorer. Then, under the Advanced node, find the MSBuild Platform setting, and select x86. Note that if you are using a 32-bit build machine, you can select either Auto or x86 for the MSBuild Platform setting.  Once I did above changes, the build got successful.

    Read the article

  • SubMain Ghost Doc Pro with SpellChecking

    - by TATWORTH
    SubMain have announced at http://community.submain.com/forums/2/1556/ShowThread.aspx#1556 that the next version of GhostDoc will include a VS2005/VS2008/VS2010 compatible spell checker. This replaces their existing spellchecker (http://submain.com/products/codespell.aspx)  which is being discontinued. If you buy GhostDoc Pro now (I urge you to as it helps tremendously in documenting both C# and VB.NET code) , be sure to include Licence Protection as it means you will get the next version that includes the spell-checker free! Why is a spell checker important? By spell checking all your comments, you will make your documentation much easier to read. This means that instead of you being distracted by typographic errors, your mind will be free to see errors in what has been written. Remember the next person that has to struggle to read your code could well be yourself! So be kind to your self. Do the following: Document whole source files in VB.NET of C# with GhostDoc Pro Run Stylecop and fix the issues it uncovers. Run the spellchecker (when it is available) Add remarks where necessary Specify in the project to produce XML documentation Compile the XML using Sandcastle to help files Review the help files and ask yourself if the explanations are sufficient.

    Read the article

  • MySQL InnoDB/socket issue on Mac OS X 10.6.4

    - by user55217
    I have an ongoing issue on my Macbook Pro OS X 10.6.4. Intermittently, my MySQL install will not create a socket on startup. Rebooting sometimes, but not always, solves the problem. Deleting the ib* files in /usr/local/mysql/data and then restarting sometimes, but not always, solves the problem. My error logs tell me the following: Plugin InnoDB init function returned error Plugin InnoDB registration as a STORAGE ENGINE failed Can't start server: Bind on TCP/IP port: Address already in use Do you already have another mysqld server running on port: 3306? Aborting It then appears to attempt to start again and generates this error 20 - 30 times: Unable to lock ./ibdata1, error 35 Check that you do not already have another mysqld process using the same InnoDB data or log files Though the socket file is not created, I can connect to my MySQL db directly over localhost. Although, this does not help me from a PHP standpoint. Any thoughts on what I can do to resolve the issue or debug further? I'm at a loss as to where to go from here.

    Read the article

  • How to find malformed - corrupted - dos - BOMByte Files in Linux

    - by Syquus
    I've several problems maintaining large production servers, in which some developers drop files from Windows environments, sometime with BOM-bytes (We use UTF8, and no need for that), causing lots of troubles. Other times, I got a "no end of line" and "[DOS]" labels when vim-editing files directly on the server. I recently discovered how to find for the bom byte, and how to delete it in a batch script. What about illegal bytes, bad EOLs? Is it safe to use DOS Text Files on a linux environment? Any drawbacks If I use to convert them with dos2unix cmd ? Regards

    Read the article

  • GDM login screen is not displayed with VNC

    - by niboshi
    Hi, I set up VNC server with xinetd. Also configured GDM so that XDMCP is enabled. VNC connection seems okay, but GDM login screen is not shown. Instead I can only see old bare X screen (gray meshed background and X-shaped mouse pointer), which I can't do any interaction with it. What can I do to fix the problem? No log is written below /var/log/. Server distribution: Ubuntu marverick /etc/xinetd.d/vnc is like below: service vnc1024 { disable = no socket_type = stream protocol = tcp wait = no user = nobody server = /usr/bin/Xvnc server_args = -inetd -query localhost -geometry 1024x768 -depth 24 -once securitytypes=none port = 12345 } /etc/gdm/custom.conf: [daemon] [security] DisallowTCP=false [xdmcp] Enable=true [gui] [greeter] [chooser] [debug] [servers] /etc/services is also configured. Thanks

    Read the article

  • How to intercept and manipulate DNS queries?

    - by emtunc
    I'm not sure if I worded the question correctly to be honest but basically what I want to do is: When a user types in something like Expenses in the URL bar of a browser, I want the browser to be directed to a specific web address (very very similar to how OpenDNS shortcuts work) The IP address of the web address will not change amongst the different 'shortcuts'... i.e: mycompany.com = 10.0.0.0 mycompany.com/expenses = 10.0.0.0 mycompany.com/tracker = 10.0.0.0 When a user types expenses in the browser address bar and presses enter, I want the browser to automatically direct to the specified address as above. Would this be tricky to implement? I hope I have put my question forward appropriately :-) Additional notes: We are on a Windows envionment I believe the exchange server is running as the DNS server in the office

    Read the article

  • Awstats logformat typo?

    - by user66700
    I've been through the awstats docs for a while now, it just seems to be failing with the Logformat, http://pastebin.com/raw.php?i=J1Ecfu4c I'm using the following in awstats, LogFormat = "%host - - %host_r %time1 %methodurl %code %bytesd %refererquot %uaquot %otherquot" (from nginx) log_format main '$remote_addr - $remote_user [$time_local] $request ' '"$status" $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log logs/access.log main; sample hits: http://pastebin.com/raw.php?i=qD9PKN52

    Read the article

  • PHP+Apache as forward/reverse proxy: ¿how to process client requests and server responses in PHP?

    - by Lightworker
    Hi! I'm having a lot of troubles with the propper configuration of Apache mod_proxy.so to work as desired... The main idea, is to create a proxy on a local machine in a network wich will have the ability to proces a client request (client connected through this Apache prepared proxy) in PHP. And also, it will have the capacity to process the server responses on PHP too. Those are the 2 funcionalities, and they are independent one from each other. Let me present a little schema of what I need to achive: As you can see here, there're 2 ways: blue one and red one. For the blue one, I basically conected a client (Machine B - cell phone) on my local network (home) and configured it to go thorugh a proxy, wich is the Machine A (personal computer) on the exactly same network. So let's say (not DHCP): Machine A: 192.168.1.40 -- Apache is running on this machine, and configured to listen port 80. Machine B (cell phone): 192.168.1.75 -- configured to go throug a proxy, wich is IP 192.168.1.75 and port 80 (basically, Machine A). After configuring Apache properly, wich is basically to remove the "#" from httpd.conf on the lines for the mod_proxy.so (main worker), mod_proxy_connect.so (SSL, allowCONNECT, ...) and mod_proxy_http.so (needed for handle HTTP request/responses) and having in my case, lines like this: # Implements a proxy/gateway for Apache. Include "conf/extra/httpd-proxy.conf" # Various default settings Include "conf/extra/httpd-default.conf" # Secure (SSL/TLS) connections Include "conf/extra/httpd-ssl.conf" wich gives me the ability to configure the file httpd-proxy.conf to prepare the forward proxy or the reverse proxy. So I'm not sure, if what I need it's a forward proxy or a reverse one. For a forward proxy I've done this: <IfModule proxy_module> <IfModule proxy_http_module> # # FORWARD Proxy # #ProxyRequests Off ProxyRequests On ProxyVia On <Proxy *> Order deny,allow # Allow from all Deny from all Allow from 192.168.1 </Proxy> </IfModule> </IfModule> wich basically passes all the packets normally to the server and back to the client. I can trace it perfectly (and testing that works) looking at the "access.log" from Apache. Any request I make with the cell phone, appears then on the Apache log. So it works. But here come the problem: I need to process those client requests. And I need to do it, in PHP. I have read a lot about this. I've read in detail the oficial site from Apache about mod_proxy. And I've searched a lot on forums, but without luck. So I thought about a first aproximation: 1) Forward proxy in Apache, passes all the packets and it's not possible to process them. This seems to be true, so, what about a reverse proxy? So I envisioned something like: ProxyRequests Off <Proxy *> Order deny,allow Allow from all </Proxy> ProxyPass http://www.google.com http://www.yahoo.com ProxyPassReverse http://www.google.com http://www.yahoo.com which is just a test, but this should cause on my cell phone that when trying to navigate to Google, I should be going to Yahoo, isn't it? But not. It doesn't work. So you really see, that ALL the examples on Apache reverse proxy, goes like: ProxyPass /foo http://foo.example.com/bar ProxyPassReverse /foo http://foo.example.com/bar wich means, that any kind of request in a local context, will be solved on a remote location. But what I needed is the inverse! It's that when asking for a remote site on my phone, I solve this request on my local server (the Apache one) to process it with a PHP module. So, if it's a forward proxy, I need to pass through PHP first. If it's a reverse proxy, I need to change the "going" direction to my local server one to process first on PHP. Then comes in mind second option: 2) I've seen something like: <Proxy http://example.com/foo/*> SetOutputFilter INCLUDES </Proxy> And I started to search for SetOutputFilter, SetInputFilter, AddOutputFilter and AddInputFilter. But I don't really know how can I use it. Seems to be good, or a solution to me, cause with somethin' like this, I should can add an Input filter to process on PHP the client requests and send back to the client what I programed/want (not the remote server response) wich is the BLUE path on schema, and I should have the ability to add an Output filter wich seems to give me the ability to process the remote server response befor sending it to the client, wich should be the RED path on the schema. Red path, it's just to read server responses and play with em. But nothing more. The Blue path, it's the important one. Cause I will send to the client whatever I want after procesing the requests. I so sorry for this amazingly big post, but I needed to explain it as well as I can. I hope someone will understand my problem, and will help me to solve it! Lot of thanks in advance!! :)

    Read the article

  • Brightness Controls not working on HP Dm3t

    - by Karim
    i have an HP dm3t notebook which normally comes with windows 7. after some time i figured out how to install Windows XP on it. but now i am facing a problem that the brightess controls dont work so i am unable to change the brightess. the strange thing is that all the other buttons (sound volume, mute, sleep , etc... ) works but not the 2 brightess controls. i already downloaded the "HP Quick Launch Buttons" so i am asking about suggesitions how can i enable these two buttons in windows XP or even if i can change the brightess using some kind of software. thanks

    Read the article

  • Set Final Cut Express Sequence Options 4:3 to 960p (30fps)

    - by Maccaius
    Hi I have an project in FCE which was recorded in MPEG-4 video in 1280 x 960 (1,4MB/s) and whenever I import those mov files to FCE thez show just fine. but when i add the clips to the timeline (sequence) the quality is cropped - instead of HD i can onlz export the timeline with quicktime conversion and a resolution of 720 x 480. can anybody help me out and tell me how i can export the timeline in full HD quality (as the raw material itself is)? tried the quick setup and exporting as divx and AIC which doesnt reallz work. the actual video size is HD, but qualitz of the video is like SD...

    Read the article

  • Analysing SQLBits Feedback

    - by jamiet
    Earlier this week I received all the feedback that people offered on my session at SQLBits 7 in York – “SSIS Dataflow Performance Tuning” (the video is available online if you wish to see it). As you may have gathered from previous posts on this blog and my less-SQLy-focused Wordpress blog I am a big fan of collecting and tracking both personal and public data and session feedback lends itself very well to tracking because it is quantitative rather than qualitative; by that I mean attendees are invited to provide marks out of ten rather than (or, in the case of SQLBits, as well as) written comments. The SQLBits feedback is also useful because they use a consistent format – the same questions are asked each time – this means it is particularly easy to to track whether the scores that people give are trending up or down. I suspect that somewhere the SQLBits organisers have a big Analysis Services cube (ok, perhaps its an Excel pivot table) that allows them to analyse these scores per conference, speaker, track etc.… and there’s no reason that we as session speakers cannot do the same thing. To that end I have started to store my feedback in an Excel spreadsheet of my own which in the interests of transparency is available for public viewing (only a web browser required) on SkyDrive at http://cid-550f681dad532637.office.live.com/view.aspx/Public/Misc/Personal%20SQLBits%20Session%20Feedback.xlsx. I have used a pivot table to aggregate all that feedback and here is a screenshot: I am hereby making a public plea to the SQLBits organisers (on the off-chance that they are reading) to please continue to keep the feedback format consistent in the future and I encourage them to publish all of the feedback in an anonymised form. I would also encourage anyone doing conference speaking to track their conference feedback in the same way that I am doing so that you get an insight into whether or not you are improving over time. It is not difficult to setup and maintaining it as you do more sessions takes very little effort. Storing feedback data like this leads me to wider thoughts about well-known conventions and data format standardisation. Let’s imagine a utopia where there were a standard set of questions for capturing session feedback that were leveraged at every conference regardless of subject matter, location or culture; that would give rise to immense cross-conference and cross-discipline analysis – the data analyst in me goes giddy at the thought of it. It is scenarios like this that drive my interest both in data formats such as iCalendar, microformats and RDF, and in emerging movements such as the semantic web and linked data, all things which I have written about in the past. I don’t know whether we will ever reach the stage where every piece of data has structured, descriptive metadata associated with it but I live in hope. @Jamiet

    Read the article

  • Optimizing lifestyle and training

    - by Gabe
    I am a college freshman who has recently discovered a passion for computer science. Having had my first lick of formal python training last semester, I have cast aside my previously hedonist way of life and tunneled my sights on becoming the most rounded and proficient programmer I can be. I know that I'm taking strides in the right direction (I've stopped smoking, I've been exercising every day, I've taught myself C++ and OpenGL, and I've begun training in kung-fu and meditation), yet I am still finding myself struggling to achieve satisfactory results. I would like to be able to spend a good 3-4 hours every day burning through textbooks. I have the time cleared and the resources allocated. The problem lies in the logistics-- I have never taken anything seriously before. Recently I've realized that I am clueless when it comes to taking care of myself and gaining control of my mind, and it drastically hinders my productivity. My question is this: How can I learn to manage my time and take care of myself such that I can spend the maximum amount of time every day studying with steady concentration? Personal tricks would be key here: techniques you use to get yourself to sleep, a diet that yields focus, even computer break stretching routines or active reading techniques. Anything you could think of here would be great. I was a low-life in high school and I have the drive to turn my life around, I'm just quite a bit behind in the way of good habits :)

    Read the article

  • How can I keep directories in sync

    - by Guillaume Boudreau
    I have a directory, dirA, that users can work in: they can create, modify, rename and delete files & sub-directores in dirA. I want to keep another directory, dirB, in sync with dirA. What I'd like, is a discussion on finding a working algorithm that would achieve the above, with the limitations listed below. Requirements: 1. Something asynchronous - I don't want to stop file operations in dirA while I work in dirB. 2. I can't assume that I can just blindly rsync dirA to dirB on regular interval - dirA could contain millions of files & directories, and terrabytes of data. Completely walking the dirA tree could take hours. Those two requirements makes this really difficult. Having it asynchronous means that when I start working on a specific file from dirA, it might have moved a lot since it appeared. And the second limitation means that I really need to watch dirA, and work on atomic file operations that I notice. Current (broken) implementation: 1. Log all file & directory operations in dirA. 2. Using a separate process, read that log, and 'repeat' all the logged operations in dirB. Why is it broken: echo 1 > dirA/file1 # Allow the 'log reader' process to create dirB/file1: log = "write dirA/file1"; action = cp dirA/file1 dirB/file1; result = OK echo 1 > dirA/file2 mv dirA/file1 dirA/file3 mv dirA/file2 dirA/file1 rm dirA/file3 # End result: file1 contains '1' # 'log reader' process starts working on the 4 above file operations: log = "write file2"; action = cp dirA/file2 dirB/file2; result = failed: there is no dirA/file2 log = "rename file1 file3"; action = mv dirB/file1 dirB/file3; result = OK log = "rename file2 file1"; action = mv dirB/file2 dirB/file1; result = failed: there is no dirB/file2 log = "delete file3"; action = rm dirB/file3; result = OK # End result in dirB: no more files! Another broken example: echo 1 > dirA/dir1/file1 mv dirA/dir1 dirA/dir2 # 'log reader' process starts working on the 2 above file operations: log = "write file1"; action = cp dirA/dir1/file1 dirB/dir1/file1; result = failed: there is no dirA/dir1/file1 log = "rename dir1 dir2"; action = mv dirB/dir1 dirB/dir2; result = failed: there is no dirA/dir1 # End result if dirB: nothing!

    Read the article

  • Laptop works fine with ac adapter, hangs after login screen using battery

    - by tavoton
    I did an Ubuntu 10.10 Desktop Edition clean install (amd64 version) on a notebook Medion Akoya E1311. With AC adapter everything works fine, but using battery, it hangs after login screen. I can type login, password too, and I can press login button. But then I can see mouse cursor and lower task bar, not upper, and nothing works. The only thing I can do is login on a terminal with ctrl+alt+F1, this is ok. Nothing seems alive on Gnome except mouse cursor. The only thing I did after Ubuntu fresh install was donwloading driver for RTL8191SE from Realtek web, because WiFi didn't work, now works fine, with ac adapter of course. Hardware is a Notebook Medion Akoya E1311 AMD Sempron 210U 1 GB DDR2 ATI RS690M (Radeon X1200 Series) Western Digital 160GB wireless RTL8191SEvB ethernet RTL8101E/RTL8102E

    Read the article

  • apache2 tomcat6 virtual hosting

    - by user3215
    I've apache2 and tomcat6 running on port 80 on ubuntu server 9.10. I've a registered domain name and I'll access the jsp index page navigating to http://abc.mydomain.com. The page is under tomcat_home/webapps/myapp and the below are tomcat virtual hosting in server.xml file: <Host name="abc.mydomain.com" debug="0" appBase="webapps" unpackWARs="true"> <Logger className="org.apache.catalina.logger.FileLogger" directory="logs" prefix="virtual_log1." suffix=".log" timestamp="true"/> <Context path="" docBase="/usr/share/tomcat/webapps/myapps" debug="0" reloadable="true"/> </Host> Recently a new domain has been bought(xyz.mydomain.com) and I'm asked to do the virtual hosting so that the new domain name directly points the page "admin.jsp" which is located under 'tomcat_home/webapps/myapps/WE-INF/js/'. How could I do this? If I type http://abc.mydomain.com/admin I'll get the page what I wanted. I should access the page just by typing http://xyz.mydomain.com.

    Read the article

  • How to set the component size with GridLayout? Is there a better way?

    - by Blackbam
    Hello guys, I am working on a larger GUI with Java and I am becoming angry on Layout Managers. I have a "Settings-Panel" with a variable number of JComponents in it (Labels, Buttons, JSpinners, JSliders,...). I just want the following: JLabel <- JComponent JLabel <- JComponent JLabel <- JComponent ... My Panel has a size of 500px, so that there is enough space for a lot of components. Unfortunatly the GridLayout always stretches the size of the Components to the whole Panel, even if I set a MaximumSize for every component. It looks stupid if there are only two buttons each with a height of 250px. I tried flow Layout, but i cannot figure out a way to make new lines properly. I tried BoxLayout.Y_AXIS, but the Components are always centered, and Label and Component are not in the same line. Does anybody know a good and short way with LayoutManagers to handle this properly?

    Read the article

  • What is the most efficient way to handle points / small vectors in JavaScript?

    - by Chris
    Currently I'm creating an web based (= JavaScript) application thata is using a lot of "points" (= small, fixed size vectors). There are basically two obvious ways of representing them: var pointA = [ xValue, yValue ]; and var pointB = { x: xValue, y: yValue }; So translating my point a bit would look like: var pointAtrans = [ pointA[0] + 3, pointA[1] + 4 ]; var pointBtrans = { x: pointB.x + 3, pointB.y + 4 }; Both are easy to handle from a programmer point of view (the object variant is a bit more readable, especially as I'm mostly dealing with 2D data, seldom with 3D and hardly with 4D - but never more. It'll allways fit into x,y,z and w) But my question is now: What is the most efficient way from the language perspective - theoretically and in real implementations? What are the memory requirements? What are the setup costs of an array vs. an object? ... My target browsers are FireFox and the Webkit based ones (Chromium, Safari), but it wouldn't hurt to have a great (= fast) experience under IE and Opera as well...

    Read the article

  • ADO Exception in HQL query

    - by Yoav
    I have 2 classes: Project and DataStructure. Class Project contains member List<DataStructure. My goal is to load a Project and all its DataStructures in one call. public class Project { public virtual string Id { get { } set { } } public virtual string Name { get { } set { } } public virtual ISet<DataStructure> DataStructures { get { } set { } } } public class DataStructure { public virtual string Id { get { } set { } } public virtual string Name { get { } set { } } public virtual string Description { get { } set { } } public virtual Project Project { get { } set { } } public virtual IList<DataField> Fields { get { } set { } } } Note that DataStructure also contains a list of class DataField but I don’t want to load these right now. Mapping in Fluent NHibernate: public class ProjectMap : ClassMap<Project> { public ProjectMap() { Table("PROJECTS"); Id(x => x.Pk, "PK"); Map(x => x.Id, "ID"); Map(x => x.Name, "NAME"); HasMany<DataStructure>(x => x.DataStructures).KeyColumn("FK_PROJECT"); } } public class DataStructureMap : ClassMap<DataStructure> { public DataStructureMap() { Table("DATA_STRUCTURES"); Map(x => x.Id, "ID"); Map(x => x.Name, "NAME"); Map(x => x.Description, "DESCRIPTION"); References<Project>(x => x.Project, "FK_PROJECT"); HasMany<DataField>(x => x.Fields).KeyColumn("FK_DATA_STRUCTURE"); } } This is my query: using (ISession session = SessionFactory.OpenSession()) { IQuery query = session.CreateQuery("from Project pr left join pr.DataStructure"); project = query.List<Project>(); } query.List() returns this exception: NHibernate.Exceptions.GenericADOException: Could not execute query[SQL: SQL not available] ---> System.ArgumentException: The value "System.Object[]" is not of type "Project" and cannot be used in this generic collection.

    Read the article

  • How to implement a grapher in C#

    - by iansinke
    So I'm writing a graphing calculator. So far I have a semi-functional grapher, however, I'm having a hard time getting a good balance between accurate graphs and smooth looking curves. The current implementation (semi-pseudo-code) looks something like this: for (float i = GraphXMin; i <= GraphXMax; i++) { PointF P = new PointF(i, EvaluateFunction(Function, i) ListOfPoints.Add(P) } Graphics.DrawCurve(ListOfPoints) The problem with this is since it only adds a point at every integer value, graphs end up distorted when their turning points don't fall on integers (e.g. sin(x)^2). I tried incrementing i by something smaller (like 0.1), which works, but the graph looks very rough. I am using C# and GDI+. I have SmoothingMethod set to AntiAlias, so that's not the problem, as you can see from the first graph. Is there some sort of issue with drawing curves with a lot of points? Should the points perhaps be positioned exactly on pixels? I'm sure some of you have worked on something very similar before, so any suggestions? While you're at it, do you have any suggestions for graphing functions with asymptotes? e.g. 1/x^2 P.S. I'm not looking for a library that does all this - I want to write it myself.

    Read the article

  • CSS: 100% of container height without modifying the container

    - by Rena
    Yeah, this ugly question again. I'm writing some HTML that gets inserted into a page. I have no control over the rest of the page. The structure is something like: <table <tr <td rowspan="2"left column</td <td height="1"top row above content</td </tr <tr<td height="220"my content here</td</tr </table I can write whatever I want into that table cell (including style tags to pack in my CSS), but I can't touch anything outside of it, which means I can't set the height of any parent element (including html and body), add a doctype (it has none), etc - that already kills just about every solution I can find (all seem to be "add a doctype" and/or "give the parent container a fixed height"). What I want to do is simply have a <div fill the entire cell. Width is no problem but unsurprisingly height is being a massive pain. Writing "height: 100%" doesn't do anything unless the container has a fixed height (the height="220" attribute apparently doesn't count) or the div uses absolute positioning - and then it seems to want to use 100% of the window's height (and width even) instead of the cell's. The root of the problem is the left column varies in height, as does the content, and when the left column cell is larger than the content, it won't expand to fill the cell it's in. If I set a fixed height for the content, it'll be much larger than necessary most of the time, and if I don't, it doesn't take up all of the cell and leaves an ugly gap at the bottom.

    Read the article

  • best method for background uploader in Android

    - by Dr.Dredel
    Problem: I want to write a process that will allow a user to take photos with the device and for those photos to then be uploaded to some listener in the cloud. The user should not have to do anything to initiate the upload, a background listener would just watch the folder and as long as it finds files in it it would upload them and delete them. Two problems: 1) how to keep the program running in the background even after the user is no longer taking pictures (and if they reboot the device for it to wake up and finish the uploads, if any remain) 2) assuming the connection is spotty (as it always is) how to verify that a given image has completed its upload, and if not, to resubmit it. I don't need any code examples, I just would like opinions on the best strategy to get this implemented. I was going to use Apache commons and just do an upload to a PHP, but am not sure what sort of error checking exists to take into account a connection drop mid file. TIA.

    Read the article

  • WPF - collapsing grid cells

    - by user553765
    Hi, I'm having some problems with the layout of buttons on a screen. There are a number of buttons with the visibility set to collapsed depending on certain criteria. Anyway, with the buttons sitting in a stackpanel, the contents determine the width of the buttons. Because these should share the same size, I put them in a grid where the columns are using the SharedSizeGroup. Having done this, buttons now all share the same width, the smallest width needed to display the button with the largest content. What it does mean though is that buttons don't display at the required position. That is - assume five buttons in columns 0-4 where the first button is collapsed, buttons should ideally all shift to the left so that they always occupy space left to right. Is there any way I can accomplish this or, if not, how can I get buttons in a stackpanel to share the same width? Any help is much appreciated.

    Read the article

  • Add custom method to string object [closed]

    - by cru3l
    Possible Duplicate: Can I add custom methods/attributes to built-in Python types? In Ruby you can override any built-in object class with custom method, like this: class String def sayHello return self+" is saying hello!" end end puts 'JOHN'.downcase.sayHello # >>> 'john is saying hello!' How can i do that in python? Is there a normally way or just hacks?

    Read the article

< Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >