Search Results

Search found 410 results on 17 pages for 'joseph sg'.

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

  • VSS Linked file's original location.

    - by Biju Joseph N
    A common file may be used in one more projects and such files will be shown as a linked file in VSS database. Actually such files are kept at a unique location within the database. Is there a way to get the original storage location of a linked file ?

    Read the article

  • How can I use functools.partial on multiple methods on an object, and freeze parameters out of order

    - by Joseph Garvin
    I find functools.partial to be extremely useful, but I would like to be able to freeze arguments out of order (the argument you want to freeze is not always the first one) and I'd like to be able to apply it to several methods on a class at once, to make a proxy object that has the same methods as the underlying object except with some of its methods parameter being frozen (think of it as generalizing partial to apply to classes). I've managed to scrap together a version of functools.partial called 'bind' that lets me specify parameters out of order by passing them by keyword argument. That part works: >>> def foo(x, y): ... print x, y ... >>> bar = bind(foo, y=3) >>> bar(2) 2 3 But my proxy class does not work, and I'm not sure why: >>> class Foo(object): ... def bar(self, x, y): ... print x, y ... >>> a = Foo() >>> b = PureProxy(a, bar=bind(Foo.bar, y=3)) >>> b.bar(2) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: bar() takes exactly 3 arguments (2 given) I'm probably doing this all sorts of wrong because I'm just going by what I've pieced together from random documentation, blogs, and running dir() on all the pieces. Suggestions both on how to make this work and better ways to implement it would be appreciated ;) One detail I'm unsure about is how this should all interact with descriptors. Code follows. from types import MethodType class PureProxy(object): def __init__(self, underlying, **substitutions): self.underlying = underlying for name in substitutions: subst_attr = substitutions[name] if hasattr(subst_attr, "underlying"): setattr(self, name, MethodType(subst_attr, self, PureProxy)) def __getattribute__(self, name): return getattr(object.__getattribute__(self, "underlying"), name) def bind(f, *args, **kwargs): """ Lets you freeze arguments of a function be certain values. Unlike functools.partial, you can freeze arguments by name, which has the bonus of letting you freeze them out of order. args will be treated just like partial, but kwargs will properly take into account if you are specifying a regular argument by name. """ argspec = inspect.getargspec(f) argdict = copy(kwargs) if hasattr(f, "im_func"): f = f.im_func args_idx = 0 for arg in argspec.args: if args_idx >= len(args): break argdict[arg] = args[args_idx] args_idx += 1 num_plugged = args_idx def new_func(*inner_args, **inner_kwargs): args_idx = 0 for arg in argspec.args[num_plugged:]: if arg in argdict: continue if args_idx >= len(inner_args): # We can't raise an error here because some remaining arguments # may have been passed in by keyword. break argdict[arg] = inner_args[args_idx] args_idx += 1 f(**dict(argdict, **inner_kwargs)) new_func.underlying = f return new_func

    Read the article

  • Active C++ project to contribute to

    - by Joseph Pond
    I am a self-taught c++/java programmer (I will be starting uni in August though!). I have worked on one project in which I was part of an active team. I really felt I learnt the most and gained a lot of experience while working with the team. Unfortunately it was a small closed source project which has recently taken a slumber. I'm looking for some active open source c++ projects which I could contribute to (preferably that are mainly developed on the linux platform). The other project I worked on was a video game, however, I would like to contribute to a project which has a functional purpose (other than to amuse). Any suggestions on possible projects?

    Read the article

  • How to check for DOM equality with jQuery?

    - by Joseph
    I'm basically building a simple list, and one of the items in the list is selected. I'm accomplishing this by having a "selected" class applied to whichever item I want to have selected. I have two buttons that go forward and backward which traverse this list. However, when the user gets to the first or the last element in the list, I want to do a post back. This is where I'm stuck, because I'm having trouble identifying that the currently selected item is not the first or the last. Simple Example: <div id="list"> <p>item 1</p> <p>item 2</p> <p class="selected">item 3</p> </div> Let's say the user presses the next button, at this point I'm checking for something similar to this: if (jQuery('#list p.selected') == jQuery('#list p:last-child')) //do post back However, this logic is returning false, which leads me to believe I'm approaching this the wrong way. What is the best way for me to check for this kind of logic using jQuery?

    Read the article

  • how to create an excel file in google app engine (java)?

    - by Joseph
    A question that seems to have quite a few options for Python, but none for Java after googling for two days. Really really could use some help all I have found so far is a recommendation to use gaeVFS to build an excel file from the xml components and then zip it all together which sounds like a slap in the face. Oh yes and if you were wondering I am questioning my use of Java rather than python but at 5,000 lines of code it would be insane to turn back now... Other things you might find useful Client: GWT Server: Servlets running on google app engine storing data into the google data store Excel file: mandatory, CSV isn't good enough, no need to save the file just to be able to "serve" it to the client i.e. open a "Save As" box.

    Read the article

  • wp_redirect acting weird. requires die() afterward?

    - by Joseph Carrington
    I am writing a wordpress plugin that redirects the user. for some reason, wp_redirect does not work as think it should, namely: it seems not to redirect the user at all, unless I put a die command in directly after. here is some code: switch($_GET['wp_favorites_tax']) { case 'post_tag': wp_redirect(add_query_arg('tag', $_GET['wp_favorites_term'], get_bloginfo('url'))); die(); break; case 'category': wp_redirect(add_query_arg('cat', $_GET['wp_favorites_term'], get_bloginfo('url'))); die(); break; default: wp_redirect(get_bloginfo('url')); die(); } It seems really strange to me that I should have to tell my script to die so that the redirect can work. I have also tried a basic header("Location: $location); to similar ends, ie: it still requires the die() in order to work. really perplexing me. Thanks.

    Read the article

  • Magento: How do I retrieve values from fields submitted with the payment method?

    - by Joseph
    Ok. This is getting a little frustrating. I am trying to create a custom payment module for Magento. The purpose is to use Authorize.net's CIM so that we don't have to worry so much about PCI compliance. The issue I am having is that the users need to be able to access their previous credit cards and use those for purchasing. I have the previous cards being stored in the database. They are also being displayed in the form in the checkout process. My issue comes when I click continue after selecting the payment method. How do I get the values I submitted in the form? Specifically, the value of the radio button the saved code is attached to? I am not sure what if any code is needed for me to post, so let me know if you need anything in particular. Thanks.

    Read the article

  • How do I Send Email from the Command Line?

    - by Joseph Pecoraro
    I would like to quickly send email from the command line. I realize there are probably a number of different ways to do this. I'm looking for a simple way to do this from a linux terminal (likely a bash shell but anything should do) and an alternative way to do this on Windows. I want to be able to whip up an email right on the command line or have the flexibility to pipe the message into the command line program. How would you go about doing this? If you have small scripts that would be fine as well. Thanks in advance.

    Read the article

  • Correctly parsing an ATOM feed

    - by Joseph
    I currently have setup a Python script that uses feedparser to read a feed and parse it. However, I have recently come across a problem with the date parsing. The feed I am reading contains <modified>2010-05-05T24:17:54Z</modified> - which comes up in Python as a datetime object - 2010-05-06 00:17:54. Notice the discrepancy: the feed entry was modified on the 5th of may, while python reads it as the 6th. So the question is why this is happening. Is the ATOM feed (that is, the one who created the feed) wrong by putting the time as 24:17:54, or is my python script wrong in the way it treats it. And can I solve this?

    Read the article

  • Using NHibernate to insert/update using a SQL server-side DEFAULT value

    - by Joseph Daigle
    Several of our database tables contain LastModifiedDate columns. We would like these to stay synchronized based on a single time-source. Our best time-source, in this case, is the SQL Server itself since there is only one database server but multiple application servers which could potentially be off sync. I would like to be able to use NHibernate, but have it use either GETUTCDATE() or DEFAULT for the column value when updating or inserting rows on these tables. Thoughts?

    Read the article

  • ResultSet in JTable

    - by Merin Treesa Joseph
    Sir, How display ResultSet in JTable. i using this code /*String [] record= new String[ColCount]; for (i=0; i } cell[i] = rset1.getString("loginname"); cell[i] = rset1.getString( "role"); System.out.println(cell[i][0]); //ItemGroup = rset1.getString( "Status"); } System.out.println(ItemCode); JTable jt = new JTable( cell[i], headers);*/ but i get only one row that lastly inserted to database.

    Read the article

  • Should I unit test my JavaScript?

    - by Joseph Silvashy
    I'm curious to if it would be valuable, I'd like to start using QUnit, but I really don't know where to get started. Actually I'm not going to lie, I'm new to testing in general, not just with JS. I'm hoping to get some tips to how I would start using unit testing with an app that already has a large amount of JavaScript (ok so about 500 lines, not huge, be enough to make me wonder if I have regression that goes unnoticed). How would you recommend getting started and Where would I write my tests? (for example its rails app, where is a logical place to have my JS tests, it would be cool if they could go in the /test directory but it's outside the public directory and thus not possible... err is it?)

    Read the article

  • Is it possible to store pointers in shared memory without using offsets?

    - by Joseph Garvin
    When using shared memory, each process may mmap the shared region into a different area of their address space. This means that when storing pointers within the shared region, you need to store them as offsets of the start of the shared region. Unfortunately, this complicates use of atomic instructions (e.g. if you're trying to write a lock free algorithm). For example, say you have a bunch of reference counted nodes in shared memory, created by a single writer. The writer periodically atomically updates a pointer 'p' to point to a valid node with positive reference count. Readers want to atomically write to 'p' because it points to the beginning of a node (a struct) whose first element is a reference count. Since p always points to a valid node, incrementing the ref count is safe, and makes it safe to dereference 'p' and access other members. However, this all only works when everything is in the same address space. If the nodes and the 'p' pointer are stored in shared memory, then clients suffer a race condition: x = read p y = x + offset Increment refcount at y During step 2, p may change and x may no longer point to a valid node. The only workaround I can think of is somehow forcing all processes to agree on where to map the shared memory, so that real pointers rather than offsets can be stored in the mmap'd region. Is there any way to do that? I see MAP_FIXED in the mmap documentation, but I don't know how I could pick an address that would be safe.

    Read the article

  • Is it normal for C++ static initialization to appear twice in the same backtrace?

    - by Joseph Garvin
    I'm trying to debug a C++ program compiled with GCC that freezes at startup. GCC mutex protects function's static local variables, and it appears that waiting to acquire such a lock is why it freezes. How this happens is rather confusing. First module A's static initialization occurs (there are __static_init functions GCC invokes that are visible in the backtrace), which calls a function Foo(), that has a static local variable. The static local variable is an object who's constructor calls through several layers of functions, then suddenly the backtrace has a few ??'s, and then it's is in the static initialization of a second module B (the __static functions occur all over again), which then calls Foo(), but since Foo() never returned the first time the mutex on the local static variable is still set, and it locks. How can one static init trigger another? My first theory was shared libraries -- that module A would be calling some function in module B that would cause module B to load, thus triggering B's static init, but that doesn't appear to be the case. Module A doesn't use module B at all. So I have a second (and horrifying) guess. Say that: Module A uses some templated function or a function in a templated class, e.g. foo<int>::bar() Module B also uses foo<int>::bar() Module A doesn't depend on module B at all At link time, the linker has two instances of foo<int>::bar(), but this is OK because template functions are marked as weak symbols... At runtime, module A calls foo<int>::bar, and the static init of module B is triggered, even though module B doesn't depend on module A! Why? Because the linker decided to go with module B's instance of foo::bar instead of module A's instance at link time. Is this particular scenario valid? Or should one module's static init never trigger static init in another module?

    Read the article

  • "Cannot find symbol" problem.

    - by joseph
    I'm getting the Cannot find symbol error from my code. Does anyone know what can cause this problem? // Register JDBC driver Class.forName("net.sourceforge.jtds.jdbc.Driver"); method forName(java.Lang.String) Class.forName("net.sourceforge.jtds.jdbc.Driver); ^

    Read the article

  • Maze not generating properly. Out of bounds exception. need quick fix

    - by Dan Joseph Porcioncula
    My maze generator seems to have a problem. I am trying to generate something like the maze from http://mazeworks.com/mazegen/mazetut/index.htm . My program displays this http://a1.sphotos.ak.fbcdn.net/hphotos-ak-snc7/s320x320/374060_426350204045347_100000111130260_1880768_1572427285_n.jpg and the error Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -1 at Grid.genRand(Grid.java:73) at Grid.main(Grid.java:35) How do I fix my generator program? import java.awt.*; import java.awt.Color; import java.awt.Component; import java.awt.Graphics; import javax.swing.*; import java.util.ArrayList; public class Grid extends Canvas { Cell[][] maze; int size; int pathSize; double width, height; ArrayList<int[]> coordinates = new ArrayList<int[]>(); public Grid(int size, int h, int w) { this.size = size; maze = new Cell[size][size]; for(int i = 0; i<size; i++){ for(int a =0; a<size; a++){ maze[i][a] = new Cell(); } } setPreferredSize(new Dimension(h, w)); } public static void main(String[] args) { JFrame y = new JFrame(); y.setLayout(new BorderLayout()); Grid f = new Grid(25, 400, 400); y.add(f, BorderLayout.CENTER); y.setSize(450, 450); y.setVisible(true); y.setDefaultCloseOperation(y.EXIT_ON_CLOSE); f.genRand(); f.repaint(); } public void push(int[] xy) { coordinates.add(xy); int i = coordinates.size(); coordinates.ensureCapacity(i++); } public int[] pop() { int[] x = coordinates.get((coordinates.size())-1); coordinates.remove((coordinates.size())-1); return x; } public int[] top() { return coordinates.get((coordinates.size())-1); } public void genRand(){ // create a CellStack (LIFO) to hold a list of cell locations [x] // set TotalCells = number of cells in grid int TotalCells = size*size; // choose a cell at random and call it CurrentCell int m = randomInt(size); int n = randomInt(size); Cell curCel = maze[m][n]; // set VisitedCells = 1 int visCel = 1,d=0; int[] q; int h,o = 0,p = 0; // while VisitedCells < TotalCells while( visCel < TotalCells){ // find all neighbors of CurrentCell with all walls intact if(maze[m-1][n].countWalls() == 4){d++;} if(maze[m+1][n].countWalls() == 4){d++;} if(maze[m][n-1].countWalls() == 4){d++;} if(maze[m][n+1].countWalls() == 4){d++;} // if one or more found if(d!=0){ Point[] ls = new Point[4]; ls[0] = new Point(m-1,n); ls[1] = new Point(m+1,n); ls[2] = new Point(m,n-1); ls[3] = new Point(m,n+1); // knock down the wall between it and CurrentCell h = randomInt(3); switch(h){ case 0: o = (int)(ls[0].getX()); p = (int)(ls[0].getY()); curCel.destroyWall(2); maze[o][p].destroyWall(1); break; case 1: o = (int)(ls[1].getX()); p = (int)(ls[1].getY()); curCel.destroyWall(1); maze[o][p].destroyWall(2); break; case 2: o = (int)(ls[2].getX()); p = (int)(ls[2].getY()); curCel.destroyWall(3); maze[o][p].destroyWall(0); break; case 3: o = (int)(ls[3].getX()); p = (int)(ls[3].getY()); curCel.destroyWall(0); maze[o][p].destroyWall(3); break; } // push CurrentCell location on the CellStack push(new int[] {m,n}); // make the new cell CurrentCell m = o; n = p; curCel = maze[m][n]; // add 1 to VisitedCells visCel++; } // else else{ // pop the most recent cell entry off the CellStack q = pop(); m = q[0]; n = q[1]; curCel = maze[m][n]; // make it CurrentCell // endIf } // endWhile } } public int randomInt(int s) { return (int)(s* Math.random());} public void paint(Graphics g) { int k, j; width = getSize().width; height = getSize().height; double htOfRow = height / (size); double wdOfRow = width / (size); //checks verticals - destroys east border of cell for (k = 0; k < size; k++) { for (j = 0; j < size; j++) { if(maze[k][j].checkWall(2)){ g.drawLine((int) (k * wdOfRow), (int) (j * htOfRow), (int) (k * wdOfRow), (int) ((j+1) * htOfRow)); }} } //checks horizontal - destroys north border of cell for (k = 0; k < size; k++) { for (j = 0; j < size; j++) { if(maze[k][j].checkWall(3)){ g.drawLine((int) (k * wdOfRow), (int) (j * htOfRow), (int) ((k+1) * wdOfRow), (int) (j * htOfRow)); }} } } } class Cell { private final static int NORTH = 0; private final static int EAST = 1; private final static int WEST = 2; private final static int SOUTH = 3; private final static int NO = 4; private final static int START = 1; private final static int END = 2; boolean[] wall = new boolean[4]; boolean[] border = new boolean[4]; boolean[] backtrack = new boolean[4]; boolean[] solution = new boolean[4]; private boolean isVisited = false; private int Key = 0; public Cell(){ for(int i=0;i<4;i++){wall[i] = true;} } public int countWalls(){ int i, k =0; for(i=0; i<4; i++) { if (wall[i] == true) {k++;} } return k;} public boolean checkWall(int x){ switch(x){ case 0: return wall[0]; case 1: return wall[1]; case 2: return wall[2]; case 3: return wall[3]; } return true; } public void destroyWall(int x){ switch(x){ case 0: wall[0] = false; break; case 1: wall[1] = false; break; case 2: wall[2] = false; break; case 3: wall[3] = false; break; } } public void setStart(int i){Key = i;} public int getKey(){return Key;} public boolean checkVisit(){return isVisited;} public void visitCell(){isVisited = true;} }

    Read the article

  • Nginx syntax problem '~*'

    - by Joseph Silvashy
    I have at condition checking to see if user has a cookie like this: if ($http_cookie ~* "developer=true" ) { ... } I'm not familiar with the ~* syntax, I assume that that means if it 'contains', but what about the opposite? like what if I wanted to check if $http_cookie doesn't contain that cookie?

    Read the article

  • for cycle not works allright

    - by joseph
    Hello. I call addNotify() method in class that I posted here. The problem is, that when I call addNotify() as it is in the code, setKeys(objs) do nothing. Nothing appears in my explorer of running app. But when I call addNotify()without loop(for int....), and add only one item to ArrayList, it shows that one item correctly. Does anybody knows where can be problem? See the cede class ProjectsNode extends Children.Keys{ private ArrayList objs = new ArrayList(); public ProjectsNode() { } @Override protected Node[] createNodes(Object o) { MainProject obj = (MainProject) o; AbstractNode result = new AbstractNode (new DiagramsNode(), Lookups.singleton(obj)); result.setDisplayName (obj.getName()); return new Node[] { result }; } @Override protected void addNotify() { //this loop causes nothing appears in my explorer. //but when I replace this loop by single line "objs.add(new MainProject("project1000"));", it shows that one item in explorer for (int i=0;i==10;i++){ objs.add(new MainProject("project1000")); } setKeys (objs); } }

    Read the article

  • Why would I want to use server-side JavaScript?

    - by Joseph Silvashy
    I'm confused, I regularly read talk of server-side JS, why would I want to use that? It seems like it would execute way slower than pretty much any other language, it also lacks many conventions that more sophisticated languages have. Is it possible to hand entire objects from the client to the server, manipulate them and return them back? Just struggling to understand the concepts of it.

    Read the article

  • is it possible to display video information from an rtsp stream in an android app UI

    - by Joseph Cheung
    I have managed to get a working video player that can stream rtsp links, however im not sure how to display the videos current time position in the UI, i have used the getDuration and getCurrentPosition calls, stored this information in a string and tried to display it in the UI but it doesnt seem to work in main.xml: TextView android:id="@+id/player" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="1px" android:text="@string/cpos" / in strings.xml: string name="cpos""" /string in Player.java private void playVideo(String url) { try { media.setEnabled(false); if (player == null) { player = new MediaPlayer(); player.setScreenOnWhilePlaying(true); } else { player.stop(); player.reset(); } player.setDataSource(url); player.getCurrentPosition(); player.setDisplay(holder); player.setAudioStreamType(AudioManager.STREAM_MUSIC); player.setOnPreparedListener(this); player.prepareAsync(); player.setOnBufferingUpdateListener(this); player.setOnCompletionListener(this); } catch (Throwable t) { Log.e(TAG, "Exception in media prep", t); goBlooey(t); try { try { player.prepare(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } Log.v(TAG, "Duration: === " + player.getDuration()); } catch (IllegalStateException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } private Runnable onEverySecond = new Runnable() { public void run() { if (lastActionTime 0 && SystemClock.elapsedRealtime() - lastActionTime 3000) { clearPanels(false); } if (player != null) { timeline.setProgress(player.getCurrentPosition()); //stores getCurrentPosition as a string cpos = String.valueOf(player.getCurrentPosition()); System.out.print(cpos); } if (player != null) { timeline.setProgress(player.getDuration()); //stores getDuration as a string cdur = String.valueOf(player.getDuration()); System.out.print(cdur); } if (!isPaused) { surface.postDelayed(onEverySecond, 1000); } } };

    Read the article

  • Required help to Increase the performance of the MySQL query

    - by Joseph
    Hi all, I am using a following query in MySQl for fetching data from a table. Its taking too long because the conditional check within the aggregate function.Please help how to make it faster SELECT testcharfield ,SUM(IF (Type = 'pi',quantity, 0)) AS OB ,SUM(IF (Type = 'pe',quantity, 0)) AS CB FROM Table1 WHERE sequenceID = 6107 GROUP BY testcharfield

    Read the article

  • Cocoa/MacRuby: How to write a toolbar which accepts custom items?

    - by Joseph Melettukunnel
    I'm doing my first steps in MacRuby. Does anyone know how I can add a custom Toolbar to my Cocoa/MacRuby application, which will accept "regular" items for e.g. switching the view (see http://www.stevestreeting.com/wp-content/uploads/2011/06/SelectableToolbarDemo001.png). I've read some tutorials and I guess I have to create a custom delegate for the Toolbar and then connect it via the Outlets window, but how does the myCustomDelegate.rb have to look like? Thanks a lot! Cheers

    Read the article

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