Daily Archives

Articles indexed Sunday March 14 2010

Page 11/89 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • How can I create a javascript library in a separate file and "include" it in another?

    - by Jordan L. Walbesser
    First, a caveat. The main script is not run in a webpage. I will be running the .js file in Windows using Windows Script Host. The problem: I would like to create a javascript "library" containing a number of objects, each with a number of functions. I expect this library will get rather large with time and would like to keep it in a separate javascript file (let's call it Library.js). I would like to access the objects from Library.js from another script (let's call this one User.js). In essence, I am looking for something similar to the C/C++ "include" paradigm. Is there anyway to implement this in javascript? (Remember, this is not web-based)

    Read the article

  • Python Least-Squares Natural Splines

    - by Eldila
    I am trying to find a numerical package which will fit a natural which minimizes weighted least squares. There is a package in scipy which does what I want for unnatural splines. import numpy as np import matplotlib.pyplot as plt from scipy import interpolate import random x = np.arange(0,5,1.0/2) xs = np.arange(0,5,1.0/500) y = np.sin(x+1) for i in range(len(y)): y[i] += .2*random.random() - .1 knots = np.array([1,2,3,4]) tck = interpolate.splrep(x,y,s=1,k=3,t=knots,task=-1) ynew = interpolate.splev(xs,tck,der=0) plt.figure() plt.plot(xs,ynew,x,y,'x')

    Read the article

  • FTP files in Windows Scripting Host?

    - by adib
    Hi What is the recommended way to transfer files via FTP and manage (rename, move, delete) files in an FTP server programmatically in a Windows Scripting Host script file (JavaScript/VBScript)? Preferably without requiring 3rd party ActiveX add-ons since these "extra" software will need to go through an approval process that will take a very long time, even for free (as in beer) and/or open source components. The script is going to be run in a Windows 2003 Server in data center environment. Thanks.

    Read the article

  • Mysql PHP generated table: doesn't work with Tablesorter

    - by echedey lorenzo
    Hi, I found this great Tablesorter plugin for jQuery but I can't make it work with my PHP generated table. Here's the code: <script type="text/javascript"> function table() { $("#container").load("table.php?randval="+Math.random()); } $(document).ready(function() { table(); $("table").tablesorter(); }); </script> Where #container is the div where the table will be and table is the name of the table. I get the table loaded but sorting function is not working. It works if I put the table directly in html in the page.. but I don't see the point in having a static table for sorting. Any help would be very appreciated.

    Read the article

  • Problem creating simple "windows script components" on Windows 7.

    - by Bigtoe
    Hi folks, I'm trying to get a Windows Script Component working on and x64 development machine. Works fine on x32 bit. But can't seem to get it running, I have the same problem with both JScript and VBScript. Here's the most simple wsc component possible. All that it does it pop up "Hello" in a message box. If you save the snippit below to a file called test_lib.wsc, you'll then be able to right click and register it. It's now available as a COM Component. <?xml version="1.0"?> <component> <?component error="true" debug="true"?> <registration description="Test Script Library" progid="TestScript.Lib" version="1.00" classid="{314042ea-1c42-4865-956f-08d56d1f00a8}" > </registration> <public> <method name="Hello"> </method> </public> <script language="VBScript"> <![CDATA[ Option Explicit Function Hello() MsgBox("Hello.") End Function ]]> </script> </component> Next create the following sample vb-script and save it to a file called test.vbs dim o set o = createobject("TestScript.Lib") o.hello() When I run the test.vbs with cscript or wscript I always get the following. "C:\test.vbs(3, 1) Microsoft VBScript runtime error: ActiveX component can't create object: 'TestScript.Lib'" This works perfectly fine on a 32 bit XP. Anyone got any ideas about what could be wrong? Thanks a bunch Noel.

    Read the article

  • How to display image in grails GSP?

    - by Walter
    I'm still learning Grails and seem to have hit a stumbling block. Here are the 2 domain classes: class Photo { byte[] file static belongsTo = Profile } class Profile { String fullName Set photos static hasMany = [photos:Photo] } The relevant controller snippet: class PhotoController { ..... def viewImage = { def photo = Photo.get( params.id ) byte[] image = photo.file response.outputStream << image } ...... } Finally the GSP snippet: <img class="Photo" src="${createLink(controller:'photo', action:'viewImage', id:'profileInstance.photos.get(1).id')}" /> Now how do I access the photo so that it will be shown on the GSP? I'm pretty sure that profileInstance.photos.get(1).id is not correct. Thanks!!

    Read the article

  • using Windows Script Host

    - by Axarydax
    Hello, I am using windows script host for some kind of installer application and I'm creating shortcuts in start menu with it. This problem came up when I switched to x64 environment (win7 ultimate x64+vs2010) I added a reference to Windows Script Host Object Model (from c:\windows\syswow64\wshom.ocx), it generated Interop.IWshRuntimeLibrary dll. I added 'using IWshRuntimeLibrary;' to my .cs files, but when I tried to create WshShell sh = new WshShellClass(); it throws an exception: Could not load file or assembly 'Interop.IWshRuntimeLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format. I assume that I would need 64-bit version of that wshom.ocx for this to work, but I don't know what should I try. Or I'll just dump Windows Script stuff, but I need another way to create start menu shortcuts from .net application. Thanks

    Read the article

  • How do I bind an iTunes style source list to an NSTableView using Core Data?

    - by Austin
    I have an iTunes style interface in my application: Source list (NSOutlineView) on the left that contains different libraries and playlists with an NSTableView on the right side of the interface displaying information for "Presentations". Similar to iTunes, I am showing the same type of information in the table view whether a library or playlist is selected (title, author, date created, etc). I currently have an NSArrayController connected to my NSTableView and was setting the fetch predicate based on what was selected in the source list. This works fine when selecting a library because I can just set the fetch predicate to filter by the "type" field in my Presentation Core Data entity. When I try to adjust the fetch predicate for the playlist however, it doesn't look like there is any way to set the fetch predicate because I've got a table in between Playlists and Presentations to keep up with the order within the Playlist. According to the Apple docs, these type of predicates are not doable with Core Data (it basically doesn't multiple inner joins). Below is the relevant portion of my Data Model. Is my data model setup incorrectly? Should I drop the NSArrayController and handle connecting the NSTableView up by hand? I'm trying to figure out if there is a simple fix, or really a design flaw.

    Read the article

  • Emails sometimes get scrambled

    - by Alex
    Folks, I have a PHP-based based site (using the QCubed framework); as a part of the site, I have a daemon that's sending out several thousand emails a day (no i'm not a spammer, everything is opt-in :)). Emails are sent through a custom framework component; that component serves as an SMTP client. I'm using a paid SMTP gateway from DNSExit.com to get the emails actually delivered. Those emails are simple HTML-based emails; they really have just simple links inside. My issue is that these links sometimes (not consistently!) get scrambled during transition. Tags somehow get mixed up, and some links are non-functional in the email. The issue happens on a small percentage of all sent emails; it is not consistent (i.e. the same exact source message HTML may or may not cause the scrambling in transition). Have any of you seen this? Any thoughts on how to troubleshoot?

    Read the article

  • Basic Team Foundation Server 2010 Question - System Resource Usage?

    - by user127954
    Guys / Gals i have a real basic Team Foundation Server 2010 question. For those of you who have played around with tfs 2010 is it a lot more light weight than tfs2008 is? I remember installing all the pieces needed for TFS 2008 one one machine at work. I remember it being a pain to install (i know 2010 is supposed to be much better) We wanted to play around with it a little bit to see if it met our needs. Well it brought that machine to a screeching halt. I'm needing a source control repository for home and i thought why not just install tfs 2010 so i can get familiar with it and maybe in the future i can make a better sell to my organization and FINALLY get them to move off of Source Safe but my concern is i only have one server at home (granted i already have SQL Server installed) and don't want to buy a machine just for this purpose. I'd also like to get more familiar with CI too. Anyways, if team is going to be to heavy i'll just use subversion but i'd like to use TFS if possible. Any help would be appreciated. thanks, Ncage

    Read the article

  • Control Windows VM from Linux Host

    - by vy32
    I am looking for a tool that will allow me to monitor and control programs running inside a Windows VM from the Linux host machine. I realize that this is similar to what a rootkit would do, and I am completely happy to use some hacker software if it provides the necessary functionality (and if I can get it in source-code form). If I can't find something, I'll have to write it using C. Probably an embedded HTTP server running on an odd port and doing some kind of XMLRPC thing. Here is the basic functionality I need: Get list of running processes Kill a process. Start a process Read/write/create/delete files I would like to: - Read contents of screen - Read all controls on screen. - Send arbitrary click to a Windows control. Does anything like this exist?

    Read the article

  • ploting 3d graph in matlab?

    - by lytheone
    Hello, I am currently a begineer, and i am using matlab to do a data analysis. I have a a text file with data at the first row is formatted as follow: time;wave height 1;wave height 2;....... I have column until wave height 19 and rows total 4000 rows. Data in the first column is time in second. From 2nd column onwards, it is wave height elevation which is in meter. At the moment I like to ask matlab to plot a 3d graph with time on the x axis, wave elevation on the y axis, and wave elevation that correspond to wave height number from 1 to 19, i.e. data in column 2 row 10 has a let say 8m which is correspond to wave height 1 and time at the column 1 row 10. I have try the following: clear; filename='abc.daf'; path='C:\D'; a=dlmread([path '\' filename],' ', 2, 1); [nrows,ncols]=size(a); t=a(1:nrows,1);%define t from text file for i=(1:20), j=(2:21); end wi=a(:,j); for k=(2:4000), l=k; end r=a(l,:); But everytime i use try to plot them, the for loop wi works fine, but for r=a(l,:);, the plot only either give me the last time data only but i want all data in the file to be plot. Is there a way i can do that. I am sorry as it is a bit confusing but i will be very thankful if anyone can help me out. Thank you!!!!!!!!!!

    Read the article

  • How do I set scons system include path

    - by Michael Anderson
    Using scons I can easily set my include paths: env.Append( CPPPATH=['foo'] ) This passes the flag -Ifoo to gcc However I'm trying to compile with a lot of warnings enabled. In particular with env.Append( CPPFLAGS=['-Werror', '-Wall', '-Wextra'] ) which dies horribly on certain boost includes ... I can fix this by adding the boost includes to the system include path rather than the include path as gcc treats system includes differently. So what I need to get passed to gcc instead of -Ifoo is -isystem foo I guess I could do this with the CPPFLAGS variable, but was wondering if there was a better solution built into scons.

    Read the article

  • Bewildering SegFault involving STL sort algorithm.

    - by just_wes
    Hello everybody, I am completely perplexed at a seg fault that I seem to be creating. I have: vector<unsigned int> words; and global variable string input; I define my custom compare function: bool wordncompare(unsigned int f, unsigned int s) { int n = k; while (((f < input.size()) && (s < input.size())) && (input[f] == input[s])) { if ((input[f] == ' ') && (--n == 0)) { return false; } f++; s++; } return true; } When I run the code: sort(words.begin(), words.end()); The program exits smoothly. However, when I run the code: sort(words.begin(), words.end(), wordncompare); I generate a SegFault deep within the STL. The GDB back-trace code looks like this: #0 0x00007ffff7b79893 in std::string::size() const () from /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.4/libstdc++.so.6 #1 0x0000000000400f3f in wordncompare (f=90, s=0) at text_gen2.cpp:40 #2 0x000000000040188d in std::__unguarded_linear_insert<__gnu_cxx::__normal_iterator<unsigned int*, std::vector<unsigned int, std::allocator<unsigned int> > >, unsigned int, bool (*)(unsigned int, unsigned int)> (__last=..., __val=90, __comp=0x400edc <wordncompare(unsigned int, unsigned int)>) at /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.4/include/g++-v4/bits/stl_algo.h:1735 #3 0x00000000004018df in std::__unguarded_insertion_sort<__gnu_cxx::__normal_iterator<unsigned int*, std::vector<unsigned int, std::allocator<unsigned int> > >, bool (*)(unsigned int, unsigned int)> (__first=..., __last=..., __comp=0x400edc <wordncompare(unsigned int, unsigned int)>) at /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.4/include/g++-v4/bits/stl_algo.h:1812 #4 0x0000000000402562 in std::__final_insertion_sort<__gnu_cxx::__normal_iterator<unsigned int*, std::vector<unsigned int, std::allocator<unsigned int> > >, bool (*)(unsigned int, unsigned int)> (__first=..., __last=..., __comp=0x400edc <wordncompare(unsigned int, unsigned int)>) at /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.4/include/g++-v4/bits/stl_algo.h:1845 #5 0x0000000000402c20 in std::sort<__gnu_cxx::__normal_iterator<unsigned int*, std::vector<unsigned int, std::allocator<unsigned int> > >, bool (*)(unsigned int, unsigned int)> (__first=..., __last=..., __comp=0x400edc <wordncompare(unsigned int, unsigned int)>) at /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.4/include/g++-v4/bits/stl_algo.h:4822 #6 0x00000000004012d2 in main (argc=1, args=0x7fffffffe0b8) at text_gen2.cpp:70 I have similar code in another program, but in that program I am using a vector instead of vector. For the life of me I can't figure out what I'm doing wrong. Thanks!

    Read the article

  • JSP Page HttpServletRequest getAttribute Typecasting

    - by MontyBongo
    Hi There, Any ideas on the correct method of typecasting an Object out of a getAttribute request from a JSP page HttpServletRequest? I have googled but it seems that the common solution is just sticking suppresswarnings in your code... Something I would very much like to avoid. I currently have: HashMap<String, ArrayList<HashMap<String, String>>> accounts = (HashMap<String, ArrayList<HashMap<String, String>>>)request.getAttribute("accounts"); And the complier is giving me this warning: Unchecked cast from Object to HashMap Thanks in Advance!! MB.

    Read the article

  • Nginx rewrite for link shortener + Wordpress pretty URLs

    - by detusueno
    Okay so I installed Nginx/PHP/MySQL/Wordpress via a online walk through, and it had me enter these rewrites to enable Wordpress pretty URLs: if (-f $request_filename) { break; } if (-d $request_filename) { break; } rewrite ^(.+)$ /index.php?q=$1 last; error_page 404 = //index.php?q=$uri; This is then included in the vhost for my domain. What I'm trying to do now is add some redirection/link shortner rewrites that will play nice with the setup I have in mind. I'd like to redirect "x.com/y" to "x.com/script.php?id=y" for all external links that I post. The Wordpress link setup right now has almost all internal links begin with "news" (x.com/news/post-blah, x.com/news/category/1, etc) BUT I also have a few root links that point to some internal content (x.com/news, x.com/start). I'm guessing that's going to cause some conflicts. What's the best approach to do this? I've never worked with Nginx (or any rewrite rules) but maybe I can distinguish between "x.com/news" and "x.com/news/" to allow it to play nice? I had a friend setup a working version of this in Apache and it'd be nice if I could get this up on Nginx again.

    Read the article

  • Why I cannot get correct class of a custom class through isKindOfClass?

    - by Anthony Chan
    Hi, I've created a custom class AnimalView which is a subclass of UIView containing a UILabel and a UIImageView. @interface AnimalView : UIView { UILabel *nameLabel; UIImageView *picture; } Then I added in several AnimalView onto the ViewController.view. In the touchesBegan:withEvent: method, I wanted to detect if the touched object is an AnimalView or not. Here is the code for the viewController: @implementation AppViewController - (void)viewDidLoad { UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:... [self.view addSubview scrollview]; for (int i = 0; i<10; i++) { AnimalView *newAnimal = [[AnimalView alloc] init]; // customization of newAnimal [scrollview addSubview:newAnimal; } } - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyObject]; UIView *hitView = touch.view; if ([hitView isKindOfClass:[AnimalView class]]) { AnimalView *animal = (AnimalView *)hitView; [animal doSomething]; } } However, nothing happened when I clicked on the animal. When I checked the class of hitView by NSLog(@"%@", [hitView class]), it always shows UIView instead of AnimalView. Is it true that the AnimalView changed to a UIView when it is added onto the ViewController? Is there any way I can get back the original class of a custom class?

    Read the article

  • Log in/out of Gmail chat programmatically, clicking Gmail's span "links"

    - by endolith
    At work, I use Gmail's chat, since it's encrypted and logs chats without installing or saving anything to the hard drive. At home, I use Pidgin. When I log into GMail at home, I have to log out of chat, or messages will end up in the wrong place. When I log into GMail at work, I have to log back in to chat. In other words, when I start Firefox at home, I want Gmail's chat disabled automatically. When I start Firefox at work, I want Gmail's chat enabled automatically. Is there a way to use a Greasemonkey script or similar to force logging in and logging out on specific machines? It would seem simple enough; just follow a URL or simulate clicking a link. Unfortunately, Gmail doesn't use actual links. While logged out: <span tabindex="0" role="link" action="si" class="az9OKd">Sign into chat</span> While logged in, in drop-down menu: <div tabindex="-1" id=":1mj" role="menuitem" class="oA" value="si"><div class="uQ c6"/>Sign into chat</div> <div tabindex="-1" id=":8f" role="menuitem" class="oA" value="sia"><div class="uQ c5"/>Sign into AIM®</div> <div tabindex="-1" id=":8e" role="menuitem" class="oA" value="so"><div class="uQ df"/>Sign out of chat</div> At bottom of page: <span id=":im" class="l8 ou" tabindex="0" role="link">turn off chat</span> <span id=":im" class="l8 ou" tabindex="0" role="link">turn on chat</span> Anyone know how to "click" these non-links with JavaScript or access their functions? I would imagine that "so" means "sign out", "si" means "sign in", and "sia" means "sign in AIM". Can I somehow call these actions directly? Is there some other alternative for disabling chat?

    Read the article

  • Eclipse hangs while opening workspace after upgrading to GWT 2.0/Google app engine 1.2.8

    - by Domchi
    After upgrading to the newest GWT/Google app engine I have problems opening my workspace in Eclipse. On startup, Eclipse hangs almost immediately and needs to be closed. This happens only in the workspace where I use GWT with app engine, and I weren't able to consistently reproduce it - sometimes it starts normally, and sometimes I need to kill the proces and restart it. There is nothing in Eclipse error log. Eclipse version is Galileo, running on Windows 7 RC. Anyone else had similar problems? I googled but Google is not my friend today. EDIT: Still happens after upgrading to GWT 2.0.1.

    Read the article

  • Suggest name for Computer Repair company...

    - by user69514
    Since I am unemployed at the moment, I decided to start a small business for computer repair. Can you help out with some ideas for the name for this new company? I was thinking of something like Computer Associates, or Computer Squad, but they sound a little cheesy. I wanted something a little more professional. Thanks for any suggestions.

    Read the article

  • ASP.NET MVC: Accessing ModelMetadata for items in a collection

    - by DanM
    I'm trying to write an auto-scaffolder for Index views. I'd like to be able to pass in a collection of models or view-models (e.g., IEnumerable<MyViewModel>) and get back an HTML table that uses the DisplayName attribute for the headings (th elements) and Html.Display(propertyName) for the cells (td elements). Each row should correspond to one item in the collection. When I'm only displaying a single record, as in a Details view, I use ViewData.ModelMetadata.Properties to obtain the list of properties for a given model. But what happens when the model I pass to the view is a collection of model or view-model objects and not a model or view-model itself? How do I obtain the ModelMetadata for a particular item in a collection?

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >