Daily Archives

Articles indexed Saturday October 6 2012

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

  • game play strategy in an arena

    - by joulesm
    I am writing a player's behavior for an arena game, and I'm wondering if you can offer some strategies. I'm writing it in Python, but I'm just interested in the high level game play. Here are the game aspects: Arena is a circle of a given size. The arena size shrinks every round to help break ties. Players are much smaller circles, can be on teams of 1 or 2 players. Players attack by colliding with other players, and based on the physics of the collision (speed of both players, angle), one could force another player out of the arena. Once a player is out of the arena, they are out of the game (for that round). The goal is to be the only team with players left in the arena. All other players have been pushed (through collisions or mistakes) out of the arena. It is possible for there to be no winner if the last two players exit the arena at the same time. Once the player has been programmed, the game just runs. There is no human intervention in the game. I'm thinking it's easiest to implement a few simple programmatic rules for my player to follow. For example, stay close to center of the arena, attack opponents from the inner side of the arena, etc. Are there any good simple game strategies? Would adding a random aspect to the game help? For example, to avoid predictability by the other team or something. Thanks in advance.

    Read the article

  • bootstrap: Uncaught TypeError: Object [object Object] has no method 'tooltip', 'typeahead'

    - by DarkKnightFan
    I am trying to use the tooltip, typeahead, datepicker features of bootstrap. But I keep getting these errors in the console! Uncaught TypeError: Object [object Object] has no method 'tooltip' Uncaught TypeError: Object [object Object] has no method 'typeahead' This is how my imports look like: <link href="css/bootstrap.css" rel="stylesheet"> <link href="css/datepicker.css" rel="stylesheet"> <link href="css/bootstrap-responsive.css" rel="stylesheet"> <script type="text/javascript" src="js/jquery-1.8.0.js"></script> <script type="text/javascript" src="js/bootstrap.js"></script> <script type="text/javascript" src="js/bootstrap-datepicker.js"></script> <script type="text/javascript" src="js/bootstrap-typeahead.js"></script> <script type="text/javascript" src="js/highcharts.js"></script> <script type="text/javascript" src="js/exporting.js"></script> <link type="text/css" rel="stylesheet" href="css/jquery.dropdown.css" /> <script type="text/javascript" src="js/jquery.dropdown.js"></script> Some sample code: <a class="btn btn-success" data-toggle="modal" href="#payments" rel="tooltip" data-placement="top" title="Record your payments"> <i class="icon-check icon-white"></i> Payments</a> $("#payments").tooltip('show'); Similarly I have code for datepicker and typeahead. any solution?

    Read the article

  • Multi-account sync with Dropbox API

    - by Dan
    I'm trying to create a web app that lets users share files with each other through Dropbox. At the moment, Dropbox handles all the sharing, and there's one central Dropbox account running on the web server that shares the folder with the people who want it. I'm trying to change it so people don't have to accept a new folder invitation each time. I'd like to have them authorize my app to access an app folder in their Dropbox account, and all their shared folders would go inside there. Any changes they make would get noticed by the app on the server and synced to everyone else's folders. There's a couple things I'm having trouble figuring out to make this work: Do I need to make repeated calls to /delta for every account? I can't think how else I'd do this, but that sounds like it would quickly turn into thousands of requests a minute just polling for updates. When someone adds a file, do I have to upload it once for each account? That seems like a huge waste of bandwidth. I've looked into using /copy_ref, which I think would add a file to another user's account without my app ever touching it, but my app's web interface also allows users to upload files directly to my server, which would then need to be synced with everyone else's folders. That file isn't on Dropbox's servers yet, so /copy_ref obviously wouldn't work. For a little extra context, my app is written in node.js, and I've been playing with this library to interface with Dropbox, which uses their REST API.

    Read the article

  • Django - I got TemplateSyntaxError when I try open the admin page. (http://DOMAIN_NAME/admin)

    - by user140827
    I use grappelly plugin. When I try open the admin page (/admin) I got TemplateSyntaxError. It says 'get_generic_relation_list' is invalid block tag. TemplateSyntaxError at /admin/ Invalid block tag: 'get_generic_relation_list', expected 'endblock' Request Method: GET Request URL: http://DOMAIN_NAME/admin/ Django Version: 1.4 Exception Type: TemplateSyntaxError Exception Value: Invalid block tag: 'get_generic_relation_list', expected 'endblock' Exception Location: /opt/python27/django/1.4/lib/python2.7/site-packages/django/template/base.py in invalid_block_tag, line 320 Python Executable: /opt/python27/django/1.4/bin/python Python Version: 2.7.0 Python Path: ['/home/vhosts/DOMAIN_NAME/httpdocs/media', '/home/vhosts/DOMAIN_NAME/private/new_malinnikov/lib', '/home/vhosts/DOMAIN_NAME/httpdocs/', '/home/vhosts/DOMAIN_NAME/private/new_malinnikov', '/home/vhosts/DOMAIN_NAME/private/new_malinnikov', '/home/vhosts/DOMAIN_NAME/private', '/opt/python27/django/1.4', '/home/vhosts/DOMAIN_NAME/httpdocs', '/opt/python27/django/1.4/lib/python2.7/site-packages/setuptools-0.6c12dev_r88846-py2.7.egg', '/opt/python27/django/1.4/lib/python2.7/site-packages/pip-0.8.1-py2.7.egg', '/opt/python27/django/1.4/lib/python27.zip', '/opt/python27/django/1.4/lib/python2.7', '/opt/python27/django/1.4/lib/python2.7/plat-linux2', '/opt/python27/django/1.4/lib/python2.7/lib-tk', '/opt/python27/django/1.4/lib/python2.7/lib-old', '/opt/python27/django/1.4/lib/python2.7/lib-dynload', '/opt/python27/lib/python2.7', '/opt/python27/lib/python2.7/plat-linux2', '/opt/python27/lib/python2.7/lib-tk', '/opt/python27/django/1.4/lib/python2.7/site-packages', '/opt/python27/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg', '/opt/python27/lib/python2.7/site-packages/flup-1.0.3.dev_20100525-py2.7.egg', '/opt/python27/lib/python2.7/site-packages/virtualenv-1.5.1-py2.7.egg', '/opt/python27/lib/python2.7/site-packages/SQLAlchemy-0.6.4-py2.7.egg', '/opt/python27/lib/python2.7/site-packages/SQLObject-0.14.1-py2.7.egg', '/opt/python27/lib/python2.7/site-packages/FormEncode-1.2.3dev-py2.7.egg', '/opt/python27/lib/python2.7/site-packages/MySQL_python-1.2.3-py2.7-linux-x86_64.egg', '/opt/python27/lib/python2.7/site-packages/psycopg2-2.2.2-py2.7-linux-x86_64.egg', '/opt/python27/lib/python2.7/site-packages/pysqlite-2.6.0-py2.7-linux-x86_64.egg', '/opt/python27/lib/python2.7/site-packages', '/opt/python27/lib/python2.7/site-packages/PIL'] Server time: ???, 7 ??? 2012 04:19:42 +0700 Error during template rendering In template /home/vhosts/DOMAIN_NAME/httpdocs/templates/grappelli/admin/base.html, error at line 28 Invalid block tag: 'get_generic_relation_list', expected 'endblock' 18 <!--[if lt IE 8]> 19 <script src="http://ie7-js.googlecode.com/svn/version/2.0(beta3)/IE8.js" type="text/javascript"></script> 20 <![endif]--> 21 {% block javascripts %} 22 <script type="text/javascript" src="{% admin_media_prefix %}jquery/jquery-1.3.2.min.js"></script> 23 <script type="text/javascript" src="{% admin_media_prefix %}js/admin/Bookmarks.js"></script> 24 <script type="text/javascript"> 25 // Admin URL 26 var ADMIN_URL = "{% get_admin_url %}"; 27 // Generic Relations 28 {% get_generic_relation_list %} 29 // Get Bookmarks 30 $(document).ready(function(){ 31 $.ajax({ 32 type: "GET", 33 url: '{% url grp_bookmark_get %}', 34 data: "path=" + escape(window.location.pathname + window.location.search), 35 dataType: "html", 36 success: function(data){ 37 $('ul#bookmarks').replaceWith(data); 38 }

    Read the article

  • Theme change doesn't work on <4.0 as it should

    - by user1717276
    I have some difficulties with setting up a "theme switcher" programmatically. I would like to switch themes from app (between White (Theme.Light.NoTitleBar) and Dark (Theme.Black.NoTitleBar)) and what I do is: I set a SharedPreference: final String PREFS_NAME = "MyPrefsFile"; final SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0); final SharedPreferences.Editor editor = settings.edit(); and than I have a two buttons to switch themes (second one is almost identical) Button ThemeWhite = (Button) findViewById(R.id.ThemeWhite); ThemeWhite.setOnClickListener(new OnClickListener() { public void onClick(View v) { editor.putBoolean("Theme", false); editor.commit(); System.exit(2); } }); and in begging of each activity I check SharedPreference boolean theme = settings.getBoolean("Theme", false); if(theme){ this.setTheme(R.style.Theme_NoBarBlack); } else{ this.setTheme(R.style.Theme_NoBar); } setContentView(R.layout.aplikacja); I define themes in file styles.xml in folder values: <resources> <style name="Theme.NoBar" parent="@android:style/Theme.Light.NoTitleBar" /> <style name="Theme.NoBarBlack" parent="@android:style/Theme.NoActionBar" /> in values-v11: <resources> <style name="Theme.NoBar" parent="@android:style/Theme.Holo.Light.NoActionBar" /> <style name="Theme.NoBarBlack" parent="@android:style/Theme.Holo.NoActionBar" /> in values-v14: <resources> <style name="Theme.NoBar" parent="@android:style/Theme.DeviceDefault.Light.NoActionBar" /> <style name="Theme.NoBarBlack" parent="@android:style/Theme.DeviceDefault.NoActionBar" /> manifest file: <application android:theme="@style/Theme.NoBar" > Everything is working excellent on android 4.0 but when I use 2.2 it doesn't change theme - just font is getting white as it should be but there is no dark background. I tried checking if it at least works and changed Theme.NoBarBlack in values (for android <3.0) and its value the same as Theme.NoBar and then when I pressed button font wasn't changed -as it should do.

    Read the article

  • Handle error at non-UI thread

    - by DreamTeam Mobile
    For some reason unhandled exception which occur at non-UI thread don't handled by App_UnhandledException handler. This approach works well for Windows Phone apps to globally handle, track and analyze exceptions but doesn't work for Windows 8 apps. this.UnhandledException += App_UnhandledException; //doesn't handle private void Button_Click_1(object sender, RoutedEventArgs e) { var task = new Task(() => { throw new NullReferenceException("Test exc in UI thread"); }); task.Start(); } Please, advise.

    Read the article

  • What type of data store should I use for my ios app?

    - by mwiederrecht
    I am pretty new to ios and using servers so forgive me. I am building an ios app for research. I need to monitor things that the user does and then push it up to a server for analysis (yes, with user and IRB permission). On the client's side I need to keep quite a bit of data that won't really change except in the case of pulling an updated version from the server, and then a minimal amount of user-specific data. Most of the data I will collect needs to be pushed to a server for analysis and then can be deleted from the client side. I am struggling to figure out what kind of data store I need to use, especially since I am not quite sure how the pushing and pulling from the server process works yet. Does it make sense to use Core Data? XML? SQLite? I like the Core Data idea, but I am not sure what kind of problems I will run into when I need to send large amounts of data to it and from it from the server. I imagine I might need to send data in a different form than it is probably stored in on either end - so what kind of overhead am I likely to run into in the process of converting that data? Is there a good format to save stuff in that would work well for me on both ends AND for sending the data? As you can probably tell, I could use some advice. Thanks!

    Read the article

  • Time complexity with bit cost

    - by Keyser
    I think I might have completely misunderstood bit cost analysis. I'm trying to wrap my head around the concept of studying an algorithm's time complexity with respect to bit cost (instead of unit cost) and it seems to be impossible to find anything on the subject. Is this considered to be so trivial that no one ever needs to have it explained to them? Well I do. (Also, there doesn't even seem to be anything on wikipedia which is very unusual). Here's what I have so far: The bit cost of multiplication and division of two numbers with n bits is O(n^2) (in general?) So, for example: int number = 2; for(int i = 0; i < n; i++ ){ number = i*i; } has a time complexity with respect to bit cost of O(n^3), because it does n multiplications (right?) But in a regular scenario we want the time complexity with respect to the input. So, how does that scenario work? The number of bits in i could be considered a constant. Which would make the time complexity the same as with unit cost except with a bigger constant (and both would be linear). Also, I'm guessing addition and subtraction can be done in constant time, O(1). Couldn't find any info on it but it seems reasonable since it's one assembler operation.

    Read the article

  • Haskell: Pattern Matching with Lists

    - by user1670032
    I'm trying to make a function that takes in a list, and if one of the elements is negative, then any elements in that list that are equal to its positive counterpart should be changed to 0. Eg, if there is a -2 in a list, then all 2's in that list should be changed to 0. Any ideas why it only works for some cases and not others? I'm not understanding why this is, I've looked it over several times. changeToZero [] = [] changeToZero [x] = [x] changeToZero (x:zs:y:ws) | (x < 0) && ((-1)*(x) == y) = x : zs : 0 : changeToZero ws changeToZero (x:xs) = x : changeToZero xs *Main changeToZero [-1,1,-2,2,-3,3] [-1,1,-2,2,-3,3] *Main changeToZero [-2,1,2,3] [-2,1,0,3] *Main changeToZero [-2,1,2,3,2] [-2,1,0,3,2] *Main changeToZero [1,-2,2,2,1] [1,-2,2,0,1]

    Read the article

  • How to test custom handler500?

    - by Gr1N
    I write my handler for server errors and define it at root urls.py: handler500 = 'myhandler' And I want to write unittest for testing how it works. For testing I write view with error and define it in test URLs configuration, when I make request to this view in browser I see my handler and receive status code 500, but when I launch test that make request to this view I see stack trace and my test failed. Have you some ideas for testing handler500 by unittests?

    Read the article

  • ZF2 - How to use the Hydrator/exchangeArray() to populate a nested object

    - by Dominic Watson
    I've got an object with values that are stored in my database. My object also contains another object which is stored in the database using just the ID of it (foreign key). http://framework.zend.com/manual/2.0/en/modules/zend.stdlib.hydrator.html Before the Hydrator/exchangeArray functionality in ZF2 you would use a Mapper to grab everything you need to create the object. Now I'm trying to eliminate this extra layer by just using Hydration/exchangeArray to populate my objects but am a bit stuck on creating the nested object. Should my entity have the Inner object's table injected into it so I can create it if the ID of it is passed to my 'exchangeArray' ? Here are example entities as an example. // Village id, name, position, square_id // Map Square id, name, type Upon sending square_id to my Village's exchangeArray() function. It would get the mapTable and use hydrator to pull in the square using the ID I have. It doesn't seem right to be to have mapper instances inside my entity as I thought they should be disconnected from anything but it's own entity specific parameters and functionality?

    Read the article

  • php curl login not work

    - by Massimo Zampieri
    Hi i have a problem with the curl. I watched an old post Remote Login not Working With Curl, but it not work. I followed baba's advice but the code enter in the if statement. Sorry for my bad english. Can anyone help me? This is the code: $url="http://hipfile.com/"; $urllog="http://hipfile.com/login.html"; $postdata = "login=bnnoor&password=########&op=login"; $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6"); curl_setopt ($ch, CURLOPT_TIMEOUT, 60); curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_REFERER, $urllog); curl_setopt ($ch, CURLOPT_POSTFIELDS, $postdata); curl_setopt ($ch, CURLOPT_POST, 1); $result = curl_exec ($ch); if (!$result) { $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); // make sure we closeany current curl sessions die($http_code.' Unable to connect to server. Please come back later.'); } echo $result; curl_close($ch);

    Read the article

  • Setting up Eloquent relationships in Laravel for existing InnoDB relationships

    - by adam
    I have an initial migration that sets up two tables (users and projects), with a relationship (innoDB). $table->foreign('user_id')->references('id')->on('users'); I have two Eloquent models set up, blank except for the relationship: return $this->has_many('Project'); Do i definitely need to tell eloquent about the relationship in the models and the database? I'd assumed something as comprehensive as Laravel would infer it from the Schema? Is there something I'm missing?

    Read the article

  • Rails: Rendered JS file doesn't execute using UJS

    - by Hassinus
    I would like to display a Rails edit form using JS instead of redirecting with HTML. To do this, I use UJS for the edit link: <%= link_to "Edit user info", edit_user_path(1), :remote => true %> Then, the "edit" action of User controller is like this (simplified version): controllers/users_controller.rb: def edit # Step 1: Get the edit HTML form @html = render_to_string(:template => "users/edit.html") # Step 2: Use JS to display the form in the correct place render "users/edit.js" end As you may guess, I have two views: The html version of "edit" action which contains the form in HTML format. Let's consider a test version: views/users/edit.html.erb: <h1>This is just a test</h1> The js version that will display the form in the correct place, using jQuery for example. Again, for test purpose, let's just popup the html text: views/users/edit.js.erb: alert("<%= @html %>"); The problem is that nothing is executed (no popup) Using the inspector (from Chrome web browser), I get the response as text format: alert("<h1>This is just a test</h1>"); Do you have any idea? Why do the rendered JS is not executed? Thanks in advance.

    Read the article

  • Visual Studio Game Controller

    - by Pythonator
    I'm making a program to improve your gaming skills, so its not a hacking program!! Now, i'm stuck on 1 thing, i need sort of a keylogger, that will logg what you do, For example, when you press space, it has to put Jumped in a Rich Text Box. When you left mouse click, it has to add Shots Fired to the Rich Text Box, and then , when right mousebutton is clicked, add Aiming Down Sights, but when its released it should also add something like Stopped Aiming Down Sights Can anyone help me on this? Greets

    Read the article

  • How do I get the response time from a jQuery ajax call?

    - by Dumpen
    So I am working on tool that can show long a request to a page is taking. I am doing this by using jQuery Ajax (http://api.jquery.com/jQuery.ajax/) and I want to figure out the best way to get the response time. I found a thread (http://forum.jquery.com/topic/jquery-get-time-of-ajax-post) which describes using the "Date" in JavaScript, but is this method really reliable? An example of my code could be this below $.ajax({ type: "POST", url: "some.php", }).done(function () { // Here I want to get the how long it took to load some.php and use it further });

    Read the article

  • Java ternary operator and boxing Integer/int?

    - by Markus
    I tripped across a really strange NullPointerException the other day caused by an unexpected type-cast in the ternary operator. Given this (useless exemplary) function: Integer getNumber() { return null; } I was expecting the following two code segments to be exactly identical after compilation: Integer number; if (condition) { number = getNumber(); } else { number = 0; } vs. Integer number = (condition) ? getNumber() : 0; . Turns out, if condition is true, the if-statement works fine, while the ternary opration in the second code segment throws a NullPointerException. It seems as though the ternary operation has decided to type-cast both choices to int before auto-boxing the result back into an Integer!?! In fact, if I explicitly cast the 0 to Integer, the exception goes away. In other words: Integer number = (condition) ? getNumber() : 0; is not the same as: Integer number = (condition) ? getNumber() : (Integer) 0; . So, it seems that there is a byte-code difference between the ternary operator and an equivalent if-else-statement (something I didn't expect). Which raises three questions: Why is there a difference? Is this a bug in the ternary implementation or is there a reason for the type cast? Given there is a difference, is the ternary operation more or less performant than an equivalent if-statement (I know, the difference can't be huge, but still)?

    Read the article

  • Checking for uppercase/lowercase/numbers with Jquery

    - by user1725794
    Either I'm being really retarded here or its just the lack of sleep but why doesn't this work? If I use the "or" operator it works for each separate test but as soon as it change it to the "and" operator it stops working. I'm trying to test the password input of a form to see if its contains lowercase, uppercase and at least 1 number of symbol. I'm having a lot of trouble with this so help would be lovely, here is the code I have. var upperCase= new RegExp('[^A-Z]'); var lowerCase= new RegExp('[^a-z]'); var numbers = new RegExp('[^0-9]'); if(!$(this).val().match(upperCase) && !$(this).val().match(lowerCase) && !$(this).val().match(numbers)) { $("#passwordErrorMsg").html("Your password must be between 6 and 20 characters. It must contain a mixture of upper and lower case letters, and at least one number or symbol."); } else { $("#passwordErrorMsg").html("OK") }

    Read the article

  • Added a tableview in a viewcontroller. How do I load tableview cells

    - by user1509593
    I have a view controller In storyboard, added tableview to view controller. Created an IBOutlet for tableview to View controller's header file. The view controller's header file includes an resultsarray Changed the @interface to include delegates <\UITableViewDelegate, UITableViewDataSource View controller implementation file has mandatory tableview protocols (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath The view controller has search button in storyboard and IBAction in view controller header file. On click of search button, results are obtained. How do I load the array and redisplay tableview with results in search method. After I loaded the results in array, I tried [self viewdidload];, hoping the cells will be loaded. But didn't. I thought of calling [self.detailView cellForRowAtIndexPath:?indexpath], but dontknow what the value of index path is. Appreciate help from guru's to load the UItableviewcell Thanks

    Read the article

  • Keep the images downloaded in the listview during scrolling

    - by Paveliko
    I'm developing my first app and have been reading a LOT here. I've been trying to find a solution for the following issue for over a week with no luck. I have an Adapter that extends ArrayAdapter to show image and 3 lines of text in each row. Inside the getView I assign relevant information for the TextViews and use ImageLoader class to download image and assign it to the ImageView. Everything works great! I have 4.5 rows visible on my screen (out of total of 20). When I scroll down for the first time the images continue to download and be assigned in right order to the list. BUT when I scroll back the list looses all the images and start redrawing them again (0.5-1 sec per image) in correct order. From what I've been reading it's the standard list performance but I want to change it. I want that, once the image was downloaded, it will be "sticked" to the list for the whole session of the current window. Just like in Contacts list or in the Market. It is only 20 images (6-9kb each). Hope I managed to explain myself.

    Read the article

  • Hiding a button on pushed view and showing it when back to list view

    - by torr
    When I load my list view it has several blog posts and a refresh button on the top left. If I tap on a list item a view is pushed with the contents of that specific post. When this view is pushed in, the refresh button is hidden. But when I tap 'Back' to the parent list view, I'd like the refresh button to show (un-hide) - but it remains hidden. Any idea how to make this work? This is my View: Ext.require(['Ext.data.Store', 'MyApp.model.StreamModel'], function() { Ext.define('MyApp.view.HomeView', { extend: 'Ext.navigation.View', xtype: 'homepanel', requires: [ 'Ext.dataview.List', ], config: { title: 'Home', iconCls: 'home', styleHtmlContent: true, navigationBar: { items: [ { xtype: 'button', iconMask: true, iconCls: 'refresh', align: 'left', action: 'refreshButton', id: 'refreshButtonId' } ] }, items: { title: 'My', xtype: 'list', itemTpl: [ '<div class="post">', ... '</div>' ].join(''), store: new Ext.data.Store({ model: 'MyApp.model.StreamModel', autoLoad: true, storeId: 'stream' }), } } }); }); and my Controller: Ext.define('MyApp.controller.SingleController', { extend: 'Ext.app.Controller', config: { refs: { stream: 'homepanel' }, control: { 'homepanel list': { itemtap: 'showPost' } } }, showPost: function(list, index, element, record) { this.getStream().push({ xtype: 'panel', html: [ '<div class="post">', '</div>' ].join(''), scrollable: 'vertical', styleHtmlContent: true, }); Ext.getCmp('refreshButtonId').hide(); } });

    Read the article

  • #1146 - Table 'phpmyadmin.pma_recent' doesn't exist

    - by Mumin Ali
    Solution Guys... FYI i am using xampp to use phpmyadmin. and this error happens during the process of creating a database on localhost. Below is the code for config.inc file under phpmyadmin directory: <?php /* * This is needed for cookie based authentication to encrypt password in * cookie */ $cfg['blowfish_secret'] = 'xampp'; /* YOU SHOULD CHANGE THIS FOR A MORE SECURE COOKIE AUTH! */ /* * Servers configuration */ $i = 0; /* * First server */ $i++; /* Authentication type and info */ $cfg['Servers'][$i]['auth_type'] = 'HTTP'; $cfg['Servers'][$i]['user'] = 'root'; $cfg['Servers'][$i]['password'] = 'password'; $cfg['Servers'][$i]['extension'] = 'mysql'; $cfg['Servers'][$i]['AllowNoPassword'] = true; $cfg['Lang'] = ''; /* Bind to the localhost ipv4 address and tcp */ $cfg['Servers'][$i]['host'] = 'localhost'; $cfg['Servers'][$i]['connect_type'] = 'tcp'; /* User for advanced features */ $cfg['Servers'][$i]['controluser'] = 'pma'; $cfg['Servers'][$i]['controlpass'] = ''; /* Advanced phpMyAdmin features */ $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin'; $cfg['Servers'][$i]['bookmarktable'] = 'pma_bookmark'; $cfg['Servers'][$i]['relation'] = 'pma_relation'; $cfg['Servers'][$i]['table_info'] = 'pma_table_info'; $cfg['Servers'][$i]['table_coords'] = 'pma_table_coords'; $cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages'; $cfg['Servers'][$i]['column_info'] = 'pma_column_info'; $cfg['Servers'][$i]['history'] = 'pma_history'; $cfg['Servers'][$i]['designer_coords'] = 'pma_designer_coords'; $cfg['Servers'][$i]['tracking'] = 'pma_tracking'; $cfg['Servers'][$i]['userconfig'] = 'pma_userconfig'; $cfg['Servers'][$i]['recent'] = 'pma_recent'; $cfg['Servers'][$i]['table_uiprefs'] = 'pma_table_uiprefs'; /* * End of servers configuration */ ?>

    Read the article

  • GLSL point inside box test

    - by wcochran
    Below is a GLSL fragment shader that outputs a texel if the given texture coord is inside a box, otherwise a color is output. This just feels silly and the there must be a way to do this without branching? uniform sampler2D texUnit; varying vec4 color; varying vec2 texCoord; void main() { vec4 texel = texture2D(texUnit, texCoord); if (any(lessThan(texCoord, vec2(0.0, 0.0))) || any(greaterThan(texCoord, vec2(1.0, 1.0)))) gl_FragColor = color; else gl_FragColor = texel; } Below is a version without branching, but it still feels clumsy. What is the best practice for "texture coord clamping"? uniform sampler2D texUnit; varying vec4 color; varying vec4 labelColor; varying vec2 texCoord; void main() { vec4 texel = texture2D(texUnit, texCoord); bool outside = any(lessThan(texCoord, vec2(0.0, 0.0))) || any(greaterThan(texCoord, vec2(1.0, 1.0))); gl_FragColor = mix(texel*labelColor, color, vec4(outside,outside,outside,outside)); } I am clamping texels to the region with the label is -- the texture s & t coordinates will be between 0 and 1 in this case. Otherwise, I use a brown color where the label ain't. Note that I could also construct a branching version of the code that does not perform a texture lookup when it doesn't need to. Would this be faster than a non-branching version that always performed a texture lookup? Maybe time for some tests...

    Read the article

  • twitter streaming api instead of search api

    - by user1711576
    I am using twitters search API to view all the tweets that use a particular hashtag I want to view. However, I want to use the stream function, so, I only get recent ones, and so, I can then store them. <?php global $total, $hashtag; $hashtag = $_POST['hash']; $total = 0; function getTweets($hash_tag, $page) { global $total, $hashtag; $url = 'http://search.twitter.com/search.json?q='.urlencode($hash_tag).'&'; $url .= 'page='.$page; $ch = curl_init($url); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, TRUE); $json = curl_exec ($ch); curl_close ($ch); echo "<pre>"; $json_decode = json_decode($json); print_r($json_decode->results); $json_decode = json_decode($json); $total += count($json_decode->results); if($json_decode->next_page){ $temp = explode("&",$json_decode->next_page); $p = explode("=",$temp[0]); getTweets($hashtag,$p[1]); } } getTweets($hashtag,1); echo $total; ?> The above code is what I have been using to search for the tweets I want. What do I need to do to change it so I can stream the tweets instead? I know I would have to use the stream url https://api.twitter.com/1.1/search/tweets.json , but what do I need to change after that is where I don't know what to do. Obviously, I know I'll need to write the database sql but I want to just capture the stream first and view it. How would I do this? Is the code I have been using not any good for just capturing the stream?

    Read the article

  • Environment Variables in C

    - by tpar44
    I know this type of question has been asked a lot but none of the answers seem to help. I set an environment variable through setenv() function call in Ubuntu Linux. However, the program doesn't seem use this environment variables. If I use getenv() it gets the correct value but the output to the program is wrong. However, when I use export BLOCKSIZE=512 in the shell, the output to the program is correct. I am not spawning different processes from the program. Below is only a code snippet of what I am doing, it is not my whole program. Is there any reason for this?

    Read the article

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