instruction_seed
stringlengths
1
35.8k
_source
stringclasses
1 value
Are there any functions (as part of a math library) which will calculate mean, median, mode and range from a set of numbers.
stackexchange/codereview
How we put the condition on list data in Struts2? i have a list which have some string like sportsmen, businessmen, employer, software-engg etc in a single td of a table. i want to check if this list have employer string in a td then next td can display some setting option.
stackexchange/codereview
I have an overflow:auto div with specific max-height. That div contains many items as a list. I try to make a scroll script but seem it missing something. Here is my code: http://jsfiddle.net/UX5cd/6/
stackexchange/codereview
Is it possible to add hotkeys only when you're editing a certain NSTextField? For example, when you're in this text field I would like it if you pressed Command + 1 it inserted one string, and Command + 2 to insert another text string, etc, but only when you're editing that NSText field. I tried adding a keyDown metho...
stackexchange/codereview
I have just setup Sinatra v1.1.0 inside my rails (v3.0.1) app. But I can't invoke any routes that are more than 1 level deep, meaning this works - http://localhost/customer/3, but this one does not work - http://localhost/customer/3/edit and I get a "Routing Error" Here's the Sinatra object class CustomerApp < Sinatra...
stackexchange/codereview
I am working on Scalable font. I wanted to know the specification of .ttf file or contains of .ttf file and how these contains are arranged. Question- Does anybody knows about the basic structure of .ttf file. How to see the contains of .ttf binary file.
stackexchange/codereview
How can i download file from other server and save it at my own using mvc asp.net with c#?
stackexchange/codereview
I am converting videos to flv using ffmpeg.exe through c# and the process gets stuck and the conversion fails if the file size exceeds 14mb. I've tried to run ffmpeg directly through command prompt and it works fine regardless of size. My conversion code is as follows: OutputFile = SavePath + "SWF\\" + WithOutExt + ".f...
stackexchange/codereview
I've been writing a thin wrapper around SQLite using P/Invoke, and I'd like to give it the ability to read statements from file (for bootstraps, etc.). I wrote the following in a file: CREATE TABLE Test (Col1 INTEGER, Col2 TEXT); INSERT INTO Test (Col1, Col2) VALUES (1, 'test1'); INSERT INTO Test (Col1, Col2) VALUES...
stackexchange/codereview
I am building an application at work and need some advice. I have a somewhat unique problem in which I need to gather data housed in a MS SQL Server, and transplant it to a mySQL Server every 15 mins. I have done this previously in C# with a DataGrid, but now am trying to build a Java version that I can run on an Ub...
stackexchange/codereview
Hey guys, how can I tranform the format of datePicker that came to my action params? My actual Date attribute doesn`t accept this"Sun Jan 01 00:00:00 BRST 2006" type, only "2006-01-01 00:00:00.0 " for example. How can I deal with it?
stackexchange/codereview
I know when reading from a location of memory which is written to by several threads or processes the volatile keyword should be used for that location like some cases below but I want to know more about what restrictions does it really make for compiler and basically what rules does compiler have to follow when dealin...
stackexchange/codereview
I have an xslt that I want to add to my jar file when I do the maven build. I read int he documentation you can add stuff in the resources folder, and it will get picked up, but what if I want it to show up in a different folder - how do I make it go there in the jar?
stackexchange/codereview
I am using Session variable throughout in my application and my timeout is 1 hour. Here I need to catch the exception for session expires in any global way across my application. Could anyone help for this. Thanks in advance...
stackexchange/codereview
I want to parse the line as this, S1,F2 title including several white spaces (abbr) single,Here<->There,reply And I want the output as below, 1 2 title including several white spaces abbr single Here22There # identify <-> and translate it to 22; reply I am wondering how to parse the line above? Method 1. I plan ...
stackexchange/codereview
What I want to know is whether it is possible for my program to insert something to a staging table, and have a trigger to run asynchronously on that piece of data. The procedure the trigger is running could be a time consuming process, that's why I wanted to run it asynchronously.
stackexchange/codereview
Accessing a member on Form may cause a runtime exception because it is a field of a marshal-by-reference class I know what this warning is and know how to solve it. My question is why could this cause a runtime error?
stackexchange/codereview
I wanted to do some js analytics, so I would need to know how to get whatever the user entered in the address bar as a js variable so I can know what are the most common misspellings. That way I can make redirects for the most common misspellings to the correct adresses and reduce 404 page requests. example of user inp...
stackexchange/codereview
What's the best way to exclude an array of values from another array? Like if I had a list of values I don't want in a different list? I'm trying not to use reg ex and I don't think it should be an option.
stackexchange/codereview
Is there a proper flow for working with git as a facade for branching on SVN? Meaning that each git branch is mapped to an SVN branch, so that I can use git's wonderful branching tools to help work on svn branches. Edit: I obviously know of the git svn tool. I am inquiring specifically about SVN branch related flows.
stackexchange/codereview
I'm trying to use Forms Authentication to redirect from my login page (https) to my default page (http). <forms name="mysite.com" loginUrl="https://www.mysite.com/Login.aspx" protection="All" defaultUrl="http://www.mysite.com/Default.aspx" requireSSL="false" timeout="30" slidingExpiration="true" cookieless="UseCookie...
stackexchange/codereview
Apparently it is an idiom in JavaScript to implement class based instance methods this way: function MyClass(){...} MyClass.prototype.methodA = function(){...} MyClass.prototype.methodB = function(){...} ... Why aren't people using this less verbose form instead: function MyClass(){...} MyClass.prototype = MyClass; My...
stackexchange/codereview
Let me explain what I am asking for by an example. Imagine I have a class for a car. Now, the car may have a lot of extras: 4 doors instead of only 2 Automatic door locking 4 Wheel drive I want to create the class with any combination of these options. Any of these options needs some data members. Imagine the class n...
stackexchange/codereview
I dont know much makefile stuff I've been tending to learn bits as required. The biggest failing of my makefiles is that I have been listing all the files manually, while this hasn't been a problem my current project is getting unwieldy. I have 4 directories each with sources files. How can I get all the object file li...
stackexchange/codereview
Standard ML OCaml Haskell some other
stackexchange/codereview
Possible Duplicate: Undefined behavior and sequence points #include< iostream.h> int main() { int i=7,j=i; j=(i++,++i,j++*i); cout <<j; return 0; } What will be the output of the C++ code? It's my homework that my professor gave me.
stackexchange/codereview
I'm playing with PhoneGap for the first time. I'd like to do the following: Create a login UI in the file index.html like so: <input id="email"> <input id="password"> <button id="login">Login</button> The UI will appear on an iphone. When user clicks the login button, I want to asychronously authenticate against the...
stackexchange/codereview
In Red Hat, cd /var/lib/tomcat tail -f logs/catalina.out I can see the log in the console. In Ubuntu, cd /var/lib/tomcat6 tail -f logs/catalina.out Nothing show out in the console. May I know what is the problem? Which configuration that I need to look to?
stackexchange/codereview
I have a form with some <button> elements and a normal <input type="submit"> button to submit the form. However, when I press Enter when I'm in a textfield, the form does not get submitted but much rather the first Element is "pressed". How can I change this behavior?
stackexchange/codereview
I want to keep the text selection when the textarea loses the focus. For Internet Explorer and without any jQuery.
stackexchange/codereview
I have an annoying problem when using machine learning library PyML. PyML uses libsvm to train the SVM classifier. The problem is that libsvm outputs some text to standard output. But because that is outside of Python I cannot intercept it. I tried using methods described in problem Silence the stdout of a function in ...
stackexchange/codereview
Is it possible to have conditional breakpoints (without changing anything about the sourcecode) in Vistual Studio 2008 with C++ language? thanks!
stackexchange/codereview
i am using a viewholder to display from a dynamic arrayadapter.it works but the data displayed changes irregularly when i scroll the List.i want my List View to be populated only once ,Not all the time when i scroll my list. Any suggestion? Here is my Code public View getView(int position, View convertView, ViewGroup ...
stackexchange/codereview
I was running the samples from trunk on Source Forge and they are busted so I started debugging the code and found the bug. Then I took a look at the code in master from GitHub and it is totally different(sans bug). Which repository should we be looking at? NServiceBus.com points you to Source Forge, but more activi...
stackexchange/codereview
I'm trying to make my library exportable as a DLL but I'm getting a lot of these warnings for one specific class that uses std::vector: template <typename T> class AGUI_CORE_DECLSPEC AguiEvent { typedef void (*AguiCallbackFptr)(T arg, AguiWidget* sender); std::vector<AguiCallbackFptr> events; public: void call(...
stackexchange/codereview
I need to create rectangles that are rotated around their center (so they don't need to be parallel to the axes of the coordinate system). So basicelly each rectangle can be defined by center-X, center-Y, width, height and angle. What I want to do then is to perform calculations on whether certain points are contained ...
stackexchange/codereview
I'm currently working on a quote retrieval system for my employer's website using mysql/php/html. They currently use a pricing matrix in the form of a two way table with height and width along each axis in a spreadsheet that lets you look up price. My question is what's the best way of manipulating this matrix into a ...
stackexchange/codereview
..\..\..\ConnectionInterface\ConnectionInterface.vbproj I mean the "..\" Because I am reading up a .sln file as a text file to get all the projects in that solution and the problem is this projects inside where in different directories or level. Here is an example ..\..\..\ConnectionInterface\ConnectionInterface.vbproj...
stackexchange/codereview
I need to consume a WCF webservice via SOAP under Android. I am doing this by using KSOAP2.5.2. Now as we are not allowed to edit the WCF in any way, I am currently not able to change the output which the WCF service returns. That is my main problem. To solve the problem, I need to take what I get from the WCF (workaro...
stackexchange/codereview
Can anybody recommend a class library or a design pattern that models amounts of Money? I guess it should support: multiple currencies a mechanism to indicate the number of decimals math (respecting certain rounding conventions (cfr ie. Banker's Rounding)) serialisation to and from a String representation ... ? I.e....
stackexchange/codereview
I have this code to configure a cell for Core Data: Code: - (void)configureCell:(UITableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath { NSManagedObject *managedObject = [self.fetchedResultsController objectAtIndexPath:indexPath]; cell.textLabel.text = [[managedObject valueForKey:@"data"] description]; }...
stackexchange/codereview
Greetings, It's a general SQL question not tied to any specific implementation but more on global concepts. Let's take a simple example, I have 2 tables: User (with FK on Group) Group Why when doing DROP TABLE group, user; the server can't infer tables dependency and reorder table names internally to do a successful ...
stackexchange/codereview
I was wondering how to create a shortcut in python to .pyw extensions and .exe's.
stackexchange/codereview
I'm wondering if there's a command in Vim I'm missing that does columnar motion. What I'm thinking of is common in some spreadsheets, where there's a key combination that will take you downward in the column to either the next blank cell, or if you're in a blank cell then it will take you to the next non-blank cell. ...
stackexchange/codereview
Does anybody know of a way to stream audio from a file being played back in an app over the internet in a standardized streaming audio format? That is server up an Audio stream from the iPhone.
stackexchange/codereview
I have an issue with floating divs. I have a container st to fixed width, and I have child elements inside that which are all div elements. What I want is that, I need two elements to be shown in a row. The code that I wrote is as follows. CSS #container { width: 400px; } .item1 { width...
stackexchange/codereview
I just ran into an issue where my code was parsing xml fine but once I added in a second node it started to load incorrect data. The real code spans a number of classes and projects but for the sample I've put together the basics of what's causing the issue When the code runs I'd expect the output to be the contents of...
stackexchange/codereview
so I've got this little Text widget with a scroll bar and I've got a question. How do I make text in this Text widget a variable ? If I made this text a variable I would be able to open a text file and edit it's text or save the text I've written, etc or maybe it's a wrong way that I'm approaching this, is there a bett...
stackexchange/codereview
I am trying to implement remote client validation to check if a username has already been taken. I have read phil haack's post and a msdn article and come up with the following implementation: public class RemoteAttribute : ValidationAttribute { public string Action { get; set; } public string Co...
stackexchange/codereview
I got a simple javascript-file, wich my users need to include on their website for example. I want to detech if the snippet is include or not. The way I'm going to detect it, is by using a unique key in the js-file, for anyone who needs to know. Been searching a lot for this, but haven't come up with any results yet.
stackexchange/codereview
I already have the site with parameters in the url. now i am thinking to do the clean url for the users to avoid the parameters in the url. I studied about the .htaccess rules(mod rewrite) but one thing i don't understand is, do i need to change the url's in all the places so that rules in htaccess will work? I feel th...
stackexchange/codereview
I am new to detailed Javascript with AJAX and PHP, and have been doing a lot of reading, and mostly trial-and-error at this stage, but I have run into a situation that I am not finding the Javascript and Ajax information that is pushing me in the right direction, thus I generate some bad code. I have 2 Solar Inverters ...
stackexchange/codereview
I have 3 checkboxes and 1 textbox i use only these controls mentioned above .. I want ---- when i check checkbox1 and checkbox2 then it will display in textbox1 as 1,2 as it is as the same ascending order not 1,2, or 2,1, I use this type of coding in asp.net (VB) , i wanna use this coding for 45 checkboxes........ Can ...
stackexchange/codereview
I have a number. I then have an if statement that I want to go like this: if (5 <= variable <= 10) So if the number is between 5 and 10, the statement should be true. What's the best way to go about this? Thanks.
stackexchange/codereview
Here is the general algorithm I wish to implement in R: if (x[i]>y[i]) x[i] = y[i] x and y are of course vectors. This problem looks like a loop is the solution.
stackexchange/codereview
I am trying to write a PHP script that will perform the following: Extract all files from an archive in a given directory (using the exec function to actually run 7z) List all the files that are images (jpg, jpeg, gif, png) and store them in an array (using exec again to run "ls" and storing only the images in the arr...
stackexchange/codereview
My question is related to Prasoon's question about non POD types and value initialization. I tried the following code on online compilers like Ideone and Codepad but the executables gave runtime error on both the sites. #include <iostream> #include <cassert> struct Struct { std::string String; int Int; boo...
stackexchange/codereview
Can anyone recommend a really advanced book on asynchronous programming in JavaScript? Something that assumes the reader already knows how to do things in JavaScript, but is looking for in-depth analysis on finding the best way. Something that's not about performance tweaks and hacks, but a serious book on architectu...
stackexchange/codereview
How can an AttachedProperty which is a single property defined by an owning parent element, be set with multiple values through several child elements of that parent? For example: If I have: <DockPanel> <CheckBox DockPanel.Dock="Top">Hello</CheckBox> <CheckBox DockPanel.Dock="Bottom">World</CheckBox> </DockPanel> ...
stackexchange/codereview
Is there any way to customize the border color of a Tkinter/ttk widgets or frames?
stackexchange/codereview
Within an SQL stored procedure, I would like to have the ability to construct a table name and create it. Example: I just logged into my database under company 03 and a customer table does not exist, so I would like for the proc to CREATE TABLE CUSTOMER03. Is there a way to append company_id char(2) to CUSTOMER and f...
stackexchange/codereview
I want to leanr typing on computer. Which is the besy way to learn that and rougly how much time it takes learn just normal speed so that i don't have to look at keyboard everytime i type somethng
stackexchange/codereview
I'm trying to write a web service using spring web service library. I'm able to configure my endpoints successfully and it is working fine, but I'm facing some issues with the exception mappings. I'm able to map exceptions using @SoapFault and SoapFaultAnnotationExceptionResolver but the wsdl definition is as follows <...
stackexchange/codereview
I am referring to this post from Phil Haack http://haacked.com/archive/2008/10/23/model-binding-to-a-list.aspx I need to do the same but what if I need to insert records in the list, at any index I wanted? How do I keep the indexes in sync short of doing some Javascript and updating all indexes? <form method="post" ac...
stackexchange/codereview
Hi i'm a newbie in php programming. Im curious to know which framework is better, cakephp or sapphire? And which framework is very close to the ruby on rails style? I have searched around the web, but a definite comparison between the two is not available. Thanks in advance :)
stackexchange/codereview
If I didn't know that the sleep method on java.lang.Thread was static, how could I find out?
stackexchange/codereview
1) I understand that when you're converting binary to decimal the left most bit represents 0, 1...so on. So for example to convert 0001 to decimal it is 0*2^0+0*2^1+0*2^2+1*2^3 so the decimal value would be 8. 2) When for example you have signed hex 0x80 which will be converted to binary 1000 0000 however in order to ...
stackexchange/codereview
Another interesting interview question that I stumbled upon - Design the data structures for a very large social network (Facebook, LinkedIn, etc)? Also, design an algorithm to show the connection, or path, between two people (e.g. me->foo->bar->rob->ron)
stackexchange/codereview
I have a complicated algorithm that updates 3 histograms that are stored in arrays. I want to debug my algorithm, so I was thinking of showing the arrays as histograms in a user interface. What is the easiest way to do this. (Rapid application development is more important than optimized code.) I have some experienc...
stackexchange/codereview
I am using a package that has a method call that is non-static. It will not let me call this method from a static context. I can't change the non-static method, how can I call this method?
stackexchange/codereview
For example I have one class mapped to a table in first database and the second class mapped to a table in the second database. I would like to use them simultaneously in one application. I have a datasource bean defined in my dispatcher-servlet.xml <bean id="dataSource" class="org.springframework.jdbc.data...
stackexchange/codereview
This works fine: jQuery('#my_get_related_keywords').click(function() { if (jQuery('#my_keyword').val() == '') return false; jQuery.getJSON("http://boss.yahooapis.com/ysearch/web/v1/" +jQuery('#my_keyword').val()+"?" +"appid=myAppID" +"&lang=en" +"&format=json" +"&coun...
stackexchange/codereview
This is a followup to Multi-dimensional char array (array of strings) in python ctypes . I have a c function that manipulates an array of strings. The data type is static, so this helps: void cfunction(char strings[8][1024]) { printf("string0 = %s\nstring1 = %s\n",strings[0],strings[1]); strings[0][2] = 'd'; //this ...
stackexchange/codereview
I am attempting to use the 'Fix' command found in the 'Run' menu in Xcode to modify my running code without having to rebuild. I have read apple's documentation on it but following their 'typical fix-and-continue workflow:' (http://developer.apple.com/library/mac/#documentation/DeveloperTools/Conceptual/XcodeDebugging...
stackexchange/codereview
I wrote this code to hook API functions by changing the address in the IAT and EAT: http://pastebin.com/7d9N1J2c This works just fine when I want to hook "recv" or "connect". However for some unknown reason when trying to hook "gethostbyname", my hook function is never called. I tried to find "gethostbyname" in a debug...
stackexchange/codereview
I want to manually write my rss and use it to import posts into several blogs i have <item> <title>testin</title> <description>hello</description> <custom field???? </item> How to add a custom field to be seen by wordpress? Is there a free soft which i can use to write rss quicklier? TY!
stackexchange/codereview
I have the following html - no matter what i do I cant seem to get the middle div to appear on top of the top and also on top of the bottom. It sits fine above the top but where i'd be expecting the bottom to sit below the middle the bottom actually sits on top. Any ideas ? Jsfiddle link below also .. thanks in advance...
stackexchange/codereview
I have a global pointer to a memory mapped device initialised as follows: volatile char *base_address = (char *) 0xa0000000; During program execution I have a switch statement, and depending on the input the base_address pointer has to be adjusted as you can see below: switch (input) { case 'S': b...
stackexchange/codereview
Hello everyone I have converted a project in C# to F# that paints the Mandelbrot set. Unfortunately does it take around one minute to render a full screen so I am try to find some ways to speed it up. It is one call that take almost all of the time: Array.map (fun x -> this.colorArray.[CalcZ x]) xyArray xyArray (doubl...
stackexchange/codereview
Problem: There are searches that can be stored in the DB. Each search has a collection of filters. Also there are roles. Each role may have (nullable column) a default search assigned to it. Also, each search is visible to zero or many roles (many-to-many relationship). When I try to access the search filters, NH tries...
stackexchange/codereview
Is it possible to develop an addon/plugin in opera mobile like greasemonkey which will load users script when a web page is loaded every time?
stackexchange/codereview
I have several linked pages I want to display in a modal iframe. The pages are not the same size and I want to be able to resize the iframe when each new page is loaded. I have looked at several jquery plugins to create the iframe, but can't figure out how to resize any of them. I am currently experimenting with pretty...
stackexchange/codereview
I want to have a standalone network (no internet access) for testing. Is there any way to spoof the APNS servers to test notifications and MDM. Is there a way to create your own APNS server.
stackexchange/codereview
In my project I need to use the Google Maps API to place users on the map. Are there any libraries to enhance the user experience working with Google Maps? I already noticed Flutster.
stackexchange/codereview
I am using nyroModal to show a modal window. It works fine when the initial content is showed. But in the content I have a jQuery toggle method, that makes visible other sections. I want the modal to auto resize to the new content area. How can I implement that.
stackexchange/codereview
I have this $("#xt1").datepicker({ dateFormat: 'dd-M-yy' }); statement for the datepicker in Jquery with this statement user can enter some value for the date in the text field where as with this statement $("#xt1").datepicker(); user cannot enter any value in to the Text field . How can we format the date and ...
stackexchange/codereview
After trying to import the basic Java runtime library rt.jar with language-java-classfile, I've discovered that it uses huge amounts of memory. I've reduced the program demonstrating the problem to 100 lines and uploaded it to hpaste. Without forcing the evaluation of stream in line #94, I have no chance of ever runnin...
stackexchange/codereview
I have a class that contains a pointer to a constant VARIANT value outside the class, but sometimes I want to change this pointer to refer to a VARIANT member object of the class itself. Most instances of this class will be const, so I have to declare the pointer as mutable. In Visual C++ this code seems to do what I w...
stackexchange/codereview
it is a silly Q for most of u - i know - but i one of the beginner here, and I can not understand why the output in here are 12 what does this (x--) do to the result ? int x, y; x = 7; x-- ; y = x * 2; x = 3;
stackexchange/codereview
I need to display a dollar value with the following requirements. If the value is less than a dollar, place a leading zero. e.g 0.55 If the value has no cents, place two trailing zeros. e.g. 100.00 Here's the tricky part. The value may be less than a cent, in which case it should be printed as-is. e.g 0.005 Is it pos...
stackexchange/codereview
I've got my application working great, however I'd LOVE to be able to have it validate completely on W3. My problem is quite simple. I'm using the Bing JS API to attach a Bing Map to a Div tag. Within that Div tag, I have a <noscript> element that calls the MultiMap static map provider IF javascript is disabled. The...
stackexchange/codereview
I'm building a simple weight log, where there'a table that display the user's progress. I'm using Codeigniter. <?php foreach($logs as $log) : ?> <tr> <td><?php echo $log->date ;?></td> <td><?php echo $log->weight ;?> kg.</td> <td><!-- variation between this record and previous record...
stackexchange/codereview
I've seen this effect before, where everything is blurred except the front most object in the shot. it was possibly a flash or flex effect which worked in realtime with video and snapshots. can anybody shed some light as to what this effect was called or point to some resources? thanks! UPDATE: So it was the microso...
stackexchange/codereview
For example, code below, the arrow pointing two part, can the second one use the result from the first one, instead of querying the database again? CREATE PROCEDURE GetInforEntries (@Count as int) AS BEGIN SELECT TOP (@Count) * from Table_Entries where Retrived IS NULL <---- ...
stackexchange/codereview
What I want to do is build a simple bot which sends me a set of information stored in database to my messanger chat window [Chatting services are gTalk, Yahoo and other commonly used chating products] Also, it should be capable of accepting few predefined commands and replying them. Is there any opensource code availab...
stackexchange/codereview
Where can I tell scintilla to recognize different keyword sets ? I want to color them differently, just like notepad++ does.
stackexchange/codereview
I installed Scala 2.8 and NetBeans 6.9 on Fedora 14 (64-bit) by using repository versions (yum install scala netbeans). Then I downloaded Scala 2.8 plugin for Nb6.9 from source-forge. I installed it successfully by using Tools --> Plug-ins menus from NetBeans. But now problem. When I start Scala project and try to com...
stackexchange/codereview
i am not very familiar with android coding so try to help me on a easy way. The problem: I have 2 Listviews and a onClick event handler. How can i find out on which listview the user currently clicked? public void onListItemClick(ListView l, View v, int position, long id) { 'Approach: if listview1 is clicked then FUNCT...
stackexchange/codereview
I would like to know if there is a way to prevent an html page with jQuery or javascript to be modified by the user to change its behavior. A user can modify it using tools such as FireBug or the Google Chrome developer bar to hide or show divs, add event listeners to page elements and so on. I've seen some web pages s...
stackexchange/codereview
The short question is: how can a subpage's <% content_for :title do 'Showing product' end %> set the :title for the main layout? details: We can use in the application layout application.html.erb <title><%= content_for :title %> ... <%= yield %> and I think yield returns the content for a subpage, such as from s...
stackexchange/codereview