Daily Archives

Articles indexed Saturday November 17 2012

Page 6/13 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • Writing a Master's Thesis on evaluating visual scripting systems

    - by user1107412
    I am thinking to write my Master's thesis around theorizing, and then implementing a PlayMaker or Kismet-like (building game logic by visually arranging FSMs) tool in Unity. The only thing I am still concerned about is the actual research question that I should pose. I was kinda hoping that the more experienced game designers out there might know. Update: What about reducing the use of visual programming to graphically designing FSM-Action-Transition flows, which can then be attached to game entities (very much like http://playmaker.com does it)?

    Read the article

  • How to fix “Error: This solution contains no resources scoped for a Web application and cannot be deployed to a particular Web application.”

    - by ybbest
    Problem: When I try to deploy my custom wsp solution to a specific web application, I got the error below: This solution contains no resources scoped for a Web application and cannot be deployed to a particular Web application. Analysis: The error message itself explains why you cannot deploy the solution to a web application. However if you do not like to deploy the solution to all the web applications and only like to deploy your solution to a specific application , you need to change the solution settings Assembly Deployment Target from GlobalAssemblyCache to WebApplication. From: TO: Solution: After you change the Assembly Deployment Target and run the script again, you will have the solution deployed successfully. References: http://blogs.msdn.com/b/jjameson/archive/2007/06/17/issues-deploying-sharepoint-solution-packages.aspx

    Read the article

  • Python extension building with boost

    - by user1544053
    Hey guys I'm fairly new to boost c/c++ library. I downloaded boost library and build the library. I created a very simple python library in c++ using boost interface (actually it is example code given in the documentation). I built it into a dll file. In the documentation it reads that this dll is exposed to python and they just show the import function in python and include the created library. I don't understand how to expose that dll to python and load the library inside in tradition ('import') manner. In case if you wanna look at the code then here it is: #include <boost/python.hpp> char const* greet() { return "hello, world"; } BOOST_PYTHON_MODULE(hello_ext) { using namespace boost::python; def("greet", greet); } Please help I really want to build applications with c/c++ and python. I simply want to use hello_ext as: >>>import hello_ext >>>print hello_ext.greet() Thank you.

    Read the article

  • How can I use a custom configured RememberMeAuthenticationFilter in spring security?

    - by Sebastian
    I want to use a slightly customized rememberme functionality with spring security (3.1.0). I declare the rememberme tag like this: <security:remember-me key="JNJRMBM" user-service-ref="gymUserDetailService" /> As I have my own rememberme service I need to inject that into the RememberMeAuthenticationFilter which I define like this: <bean id="rememberMeFilter" class="org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter"> <property name="rememberMeServices" ref="gymRememberMeService"/> <property name="authenticationManager" ref="authenticationManager" /> </bean> I have spring security integrated in a standard way in my web.xml: <filter-name>springSecurityFilterChain</filter-name> <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> Everything works fine, except that the RememberMeAuthenticationFilter uses the standard RememberMeService, so I think that my defined RememberMeAuthenticationFilter is not being used. How can I make sure that my definition of the filter is being used? Do I need to create a custom filterchain? And if so, how can I see my current "implicit" filterchain and make sure I use the same one except my RememberMeAuthenticationFilter instead of the default one? Thanks for any advice and/or pointers!

    Read the article

  • Getting the source .rst file path in Sphinx extension

    - by Mikko Ohtamaa
    I am writing a Sphinx extension and I need to know the document page source code file system path (.rst file location) to extract some version control system information of it. How can I get this information in my event handler / which event handler I should use? Example: # This package may contain traces of nuts def on_html_page_context(app, pagename, templatename, context, doctree): import ipdb ; ipdb.set_trace() if doctree: print doctree.source def setup(app): app.require_sphinx('1.0') app.connect('html-page-context', on_html_page_context)

    Read the article

  • Expandable listview with selectall checkbox : group itemclick and scrolling bug

    - by Samet
    I have an ExpandableListView with a checkbox next to group name and when expanded, child items with checkbox as well. Let's suppose I have 4 groups with 50 childs. When a group is expanded, and I click on select all checkbox, everything works fine, all checkbox are selected and keep their state if I scroll. But if I scroll untill the last child of the list, scrolling gets buggy after that ( scrolling to the top and then touching the screen to stop the scrolling doesn't work anymore), clicking on group doesn't work anymore too, untill I click on selectall checkbox again. Clicking on a child checkbox does nothing, I must click on selectall checkbox for everything to work. I changed Focusable state of the child checkbox, group checkbox and tried many ways, but I can not find a solution to this. Do you have an idea of where it is coming from?

    Read the article

  • ListView not showing up in fragment

    - by aindurti
    When I insert a listview in a fragment in my application, it doesn't show up after I populate it with items. In fact, the application crashes due to a NullPointerException. Can anybody help me? Here is the detail activity from which I show the fragments. package com.example.sample; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentTransaction; import android.support.v4.app.NavUtils; import android.widget.ArrayAdapter; import android.widget.ListView; import com.actionbarsherlock.app.ActionBar; import com.actionbarsherlock.app.ActionBar.Tab; import com.actionbarsherlock.app.SherlockFragmentActivity; import com.actionbarsherlock.view.MenuItem; /** * An activity representing a single Course detail screen. This activity is only * used on handset devices. On tablet-size devices, item details are presented * side-by-side with a list of items in a {@link CourseListActivity}. * <p> * This activity is mostly just a 'shell' activity containing nothing more than * a {@link CourseDetailFragment}. */ public class CourseDetailActivity extends SherlockFragmentActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_course_detail); // Show the Up button in the action bar. ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // initiating both tabs and set text to it. ActionBar.Tab assignTab = actionBar.newTab().setText("Assignments"); ActionBar.Tab schedTab = actionBar.newTab().setText("Schedule"); ActionBar.Tab contactTab = actionBar.newTab().setText("Contact"); // Create three fragments to display content Fragment assignFragment = new Assignments(); Fragment schedFragment = new Schedule(); Fragment contactFragment = new Contact(); assignTab.setTabListener(new MyTabsListener(assignFragment)); schedTab.setTabListener(new MyTabsListener(schedFragment)); contactTab.setTabListener(new MyTabsListener(contactFragment)); actionBar.addTab(assignTab); actionBar.addTab(schedTab); actionBar.addTab(contactTab); ListView listView = (ListView) findViewById(R.id.assignlist); String[] values = new String[] { "Android", "iPhone", "WindowsMobile", "Blackberry", "WebOS", "Ubuntu", "Windows7", "Max OS X", "Linux", "OS/2" }; // First paramenter - Context // Second parameter - Layout for the row // Third parameter - ID of the TextView to which the data is written // Forth - the Array of data ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, android.R.id.text1, values); // Assign adapter to ListView listView.setAdapter(adapter); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: // This ID represents the Home or Up button. In the case of this // activity, the Up button is shown. Use NavUtils to allow users // to navigate up one level in the application structure. For // more details, see the Navigation pattern on Android Design: // // http://developer.android.com/design/patterns/navigation.html#up-vs-back // NavUtils.navigateUpTo(this, new Intent(this, CourseListActivity.class)); return true; } return super.onOptionsItemSelected(item); } class MyTabsListener implements ActionBar.TabListener { public Fragment fragment; public Fragment fragment2; public MyTabsListener(Fragment fragment) { this.fragment = fragment; } @Override public void onTabReselected(Tab tab, FragmentTransaction ft) { } @Override public void onTabSelected(Tab tab, FragmentTransaction ft) { ft.replace(R.id.main_across, fragment); } @Override public void onTabUnselected(Tab tab, FragmentTransaction ft) { ft.remove(fragment); } } } The fragment that I am currently trying to get working is called the Assignments fragment. As you can see in the CourseDetailActvity, I populate smaple items in the listview to see if it the listview shows up. The fragment gets inflated properly, but when I try to add items to the listview, the application crashes! Here is the logcat. 11-17 11:54:28.037: E/AndroidRuntime(282): FATAL EXCEPTION: main 11-17 11:54:28.037: E/AndroidRuntime(282): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.sample/com.example.sample.CourseDetailActivity}: java.lang.NullPointerException 11-17 11:54:28.037: E/AndroidRuntime(282): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663) 11-17 11:54:28.037: E/AndroidRuntime(282): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679) 11-17 11:54:28.037: E/AndroidRuntime(282): at android.app.ActivityThread.access$2300(ActivityThread.java:125) 11-17 11:54:28.037: E/AndroidRuntime(282): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033) 11-17 11:54:28.037: E/AndroidRuntime(282): at android.os.Handler.dispatchMessage(Handler.java:99) 11-17 11:54:28.037: E/AndroidRuntime(282): at android.os.Looper.loop(Looper.java:123) 11-17 11:54:28.037: E/AndroidRuntime(282): at android.app.ActivityThread.main(ActivityThread.java:4627) 11-17 11:54:28.037: E/AndroidRuntime(282): at java.lang.reflect.Method.invokeNative(Native Method) 11-17 11:54:28.037: E/AndroidRuntime(282): at java.lang.reflect.Method.invoke(Method.java:521) 11-17 11:54:28.037: E/AndroidRuntime(282): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) 11-17 11:54:28.037: E/AndroidRuntime(282): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 11-17 11:54:28.037: E/AndroidRuntime(282): at dalvik.system.NativeStart.main(Native Method) 11-17 11:54:28.037: E/AndroidRuntime(282): Caused by: java.lang.NullPointerException 11-17 11:54:28.037: E/AndroidRuntime(282): at com.example.sample.CourseDetailActivity.onCreate(CourseDetailActivity.java:66) 11-17 11:54:28.037: E/AndroidRuntime(282): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 11-17 11:54:28.037: E/AndroidRuntime(282): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627) 11-17 11:54:28.037: E/AndroidRuntime(282): ... 11 more

    Read the article

  • Flex 4.6 Mobile - Scrolling to the last added item in a dataGrid with variableRowHeight

    - by user1305331
    I'm trying to set the scroll vertical position of a spark dataGrid to show the items as I add them to the grid. I know you can set the scroll position like this: dataGrid.scroller.viewport.verticalScrollPosition = itemPosition*rowHeight; The problem is that the dataGrid have variableRowHeight, as each row word wraps their name labels, and I don't know how to get each row height. I though of getting the itemRenderer associated with every item as I add it to the grid, and keep the total row height value in a variable, but don't know how to achieve that. Is there any way to set the scroll position of a dataGrid with variableRowHeight to show the last added item?

    Read the article

  • How can I prevent the scaling of a UIWebview's content after reorientation?

    - by frankhermes
    I'm building an iOS 5/6 app that has a UIWebView. It loads some HTML that I have embedded in my app. Now when I rotate my device, the WebView changes its size (as I want it to fill the entire width of the screen). And then it gets weird: some content gets scaled up and some content doesn't get scaled up. See this image with some example text in it: As you can see, the header (H6) stays the same, while the paragraph gets scaled up. Does anybody have an idea how to prevent this? I want the html to look the same in landscape as it does in portrait mode. I've tried setting the viewport scaling to 1: <meta name="viewport" content="initial-scale=1.0,max-scale=1.0"> but that doesn't help. The body's font-size style is set to 14px, but changing that to 14pt or a percentage also made no difference. Setting the width of the body to 100% also didn't help. Strangely, removing the line break (<br/>) that's in the text fixes it but I need line breaks to be in there so that's no solution. The only thing that does work is reloading the UIWebView's content after an orientation change, but that doesn't prevent it from looking wrong during rotation, and it resets any scrolling that the user may have done. Any ideas?

    Read the article

  • PHP Array saved to Text file

    - by coffeemonitor
    I've saved a response from an outside server to a text file, so I don't need to keep running connection requests. Instead, perhaps I can use the text file for my manipulation purposes, until I'm read for re-connecting again. (also, my connection requests are limited to this outside server) Here is what I've saved to a text file: records.txt Array ( [0] => stdClass Object ( [id] => 552 [date_created] => 2012-02-23 10:30:56 [date_modified] => 2012-03-09 18:55:26 [date_deleted] => 2012-03-09 18:55:26 [first_name] => Test [middle_name] => [last_name] => Test [home_phone] => (123) 123-1234 [email] => [email protected] ) [1] => stdClass Object ( [id] => 553 [date_created] => 2012-02-23 10:30:56 [date_modified] => 2012-03-09 18:55:26 [date_deleted] => 2012-03-09 18:55:26 [first_name] => Test [middle_name] => [last_name] => Test [home_phone] => (325) 558-1234 [email] => [email protected] ) ) There's actually more in the Array, but I'm sure 2 are fine. Since this is a text file, and I want to pretend this is the actual outside server (sending me the same info), how do I make it a real array again? I know I need to open the file first: <?php $fp = fopen('records.txt', "r"); // open the file $theData = fread($fh, filesize('records.txt')); fclose($fh); echo $theData; ?> So far $theData is a string value. Is there a way to convert it back to the Array it originally came in as?

    Read the article

  • Split a string in python taking care of quotes

    - by santu
    I want to extract key value pairs of some form elements in a html page for example name="frmLogin" method="POST" onSubmit="javascript:return validateAndSubmit();" action="TG_cim_logon.asp?SID=^YcMunDFDQUoWV32WPUMqPxeSxD4L_slp_rhc_rNvW7Fagp7FgH3l0uJR/3_slp_rhc_dYyJ_slp_rhc_vsPW0kJl&RegType=Lite_Home" is there any method using which I can safely get the key and value pairs. I tried using splitting by spaces and then using '=' characters but string inside quotes can also have '='. is there any different kind of split method which can also take care of quotes?

    Read the article

  • Converting a Matrix to a grid of colors

    - by Zach
    I'm currently making a console application in C# (will be going to a Windows Form application in the future. Sooner if needed). My current objective is to have a matrix (current size 52x42) be exported as an image (bitmap, jpeg, png, I'm flexible) where each value in the matrix (0, 1, 2, 3) is portrayed as a white, black, blue, or red square of size 20px x 20px with a grid 1px wide seperating each 'cell'. Can this even be done in a console application, and if so how? If not, what would I need to get it working in a Windows Form application?

    Read the article

  • Division inaccurate in Javascript?

    - by Nate
    If I perform the following operation in Javascript: 0.06120*400 The result is 24.48. However, if I do this: 24.48/400 The result is: 0.061200000000000004 JSFiddle: http://jsfiddle.net/zcDH7/ So it appears that Javascript rounds things differently when doing division and multiplication? Using my calculator, the operation 24.48/400 results in the correct answer of 0.0612. How should I deal with Javascript's inaccurate division? I can't simply round the number off, because I will be dealing with numbers of varying precision. Thanks for your advice.

    Read the article

  • Another boost error

    - by user1676605
    On this code I get the enourmous error static void ParseTheCommandLine(int argc, char *argv[]) { int count; int seqNumber; namespace po = boost::program_options; std::string appName = boost::filesystem::basename(argv[0]); po::options_description desc("Generic options"); desc.add_options() ("version,v", "print version string") ("help", "produce help message") ("sequence-number", po::value<int>(&seqNumber)->default_value(0), "sequence number") ("pem-file", po::value< vector<string> >(), "pem file") ; po::positional_options_description p; p.add("pem-file", -1); po::variables_map vm; po::store(po::command_line_parser(argc, argv). options(desc).positional(p).run(), vm); po::notify(vm); if (vm.count("pem file")) { cout << "Pem files are: " << vm["pem-file"].as< vector<string> >() << "\n"; } cout << "Sequence number is " << seqNumber << "\n"; exit(1); ../../../FIXMarketDataCommandLineParameters/FIXMarketDataCommandLineParameters.hpp|98|error: no match for ‘operator<<’ in ‘std::operator<< [with _Traits = std::char_traits](((std::basic_ostream &)(& std::cout)), ((const char*)"Pem files are: ")) << ((const boost::program_options::variable_value*)vm.boost::program_options::variables_map::operator[](((const std::string&)(& std::basic_string, std::allocator (((const char*)"pem-file"), ((const std::allocator&)((const std::allocator*)(& std::allocator()))))))))-boost::program_options::variable_value::as with T = std::vector, std::allocator , std::allocator, std::allocator ’|

    Read the article

  • use exec for dsadd

    - by Daryl Gill
    I'm Programming on a Windows Server 2008 and I wish to have a WebUI to interact with the domains active directory. One of my main problems is this that i'm using dsadd from a HTML form but this is no succeeding. I know my command is correct, I have tested it out on the Servers Command line My Code is As Below: if (isset($_POST['Submit'])) { $DesiredUsername = $_POST['DesiredUsername']; $DesiredPassword = $_POST['DesiredPassword']; $DU = "{$DesiredUsername}"; // Desired Username $OU = "PHPCreatedUsers"; // Domain OU $DC1 = "slayerserv"; // Domain Part one $DC2 = "local"; // Domain Part Two $PWD = "{$DesiredPassword}"; // Password $ExecScript = 'dsadd user cn=$DesiredUsername,cn=PHPCreatedUsers,dc=slayerserv,dc=local -disabled no -pwd $DesiredPassword -mustchpwd yes'; exec($ExecScript, $output); mysql_query("INSERT INTO addedusers (`ID`, `DU`, `OU`, `DC1`, `DC2, `PWD`) VALUES ('', '$DU', '$OU', '$DC1', '$DC2', '$PWD')"); echo "<br><br>"; print_r($output); # echo "User: $DesiredUsername Has been Created"; } When I print_r($output); it Returns a blank array: Array ( ) Could anyone provide me with a solution or point me in the right direction? ++++ Below is a working example of my usage of exec $Script = 'ping 127.0.0.1 -n 1'; exec($Script, $Output); print_r($Output); print_r($Output); Gives: Array ( [0] = [1] = Pinging 127.0.0.1 with 32 bytes of data: [2] = Reply from 127.0.0.1: bytes=32 time<1ms TTL=128 [3] = [4] = Ping statistics for 127.0.0.1: [5] = Packets: Sent = 1, Received = 1, Lost = 0 (0% loss), [6] = Approximate round trip times in milli-seconds: [7] = Minimum = 0ms, Maximum = 0ms, Average = 0ms )

    Read the article

  • TypeError: unbound method make_request() must be called with XX instance, but how?

    - by Dave
    Running the code below I get E TypeError: unbound method make_request() must be called with A instance as first argument (got str instance instead) I dont want to set make_request method as static, I want to call it from an instance of an object. The example http://pytest.org/latest/fixture.html#fixture-function # content of ./test_smtpsimple.py import pytest @pytest.fixture def smtp(): import smtplib return smtplib.SMTP("merlinux.eu") def test_ehlo(smtp): response, msg = smtp.ehlo() assert response == 250 assert "merlinux" in msg assert 0 # for demo purposes My code """ """ import pytest class A(object): """ """ def __init__(self, name ): """ """ self._prop1 = [name] @property def prop1(self): return self._prop1 @prop1.setter def prop1(self, arguments): self._prop1 = arguments def make_request(self, sex): return 'result' def __call__(self): return self @pytest.fixture() def myfixture(): """ """ A('BigDave') return A def test_validateA(myfixture): result = myfixture.make_request('male') assert result =='result'

    Read the article

  • Connecting Android app to MySQL database

    - by opuhliyvladyslav
    Can somebody help me with question related with MySQL database using? Yesterday i was making app for getting some text data and sending them to database located on remote server! I was making POST request to database and sent few text fields to one table in database. So MY QUESTION IS: "Can I use MySQL directly (not though POST method )? and how to use it ?" (will be so glad to see url to solutions or examples) P.S. when i was sending data to server i have some errors in database fields when sending russian characters (what type of encoding sending from my app to server????)

    Read the article

  • Item index of Binding element

    - by vibeeshanRC
    I am creating a XAML / C# WinRT App and i have a collection of collection and i am binding it to a Grid-view(collections as groups ) Now i have to color the background of the GridViewItem according to their index in the collection (Dark color for the first one and light color for the last one ) How can i implement using a converter. (if there are 6 collections with 10 items all the first item will the dark and the 10 the item will be lighter). Simply: How can i send the item-index property to the converter as a parameter. My XAML <GridView x:Name="Grid1" ItemsSource="{Binding}" ItemTemplateSelector="{StaticResource templateSelector}" SelectionMode="None" > <GridView.ItemsPanel> <ItemsPanelTemplate> <VirtualizingStackPanel Orientation="Horizontal" VirtualizingStackPanel.VirtualizationMode="Recycling"/> </ItemsPanelTemplate> </GridView.ItemsPanel> <GridView.GroupStyle> <GroupStyle HidesIfEmpty="True"> <GroupStyle.HeaderTemplate> <DataTemplate> <Grid Margin="0,0,0,0"> <TextBlock Text='{Binding Name}' Margin="5" /> </Grid> </DataTemplate> </GroupStyle.HeaderTemplate> <GroupStyle.ContainerStyle> <Style TargetType="GroupItem" > <Setter Property="BorderThickness" Value="0"/> <Setter Property="Margin" Value="0,0"/> </Style> </GroupStyle.ContainerStyle> <GroupStyle.Panel> <ItemsPanelTemplate> <VariableSizedWrapGrid/> </ItemsPanelTemplate> </GroupStyle.Panel> </GroupStyle> </GridView.GroupStyle> </GridView> .......... <converters:MyConverter x:Key="templateSelector" Temp1="{StaticResource Temp1}" Temp2="{StaticResource Temp2}" > </converters:MyConverter> <DataTemplate x:Key="Temp1"> <Grid > <Grid> <Grid.Resources> <converters:PanelBackgroundColorConverter x:Name="panelBackgroundColorConverter" Key="{Binding}"/> <Grid.Resources/> <Grid.Background> <Binding Path="MPath" Converter="{StaticResource panelBackgroundColorConverter}" ConverterParameter="sym"/> </Grid.Background> <Grid/> <DataTemplate/>

    Read the article

  • basic file input using C

    - by user1781966
    So im working on learning how to do file I/O, but the book I'm using is terrible at teaching how to receive input from a file. Below is is their example of how to receive input from a file, but it doesn't work. I have copied it word for word, and it should loop through a list of names until it reaches the end of the file( or so they say in the book), but it doesn't. In fact if I leave the while loop in there, it doesn't print anything. #include <stdio.h> #include <conio.h> int main() { char name[10]; FILE*pRead; pRead=fopen("test.txt", "r"); if (pRead==NULL) { printf("file cannot be opened"); }else printf("contents of test.txt"); fscanf(pRead,"%s",name); while(!feof(pRead)) { printf("%s\n",name); fscanf(pRead, "%s", name); } getch(); } Even online, every beginners tutorial I see does some variation of this, but I can't seem to get it to work even a little bit.

    Read the article

  • Mod-Rewrite rules are breaking 404 routing

    - by Sparky672
    I am using the following mod-rewrite in my .htaccess file: RewriteRule ^$ pages/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ pages/$1 [L] The intention is to hide the subdirectory called /pages/ from displaying in the URL. So this: http://mysite.com/pages/home.html Will look like this: http://mysite.com/home.html It works but there are some unintended consequences. As a direct result of the .htaccess code I posted above, my 404 routing is no longer working at all. Anything that should trigger a 404 error page is instead generating a 500 Server Error. How to fix?

    Read the article

  • Freeglut ( OpenGL ) in C

    - by user1832149
    I would like to ask for you a little help in my homework. I'm learning at an university of Debrecen, and I would like to be a programmer, but I'm stuck with this homework. It's a OpenGL project in C. (freeglut) The next task is about: Window to viewport transformation. Draw graphs of functions, as shown below. The individual views (viewport) defines four different rectangles. Functions look like this picture: one window in 4 piece, and one pice of one function. The functions, respectively: f(x)=x2 g(x)=x3 h(x)=sin(x) i(x)=cos(x) Heres a pic what I need to make: How would I approach such a task?

    Read the article

  • How to Global onRouteRequest directly to onBadRequest?

    - by virtualeyes
    EDIT Came up with this to sanitize URI date params prior to passing off to Play router val ymdMatcher = "\\d{8}".r // matcher for yyyyMMdd URI param val ymdFormat = org.joda.time.format.DateTimeFormat.forPattern("yyyyMMdd") def ymd2Date(ymd: String) = ymdFormat.parseDateTime(ymd) override def onRouteRequest(r: RequestHeader): Option[Handler] = { import play.api.i18n.Messages ymdMatcher.findFirstIn(r.uri) map{ ymd=> try { ymd2Date( ymd); super.onRouteRequest(r) } catch { case e:Exception => // kick to "bad" action handler on invalid date Some(controllers.Application.bad(Messages("bad.date.format"))) } } getOrElse(super.onRouteRequest(r)) } ORIGINAL Let's say I want to return a BadRequest result type for all /foo URIs: override def onBadRequest(r: RequestHeader, error: String) = { BadRequest("Bad Request: " + error) } override def onRouteRequest(r: RequestHeader): Option[Handler] = { if(r.uri.startsWith("/foo") onBadRequest("go away") else super.onRouteRequest(r) } Of course does not work, since the expected return type is Option[play.api.mvc.Handler] What's the idiomatic way to deal with this, create a default Application controller method to handle filtered bad requests? Ideally, since I know in onRouteRequest that /foo is in fact a BadRequest, I'd like to call onBadRequest directly. Should note that this is a contrived example, am actually verifying a URI yyyyMMdd date param, and BadRequest-ing if it does not parse to a JodaTime instance -- basically a catch-all filter to sanitize a given date param rather than handling on every single controller method call, not to mention, avoiding cluttering up application log with useless stack traces re: invalid date parse conversions (have several MBs of these junk trace entries accruing daily due to users pointlessly manipulating the uri date in attempts to get at paid subscriber content)

    Read the article

  • Is it ok to perform DB operation on UI thread?

    - by user648462
    I am using a database to persist the state of a search form. I am using the onPause method to persist the data and the onResume method to restore it. My opinion is that restoring and persisting state should be a blocking operation so I plan to perform the database operations on the UI thread. I know this is generally discouraged but the operations should be quick and I think if they were done asynchronously they could lead to inconsistent UI behaviour. Any advice

    Read the article

  • How to get jQuery EasyUI datagrid and treegrid to load in background?

    - by f1r3br4nd
    I am trying build a jQuery EasyUI datagrid or treegrid out of a large query. Apparently the database takes long enough to respond that I get the "a script on this page may be busy" popup. Moreover, the entire browser (Firefox) locks up while it's waiting. I thought the whole point of AJAX was to load stuff unobtrusively. I've looked through the tutorials and documentation for EasyUI but it's not clear to me how to force a datagrid to load in the background. There are some similar unanswered questions asked on the EasyUI forums. Do I need to override the loader property of datagrid? If so, does anybody know where I can get a non-obfuscated version of the default loader function so I can be sure I understand what it's supposed to do before I write my own? Also, if I need asynchronous datagrids and datatrees with sorting and filtering features, is jQuery EasyUI the wrong library for doing this simply and cleanly? Is there some alternative jQuery library people would recommend? Thank you.

    Read the article

  • Is there any way to generate a set of JWebUnit tests from an apache rewrite config?

    - by robbbbbb
    Seems unlikely, but is there any way to generate a set of unit tests for the following rewrite rule: RewriteRule ^/(user|group|country)/([a-z]+)/(photos|videos)$ http:/whatever?type=$1&entity=$2&resource=$3 From this I'd like to generate a set of urls of the form: /user/foo/photos /user/bar/photos /group/baz/videos /country/bar/photos etc... The reason I don't want to just do this once by hand is that I'd like the bounded alternation groups (e.g. (user|group|country)) to be able to grow and maintain coverage without having the update the tests by hand. Is there a rewrite rule or regex parser that might be able to do this, or am I doing it by hand?

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >