Daily Archives

Articles indexed Saturday April 24 2010

Page 21/78 | < Previous Page | 17 18 19 20 21 22 23 24 25 26 27 28  | Next Page >

  • How to open a .a file

    - by Mgst
    Heya! My name is Ale, and this is the first time that I post in this website. I've a little problem: I have to open a linker file, that have ".a" extension. I use Dev-C++, I don't know if it would be useful for you :-P I hope you will answer soon! Oh, and excuse me for my bad English, tell me if I made some mistakes! Thanks!!

    Read the article

  • Python `.pth` files and using relative paths

    - by kRON
    I have a lot of development versions of packages installed with virtualenv under the default /src directory in the environment. Normally, I decided to do the development of my project under the /src directory afterwards. To add my directory to the Python path, I decided to eschew from using any absolute paths, since I'm going to have to move the project around with my friends. It's a Django application, so I was happy with putting environment.pth under the root that contained the path to my project and a wsgi in the same directory would call the sites module to parse environment.pth. All good. I was also looking to move the .pth file into site-packages, but I'm having trouble with relative paths that move up the directory tree. For: /env /lib /site-pacakges /src /myproject So, the .pth entry in site-packages to myproject should look like ../../src/myproject, but this doesn't seem to be working for me on Windows.

    Read the article

  • Problem in calling Excel function

    - by Newbie
    I am facing a problem while making Excel's LinEST function. My program goes like MyExcel.Application xl = new MyExcel.Application(); MyExcel.WorksheetFunction wsf = xl.WorksheetFunction; List<int> x = new List<int> { 1, 2, 3, 4 }; List<int> y = new List<int> { 11, 12, 45, 42 }; object o = wsf.LinEst(x, y, true, true); And the namespace is using MyExcel = Microsoft.Office.Interop.Excel; The program is compiling smoothly but at runtime it is throwing an error {System.Runtime.InteropServices.COMException (0x80020005): Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH)) Actually this is the first time I am using Excel function .. so I am unable to proceed further. If any one has run thru this kind of situation and has solved, please help me. I am using C# 3.0 Thanks

    Read the article

  • Python: x-y-plot with matplotlib

    - by kame
    I want to plot some data. The first column contains the x-data. But matplotlib doesnt plot this. Where is my mistake? #fresnel formula import numpy as np from numpy import cos from scipy import * from pylab import plot, show, ylim, yticks from matplotlib import * from pprint import pprint n1 = 1.0 n2 = 1.5 #alpha, beta, intensity data = [ [10, 22, 4.3], [20, 42, 4.2], [30, 62, 3.6], [40, 83, 1.3], [45, 102, 2.8], [50, 123, 3.0], [60, 143, 3.2], [70, 163, 3.8], ] for i in range(len(data)): rhotang1 = (n1 * cos(data[i][0]) - n2 * cos(data[i][1])) rhotang2 = (n1 * cos(data[i][0]) + n2 * cos(data[i][1])) rhotang = rhotang1 / rhotang2 data[i].append(rhotang) #append 4th value pprint(data) x = data[:][0] y1 = data[:][2] y3 = data[:][3] plot(x, y1, x, y3) show() EDIT: http://paste.pocoo.org/show/205534/ But it doesnt work.

    Read the article

  • WPF data templates

    - by imekon
    I'm getting started with WPF and trying to get my head around connecting data to the UI. I've managed to connect to a class without any issues, but what I really want to do is connect to a property of the main window. Here's the XAML: <Window x:Class="test3.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:custom="clr-namespace:test3" Title="MainWindow" Height="350" Width="525"> <Window.Resources> <CollectionViewSource Source="{Binding Source={x:Static Application.Current}, Path=Platforms}" x:Key="platforms"/> <DataTemplate DataType="{x:Type custom:Platform}"> <StackPanel> <CheckBox IsChecked="{Binding Path=Selected}"/> <TextBlock Text="{Binding Path=Name}"/> </StackPanel> </DataTemplate> </Window.Resources> <Grid> <ListBox ItemsSource="{Binding Source={StaticResource platforms}}"/> </Grid> Here's the code for the main window: public partial class MainWindow : Window { ObservableCollection<Platform> m_platforms; public MainWindow() { m_platforms = new ObservableCollection<Platform>(); m_platforms.Add(new Platform("PC")); InitializeComponent(); } public ObservableCollection<Platform> Platforms { get { return m_platforms; } set { m_platforms = value; } } } Here's the Platform class: public class Platform { private string m_name; private bool m_selected; public Platform(string name) { m_name = name; m_selected = false; } public string Name { get { return m_name; } set { m_name = value; } } public bool Selected { get { return m_selected; } set { m_selected = value; } } } This all compiles and runs fine but the list box displays with nothing in it. If I put a breakpoint on the get method of Platforms, it doesn't get called. I don't understand as Platforms is what the XAML should be connecting to!

    Read the article

  • How to create a proxy server?

    - by Rakesh Juyal
    I want to create a proxy server. I googled it and even found some tutorial but those were in PHP. If somebody is having tutorial of proxy server creation in java then please post it here Or simply let me know what approach should i follow to create a proxy server. [ i will be using Tomcat { if that matters for your answer } ] Thanks

    Read the article

  • How to correctly do SQL UPDATE with weighted subselect?

    - by luminarious
    I am probably trying to accomplish too much in a single query, but have I an sqlite database with badly formatted recipes. This returns a sorted list of recipes with relevance added: SELECT *, sum(relevance) FROM ( SELECT *,1 AS relevance FROM recipes WHERE ingredients LIKE '%milk%' UNION ALL SELECT *,1 AS relevance FROM recipes WHERE ingredients LIKE '%flour%' UNION ALL SELECT *,1 AS relevance FROM recipes WHERE ingredients LIKE '%sugar%' ) results GROUP BY recipeID ORDER BY sum(relevance) DESC; But I'm now stuck with a special case where I need to write the relevance value to a field on the same row as the recipe. I figured something along these lines: UPDATE recipes SET relevance=(SELECT sum(relevance) ...) But I have not been able to get this working yet. I will keep trying, but meanwhile please let me know how you would approach this?

    Read the article

  • Gtk: How can I get a part of a file in a textview with scrollbars relating to the full file

    - by badgerman1
    I'm trying to make a very large file editor (where the editor only stores a part of the buffer in memory at a time), but I'm stuck while building my textview object. Basically- I know that I have to be able to update the text view buffer dynamically, and I don't know hot to get the scrollbars to relate to the full file while the textview contains only a small buffer of the file. I've played with Gtk.Adjustment on a Gtk.ScrolledWindow and ScrollBars, but though I can extend the range of the scrollbars, they still apply to the range of the buffer and not the filesize (which I try to set via Gtk.Adjustment parameters) when I load into textview. I need to have a widget that "knows" that it is looking at a part of a file, and can load/unload buffers as necessary to view different parts of the file. So far, I believe I'll respond to the "change_view" to calculate when I'm off, or about to be off the current buffer and need to load the next, but I don't know how to get the scrollbars to have the top relate to the beginning of the file, and the bottom relate to the end of the file, rather than to the loaded buffer in textview. Any help would be greatly appreciated, thanks!

    Read the article

  • Building proper link with spaces

    - by Joel
    Hello, I have the following code in Python: linkHTML = "<a href=\"page?q=%s\">click here</a>" % strLink The problem is that when strLink has spaces in it the link shows up as <a href="page?q=with space">click here</a> I can use strLink.replace(" ","+") But I am sure there are other characters which can cause errors. I tried using urllib.quote(strLink) But it doesn't seem to help. Thanks! Joel

    Read the article

  • Android ListView with SQLite

    - by soclose
    Hi I'd like to refresh the Listview items. These items are populated from SQLite database. My code is below public class Weeve extends Activity { private String[] lv_arr; protected ListView CView; private DBAdapter mDbHelper; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mDbHelper = new DBAdapter(this); mDbHelper.open(); Cursor c = mDbHelper.getAll(); if (c.getCount() > 0) {if (c.moveToFirst()) { ArrayList strings = new ArrayList(); do { String mC = c.getString(0); strings.add(mC); } while (c.moveToNext()); lv_arr = (String[]) strings.toArray(new String[strings.size()]); } } else Toast.makeText(this, "No more Records", Toast.LENGTH_SHORT).show(); c.close(); ListView CView = new ListView(this); CView.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, lv_arr)); setContentView(CView);}} I'd like to make refreshing this list view after adding, updating or deleting SQLite table. These operations are called by content or option menu. I tried to create these code into a separated function and call it after every operation. But can't. I think setContentView(CView) statement. I also tried to use SimpleCursorAdapter like notepad sample from Android.com. I got Thread error. Help me.

    Read the article

  • how you usually quiting/closing vimdiff mode?

    - by wik
    Hello, I am using vim with fugitive extension http://www.vim.org/scripts/script.php?script_id=2975 It has :Gdiff command which brings you into vimdiff mode, but what is the right/quick way to close/quit vimdiff mode? i.e. let's say I am editing file FooBar.txt under git repository, then firing up :Gdiff, review my changes in vimdiff and want to get back and continue editing FooBar.txt or any other file :) Thanks.

    Read the article

  • How to run specific program with root privileges (Ubuntu OS) when no sudo user log into system?

    - by makulia
    How to run specific program with root privileges (Ubuntu OS) when no sudo user log into system? Program need root privileges to function correctly. Normal user shouldn't be able to shutdown this process. For example, I have to users. Admin and Client. Program should start only when Client log into system. It needs root privileges and Client shouldn't be able to shut this process down.

    Read the article

  • Python's asyncore to periodically send data using a variable timeout. Is there a better way?

    - by Nick Sonneveld
    I wanted to write a server that a client could connect to and receive periodic updates without having to poll. The problem I have experienced with asyncore is that if you do not return true when dispatcher.writable() is called, you have to wait until after the asyncore.loop has timed out (default is 30s). The two ways I have tried to work around this is 1) reduce timeout to a low value or 2) query connections for when they will next update and generate an adequate timeout value. However if you refer to 'Select Law' in 'man 2 select_tut', it states, "You should always try to use select() without a timeout." Is there a better way to do this? Twisted maybe? I wanted to try and avoid extra threads. I'll include the variable timeout example here: #!/usr/bin/python import time import socket import asyncore # in seconds UPDATE_PERIOD = 4.0 class Channel(asyncore.dispatcher): def __init__(self, sock, sck_map): asyncore.dispatcher.__init__(self, sock=sock, map=sck_map) self.last_update = 0.0 # should update immediately self.send_buf = '' self.recv_buf = '' def writable(self): return len(self.send_buf) > 0 def handle_write(self): nbytes = self.send(self.send_buf) self.send_buf = self.send_buf[nbytes:] def handle_read(self): print 'read' print 'recv:', self.recv(4096) def handle_close(self): print 'close' self.close() # added for variable timeout def update(self): if time.time() >= self.next_update(): self.send_buf += 'hello %f\n'%(time.time()) self.last_update = time.time() def next_update(self): return self.last_update + UPDATE_PERIOD class Server(asyncore.dispatcher): def __init__(self, port, sck_map): asyncore.dispatcher.__init__(self, map=sck_map) self.port = port self.sck_map = sck_map self.create_socket(socket.AF_INET, socket.SOCK_STREAM) self.bind( ("", port)) self.listen(16) print "listening on port", self.port def handle_accept(self): (conn, addr) = self.accept() Channel(sock=conn, sck_map=self.sck_map) # added for variable timeout def update(self): pass def next_update(self): return None sck_map = {} server = Server(9090, sck_map) while True: next_update = time.time() + 30.0 for c in sck_map.values(): c.update() # <-- fill write buffers n = c.next_update() #print 'n:',n if n is not None: next_update = min(next_update, n) _timeout = max(0.1, next_update - time.time()) asyncore.loop(timeout=_timeout, count=1, map=sck_map)

    Read the article

  • Java Socket Programming

    - by Bapi
    Java Socket Program did not work for WAN I have written a TCP IP socket program which works fine in my LAN. One of my friend is at bangalore He ran the server and I ran the client with the host name of my friend's IP. In this case my socket program did not work.

    Read the article

  • How to access the first value from an object in C#3.0

    - by Newbie
    How can I access the first value from object t = (object) wsf.LinEst(y.ToArray(), x.ToArray(), false, true); The output is object[1..5, 1..2]} [1, 1]: 0.17134831460674155 [1, 2]: 0.0 [2, 1]: 0.019612696690686725 [2, 2]: -2146826246 [3, 1]: 0.95020429009193053 [3, 2]: 0.82746057986828336 [4, 1]: 76.328205128205056 [4, 2]: 4.0 [5, 1]: 52.261235955056179 [5, 2]: 2.7387640449438226 I need to get only [1,1] 's value i.e. 0.17134831460674155 How to get that. The linEst return an object only. I am using C#3.0 Thanks Thanks

    Read the article

  • Send multidimensional array to php with jQuery

    - by robertdd
    hy, i have a little, big problem here :) after i upload some images i get a list with all the images. I have some jQuery function for rotate, duplicate, delete, shuffle images! when i select a image and hit delete i send a post to php with the alt="" value of the image,i identify the picture and edit. I want to make a save button, Instead of sending a post every time i rotate a image, better send a post after editing the list of images with an array that contains all data? my php array after upload looks like this: [files] => Array ( [lcxkijgr] => lcxkijgr.jpg [xcewxpfv] => xcewxpfv.jpg [rtiurwxf] => rtiurwxf.jpg [gsbxdsdc] => gsbxdsdc.jpg ) say that I uploaded 4 pictures, firs picture i rotate 90 degrees second i want to duplicate third i rotate 270 degrees and the fourth image i delete i can do all this only with jQuery, but on the server the images are the same, after a refresh the images are the same this is the list with the images: <div class="upimage"> <ul id="upimagesQueue"> <li id="upimagesHPVEJM"> <a href="javascript:jQuery('#upimagesHPVEJM').showlargeimage('HPVEJM')"> <img alt="lcxkijgr" src="uploads/s6id9r9icnp8q9102h8md9kfd7/lcxkijgr.jpg?1272087830477" id="HPVEJM" style="display: block;" > </a> </li> <li id="upimagesSTCSAV"> <a href="javascript:jQuery('#upimagesSTCSAV').showlargeimage('STCSAV')"> <img alt="xcewxpfv" src="uploads/s6id9r9icnp8q9102h8md9kfd7/xcewxpfv.jpg?1272087831360" id="STCSAV" style="display: block;" > </a> </li> <li id="upimagesBFPUEQ"> <a href="javascript:jQuery('#upimagesBFPUEQ').showlargeimage('BFPUEQ')"> <img alt="rtiurwxf" src="uploads/s6id9r9icnp8q9102h8md9kfd7/rtiurwxf.jpg?1272087832162" id="BFPUEQ" style="display: block;" > </a> </li> <li id="upimagesRKXNSV"> <a href="javascript:jQuery('#upimagesRKXNSV').showlargeimage('RKXNSV')"> <img alt="gsbxdsdc" src="uploads/s6id9r9icnp8q9102h8md9kfd7/gsbxdsdc.jpg?1272087832957" id="RKXNSV" style="display: block;"> </a> </li> <ul> </div> is ok if i make one array like this: array{ imgFromLi = array(img1,img2,img3,img4,img5,img6) rotate = array{img1=90, img2=270, img3=90} delete = array{img4,img5,img6} duplicate = array{img2, img3} } how i can make/send/cache this array?? sorry for my very bad english

    Read the article

< Previous Page | 17 18 19 20 21 22 23 24 25 26 27 28  | Next Page >