Search Results

Search found 936 results on 38 pages for 'erik van gorp'.

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

  • How to keep a shell open across multiple ajax requests in PHP?

    - by Joost van Doorn
    I need to use a shell across multiple ajax requests. Basically this means that the next request should be able to continue with the same shell where the other process left off. The purpose is to communicate with daemons like FTP to open an FTP connection and log in and in the next request continue with that connection and be able to use it for uploads. But it's not limited to only the FTP daemon (as I know that FTP is supported in PHP).

    Read the article

  • Is it possible to use HTTPS certificates for licensing?

    - by Ton van den Heuvel
    I am working on an application with multiple clients and a server running various web-services for the clients. To implement licensing I am thinking about using HTTPS as a protocol for the web-services using certificates that are issued by our company. By influencing the expiration date of a certificate for a client we can prevent them from using our software after their license term. It this possible and does it make sense to you? Additional information: I am planning on using Qt/C++ for the clients, and the Twisted framework for the web-services.

    Read the article

  • Why wont my while loop take new input (c++)

    - by Van
    I've written a program to get a string input from a user and parse it into tokens and move a robot according to the input. My problem is trying to issue more than one command. The code looks like: void Navigator::manualDrive() { const int bufSize = 42; char uinput[bufSize]; char delim[] = " "; char *token; while(true) { Navigator::parseInstruction(uinput); } } /* parseInstruction(char *c) -- parses cstring instructions received * and moves robot accordingly */ void Navigator::parseInstruction(char * c) { const int bufSize = 42; char uinput[bufSize]; char delim[] = " "; char *token; cout << "Enter your directions below: \n"; cin.ignore(); cin.getline (uinput, bufSize); token=strtok(uinput, delim); if(strcmp("forward", token) == 0) { int inches; token = strtok(NULL, delim); inches = atoi (token); Navigator::travel(inches); } if(strcmp("back",token) == 0) { int inches; token = strtok(NULL, delim); inches = atoi (token); double value = fabs(0.0735 * fabs(inches) - 0.0550); myRobot.backward(1/*speed*/, value/*time*/); } if(strcmp("turn",token) == 0) { int degrees; token = strtok(NULL, delim); if(strcmp("left",token) == 0) { token = strtok(uinput, delim); degrees = atoi (token); double value = fabs(0.0041 * degrees - 0.0523); myRobot.turnLeft(1/*speed*/, value/*time*/); } } if(strcmp("turn",token) == 0) { int degrees; token = strtok(NULL, delim); if(strcmp("right",token) == 0) { token = strtok(uinput, delim); degrees = atoi (token); double value = fabs(0.0041 * degrees - 0.0523); myRobot.turnRight(1/*speed*/, value/*time*/); } } if(strcmp("stop",token) == 0) { myRobot.motors(0,0); } } In the function manualDrive I have a while loop calling the function parseInstruction infinitely. The program outputs "Enter your directions below: " When I give the program instructions it executes them, and then it outputs "enter your directions below: " again and when I input my directions again it does not execute them and outputs "Enter your directions below: " instead. I'm sure this is a very simple fix I'm just very new to c++. So if you could please help me out and tell me why the program only takes the first set of directions. thanks

    Read the article

  • How can I get the main thread to sleep while waiting for a delgate to be called?

    - by Erik B
    Consider a class with these methods: - (id) initWithFrame: (CGRect) frame { if (!(self = [super init])) return nil; webView = [[UIWebView alloc] initWithFrame:frame]; [webView setDelegate:self]; lock = [[NSConditionLock alloc] initWithCondition:LOCK_WAIT]; return self; } - (void) setHTML: (NSString *) html { [lock lockWhenCondition:LOCK_WAIT]; [webView loadHTMLString:html baseURL:nil]; [lock unlock]; } - (void)webViewDidFinishLoad:(UIWebView *)aWebView { [lock lockWhenCondition:LOCK_WAIT]; // Locking to be able to unlock and change the condition. [lock unlockWithCondition:LOCK_GO]; } - (NSString *) stringByEvaluatingJavaScriptFromString: (NSString *) jsCommand { [lock lockWhenCondition:LOCK_GO]; return [webView stringByEvaluatingJavaScriptFromString:jsCommand]; [lock unlock]; } Let's call this class SynchronousUIWebView. From the main thread I execute: webView = [[SynchronousUIWebView alloc] initWithFrame:frame]; [webView setHTML:html]; [webView stringByEvaluatingJavaScriptFromString:jsCommand]; The problem seems to be that the delegate is not called until I leave the current call stack, which I don't since I'm waiting for the delegate call to happen, aka deadlock. To me it seems like the delegate call is pushed to a queue that is called when the current call is done. So the question is can I modify this behavior? Note: The reason this is needed is that I can't execute the JavaScript until the HTML has loaded.

    Read the article

  • tricky SQL when joining

    - by Erik
    I've two tables, shows and objects. I want to print out the latest objects, and the shownames for them. Right now I'm doing it this way: SELECT MAX(objects.id) as max_id, shows.name, shows.id FROM shows, objects WHERE shows.id = objects.showId GROUP BY shows.name however, if I also want to fetch the episode of the object I can't put it like SELECT object.episode [...], because then wont automatically select the object which is MAX(objects.id), so my question is how to do that? If you haven't already figured out my tables they're like this: Shows id name and also: Objects id name episode season showId Using MySQL. Thanks!

    Read the article

  • Java: thread-safe RandomAccessFile

    - by Folkert van Heusden
    Hi, After some serious googleing I found out that the RandomAccessFile-class is not thread-safe. Now I could use one semaphore to lock all reads and writes but I don't think that performs very well. In theory it should be possible to do multiple reads and one write at a time. How can I do this in Java? Is it possible at all? Thanks!

    Read the article

  • How do I place a unique ID in my PHP confirmation page?

    - by Erik
    I have a PHP script that emails me the results from a form that generates a unique ID number. The PHP script executes a confirmation page. I'm trying to place the unique ID on the confirmation page: quote_confirm.php. I already tried this in the conformation page: <?php $prefix = 'LPFQ'; $uniqid = $prefix . uniqid(); $QuoteID = strtoupper($uniqid); ."<tr><td class=\"label\"><strong>Quote ID:</strong></td><td>".$QuoteID."</td></tr>\n"

    Read the article

  • The ultimate .NET file and directory utility library?

    - by Serge van den Oever
    I find myself writing file and directory utility functions all the time, and I was wondering if there is good file and directory library that already implements a more extensive set than available by default in System.IO. The kind of functions I'm looking for is things like: public static void GetTemporaryDirectory() { string tempDirectory = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); Directory.CreateDirectory(tempDirectory); return tempDirectory; } public static void CreateEmptyFile(string filename) { File.Create(filename).Dispose(); } public static void CreateEmptyFile(string path, string filename) { File.Create(Path.Combine(path, filename)).Dispose(); } public static void CreateDirectory(string path) { Directory.CreateDirectory(path); } public static void CreateDirectory(string path, string childpath) { Directory.CreateDirectory(Path.Combine(path, childpath)); }

    Read the article

  • Sanitizing CSS in Rails

    - by Erik
    Hello! I want to allow the users of a web app that I'm building to write their own CSS in order to customize their profile page. However I am aware of this opening up for many security risks, i e background: url('javascript:alert("Got your cookies! " + document.cookies'). Hence I am looking for a solution to sanitize the CSS while still allowing as much CSS functionality as possible for my users. So my questions if anyone anyone knows of a gem or a plugin to handles this? I've googled my brains out already so any tips would be really appreciated!

    Read the article

  • Nesting forms in CakePHP

    - by Erik
    I am wondering if there's a way in CakePHP to nest multiple models in a form? What I'm trying to accomplish is to make a form for creating Posts that will also contain fields for adding Images (separate model) that will automatically be connected to the created post. Something similar to Ruby on Rails ** accept_nested_attributes_for**.

    Read the article

  • A* algorithm works OK, but not perfectly. What's wrong?

    - by Bart van Heukelom
    This is my grid of nodes: I'm moving an object around on it using the A* pathfinding algorithm. It generally works OK, but it sometimes acts wrongly: When moving from 3 to 1, it correctly goes via 2. When going from 1 to 3 however, it goes via 4. When moving between 3 and 5, it goes via 4 in either direction instead of the shorter way via 6 What can be wrong? Here's my code (AS3): public static function getPath(from:Point, to:Point, grid:NodeGrid):PointLine { // get target node var target:NodeGridNode = grid.getClosestNodeObj(to.x, to.y); var backtrace:Map = new Map(); var openList:LinkedSet = new LinkedSet(); var closedList:LinkedSet = new LinkedSet(); // begin with first node openList.add(grid.getClosestNodeObj(from.x, from.y)); // start A* var curNode:NodeGridNode; while (openList.size != 0) { // pick a new current node if (openList.size == 1) { curNode = NodeGridNode(openList.first); } else { // find cheapest node in open list var minScore:Number = Number.MAX_VALUE; var minNext:NodeGridNode; openList.iterate(function(next:NodeGridNode, i:int):int { var score:Number = curNode.distanceTo(next) + next.distanceTo(target); if (score < minScore) { minScore = score; minNext = next; return LinkedSet.BREAK; } return 0; }); curNode = minNext; } // have not reached if (curNode == target) break; else { // move to closed openList.remove(curNode); closedList.add(curNode); // put connected nodes on open list for each (var adjNode:NodeGridNode in curNode.connects) { if (!openList.contains(adjNode) && !closedList.contains(adjNode)) { openList.add(adjNode); backtrace.put(adjNode, curNode); } } } } // make path var pathPoints:Vector.<Point> = new Vector.<Point>(); pathPoints.push(to); while(curNode != null) { pathPoints.unshift(curNode.location); curNode = backtrace.read(curNode); } pathPoints.unshift(from); return new PointLine(pathPoints); } NodeGridNode::distanceTo() public function distanceTo(o:NodeGridNode):Number { var dx:Number = location.x - o.location.x; var dy:Number = location.y - o.location.y; return Math.sqrt(dx*dx + dy*dy); }

    Read the article

  • Collections not read from hibernate/ehcache second-level-cache

    - by Mark van Venrooij
    I'm trying to cache lazy loaded collections with ehcache/hibernate in a Spring project. When I execute a session.get(Parent.class, 123) and browse through the children multiple times a query is executed every time to fetch the children. The parent is only queried the first time and then resolved from the cache. Probably I'm missing something, but I can't find the solution. Please see the relevant code below. I'm using Spring (3.2.4.RELEASE) Hibernate(4.2.1.Final) and ehcache(2.6.6) The parent class: @Entity @Table(name = "PARENT") @Cacheable @Cache(usage = CacheConcurrencyStrategy.READ_WRITE, include = "all") public class ServiceSubscriptionGroup implements Serializable { /** The Id. */ @Id @Column(name = "ID") private int id; @OneToMany(fetch = FetchType.LAZY, mappedBy = "parent") @Cache(usage = CacheConcurrencyStrategy.READ_WRITE) private List<Child> children; public List<Child> getChildren() { return children; } public void setChildren(List<Child> children) { this.children = children; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Parent that = (Parent) o; if (id != that.id) return false; return true; } @Override public int hashCode() { return id; } } The child class: @Entity @Table(name = "CHILD") @Cacheable @Cache(usage = CacheConcurrencyStrategy.READ_WRITE, include = "all") public class Child { @Id @Column(name = "ID") private int id; @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL) @JoinColumn(name = "PARENT_ID") @Cache(usage = CacheConcurrencyStrategy.READ_WRITE) private Parent parent; public int getId() { return id; } public void setId(final int id) { this.id = id; } private Parent getParent(){ return parent; } private void setParent(Parent parent) { this.parent = parent; } @Override public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } final Child that = (Child) o; return id == that.id; } @Override public int hashCode() { return id; } } The application context: <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="annotatedClasses"> <list> <value>Parent</value> <value>Child</value> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.SQLServer2008Dialect</prop> <prop key="hibernate.hbm2ddl.auto">validate</prop> <prop key="hibernate.ejb.naming_strategy">org.hibernate.cfg.ImprovedNamingStrategy</prop> <prop key="hibernate.connection.charSet">UTF-8</prop> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.format_sql">true</prop> <prop key="hibernate.use_sql_comments">true</prop> <!-- cache settings ehcache--> <prop key="hibernate.cache.use_second_level_cache">true</prop> <prop key="hibernate.cache.use_query_cache">true</prop> <prop key="hibernate.cache.region.factory_class"> org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory</prop> <prop key="hibernate.generate_statistics">true</prop> <prop key="hibernate.cache.use_structured_entries">true</prop> <prop key="hibernate.cache.use_query_cache">true</prop> <prop key="hibernate.transaction.factory_class"> org.hibernate.engine.transaction.internal.jta.JtaTransactionFactory</prop> <prop key="hibernate.transaction.jta.platform"> org.hibernate.service.jta.platform.internal.JBossStandAloneJtaPlatform</prop> </props> </property> </bean> The testcase I'm running: @Test public void testGetParentFromCache() { for (int i = 0; i <3 ; i++ ) { getEntity(); } } private void getEntity() { Session sess = sessionFactory.openSession() sess.setCacheMode(CacheMode.NORMAL); Transaction t = sess.beginTransaction(); Parent p = (Parent) s.get(Parent.class, 123); Assert.assertNotNull(p); Assert.assertNotNull(p.getChildren().size()); t.commit(); sess.flush(); sess.clear(); sess.close(); } In the logging I can see that the first time 2 queries are executed getting the parent and getting the children. Furthermore the logging shows that the child entities as well as the collection are stored in the 2nd level cache. However when reading the collection a query is executed to fetch the children on second and third attempt.

    Read the article

  • automaticaly place downloaded files in folder bsed on downloads extention sufix

    - by Bart van Tuÿl
    I’m making a simple web browser for work eeh, what I’d like to know is if its possible to save a file of a particular extension to a particular file. I currently use googels chrome when downloading a file it places this (regardless of extension) in a downloads folder without asking where I ant to download this too. I want to achieve the same except that downloads with the extension .dwg are placed automatically in a folder named DWG DOWNLAODS… Dose anybody know how to achieve this in vb.net?

    Read the article

  • Simply display RSS feed in/on aspx page

    - by Louis van Tonder
    Maybe I am being a n00b here, but for the life of me, I cant find a simple drop in type solution for displaying an rss feed inside an aspx page? I am looking for a simple solution, as when Firefox gets pointed to an rss feed, it just plainly displays it, no thrills, no fuss. I don't want to get into the xml and format it extensively. I just want a basic feed, will style it with font and a:styles. Thats it. Any ideas? EDIT: I am attempting to show a worpress "feed" inside an aspx page...

    Read the article

  • jQuery selectable list items

    - by Erik Elkins
    I want to be able to get information about the selected item in the ordered list whose ID is #selectable. The below code returns the ID #selectable, I'm looking for the id of the item I just selected. $('#selectable').selectable({ selected: function (event, ui) { alert($(this).attr('id').toString()); } }); Any ideas?

    Read the article

  • Using an SHA1 with Microsoft CAPI

    - by Erik Jõgi
    I have an SHA1 hash and I need to sign it. The CryptSignHash() method requires a HCRYPTHASH handle for signing. I create it and as I have the actual hash value already then set it: CryptCreateHash(cryptoProvider, CALG_SHA1, 0, 0, &hash); CryptSetHashParam(hash, HP_HASHVAL, hashBytes, 0); The hashBytes is an array of 20 bytes. However the problem is that the signature produced from this HCRYPTHASH handle is incorrect. I traced the problem down to the fact that CAPI actually doesn't use all 20 bytes from my hashBytes array. For some reason it thinks that SHA1 is only 4 bytes. To verify this I wrote this small program: HCRYPTPROV cryptoProvider; CryptAcquireContext(&cryptoProvider, NULL, NULL, PROV_RSA_FULL, 0); HCRYPTHASH hash; HCRYPTKEY keyForHash; CryptCreateHash(cryptoProvider, CALG_SHA1, keyForHash, 0, &hash); DWORD hashLength; CryptGetHashParam(hash, HP_HASHSIZE, NULL, &hashLength, 0); printf("hashLength: %d\n", hashLength); And this prints out hashLength: 4 ! Can anyone explain what I am doing wrong or why Microsoft CAPI thinks that SHA1 is 4 bytes (32 bits) instead of 20 bytes (160 bits).

    Read the article

  • Components don't show in custom JPanel/JComponent

    - by Bart van Heukelom
    I've created a custom swing component. I can see it (the grid from the paint method is drawn), but the buttons that are added (verified by println) aren't shown. What am I doing wrong? Background information: I'm trying to build a tree of visible objects like the Flash/AS3 display list. public class MapPanel extends JComponent { // or extends JPanel, same effect private static final long serialVersionUID = 4844990579260312742L; public MapPanel(ShapeMap map) { setBackground(Color.LIGHT_GRAY); setPreferredSize(new Dimension(1000,1000)); setLayout(null); for (Layer l : map.getLayers()) { // LayerView layerView = new LayerView(l); // add(layerView); System.out.println(l); JButton test = new JButton(l.getName()); add(test); validate(); } } @Override protected void paintComponent(Graphics g) { // necessary? super.paintComponent(g); // background g.setColor(getBackground()); g.fillRect(0, 0, getWidth(), getHeight()); // grid g.setColor(Color.GRAY); for (double x = 0; x < getWidth(); x += 10) { g.drawLine((int)x, 0, (int)x, getHeight()); } for (double y = 0; y < getHeight(); y += 10) { g.drawLine(0, (int)y, getWidth(), (int)y); } } }

    Read the article

  • How to write a custom (odd) authentication plugins for Wordpress, Joomla and MediaWiki

    - by Bart van Heukelom
    On our network (a group of related websites - not a LAN) we have a common authentication system which works like this: On a network site ("consumer") the user clicks on a login link This redirects the user to a login page on our auth system ("RAS"). Upon successful login the user is directed back to the consumer site. Extra data is passed in the query string. This extra data does not include any information about the user yet. The consumer site's backend contacts RAS to get the information about the logged in user. So as you can see, the consumer site knows nothing about the authentication method. It doesn't know if it's by username/password, fingerprint, smartcard, or winning a game of poker. This is the main problem I'm encountering when trying to find out how I could write custom authentication plugins for these packages, acting as consumer sites: Wordpress Joomla MediaWiki For example Joomla offers a pretty simple auth plugin system, but it depends on a username/password entered on the Joomla site. Any hints on where to start?

    Read the article

  • Attributes in XML subtree that belong to the parent

    - by Bart van Heukelom
    Say I have this XML <doc:document> <objects> <circle radius="10" doc:colour="red" /> <circle radius="20" doc:colour="blue" /> </objects> </doc:document> And this is how it is parsed (pseudo code): // class DocumentParser public Document parse(Element edoc) { doc = new Document(); doc.objects = ObjectsParser.parse(edoc.getChild("objects")); for ( ...?... ) { doc.objectColours.put(object, colour); } return doc; } ObjectsParser is responsible for parsing the objects bit, but is not and should not be aware of the existence of documents. However, in Document colours are associated with objects by use of a Map. What kind of pattern would you recommend to give the colour settings back to DocumentParser.parse from ObjectsParser.parse so it can associate it with the objects they belong to in a map? The alternative would be something like this: <doc:document> <objects> <circle id="1938" radius="10" /> <circle id="6398" radius="20" /> </objects> <doc:objectViewSettings> <doc:objectViewSetting object="1938" colour="red" /> <doc:objectViewSetting object="6398" colour="blue" /> </doc:objectViewSettings> </doc:document> Ugly!

    Read the article

  • Append a parent element to arrays in PHP for a foreach loop

    - by Erik Berger
    print_r of $data = json_decode($src, true); returns data that looks like this: Array ( [0] => Array ( [var1] => blah [var2] => foo ) [1] => Array ( [var1] => lorem [var2] => ipsum ) // goes down to [1936] ) I want to build an html table that shows var1 and var2 next to each other in the same row. I know do to this I need a foreach statement like foreach($data['items'] as $item) but the problem I think I am having is that my many arrays aren't the child of one thing like 'items', right? I looked into array_push but couldn't figure it out. Can someone help my orphaned parentless arrays?

    Read the article

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