instruction_seed
stringlengths
1
35.8k
_source
stringclasses
1 value
Here is what I am trying to do. From my Android App code I do an HTTP POST which is as below HttpPost httppost = new HttpPost("http://xyz.com/Retrieve.php"); The PHP code is supposed to send back an image and an URL. $q=mysql_query("SELECT image, url FROM testblob WHERE id = 'id[0]'"); list($data) = mysql_fetch_row($q...
stackexchange/codereview
Some hyperlinks on my page have reasone to be enabled only when an element is selected inside a grid control. I have the chance to injects some code when a row is selected on the page and I would like to enable/disable these hyperlinks using jquery code. Any advice?
stackexchange/codereview
Hi everyone this is sabby. I am getting the data from a webservice and saving that data in sqlit3 database in iphone.I used the data type of video url as blob,but its not saving in database.But if i use the varchar then url is saved in database. Just help me for this ,as i am new to iphone development. Thanks everyone
stackexchange/codereview
suppose I have the string test '\\u0259' Note the escaped backslash. How do I convert it to the respective unicode string?
stackexchange/codereview
I am trying to serialize an object that contains an EventArgs object. If I ignore the EventArgs object upon serialization, everything works fine, but if I don't put an [XmlIgnore] above it, the application crashes with the error message System.InvalidOperationException was unhandled Message=There was an error generat...
stackexchange/codereview
I'm running maintenance on a database program with no foreign key constraints, even though it really should have... There is a Logging table which has a ParentID column, and a ParentType column. The entry in the ParentType column determines which table ParentID references. What I'm looking for is for ideas on the best ...
stackexchange/codereview
This is what i want to do: @MyDecorator def f(): pass for d in f.decorators: print d
stackexchange/codereview
I'm writing a simple frontend in Python to play and record internet radio channels (e.g. from shoutcast) using mplayer (in a subprocess). When a user clicks a station the following code is run: url = http://77.111.88.131:8010 # only an example cmd = "mplayer %s" % url p = subprocess.Popen(cmd.split(), shell=False) wa...
stackexchange/codereview
I'm setting up a program to connect my computer to our schools proxy and currently have something like this: import subprocess import sys username = 'fergus.barker' password = '*************' proxy = 'proxy.det.nsw.edu.au:8080' options = '%s:%s@%s' % (username, password, proxy) subprocess.Popen('export http_proxy=' +...
stackexchange/codereview
I'm storing JSON down as blob/text in a column using MySQL. Is there a simple way to convert this into a dict using python/SQLAlchemy?
stackexchange/codereview
What package should I use and what would a "hello world"-level program look like?
stackexchange/codereview
Good afternoon In Visual Studio 2010 I am able to add to my solution a new item called in AJAX-enabled WCF service. That will add a new a .svc file. Later, I have created a method just for debugging purposes: [ServiceContract(Namespace = "")] [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequi...
stackexchange/codereview
What are the general use cases for the C++ standard library containers? bitset deque list map multimap multiset priority_queue queue set stack vector For example, a map is generally better for a paired search.
stackexchange/codereview
If I have a large table with a column which has a rather limited range of values (e.g. < 100), is it reasonable to divide this table into several tables with names tied to that column value? E.g. a table like with columns: table "TimeStamps": [Id] [DeviceId] [MessageCounter] [SomeData] where [DeviceId] is the "limited...
stackexchange/codereview
When implementing a class with multiple properties (like in the toy example below), what is the best way to handle hashing? I guess that the __eq__ and __hash__ should be consistent, but how to implement a proper hash function that is capable of handling all the properties? class AClass: def __init__(self): sel...
stackexchange/codereview
I want to create a web application using visual studio to implement a client/server. The server program will be a simple console application that waits for a connection from the client. The client will be a web application. I have look at Silverlight but that would require the client side to download the silverlight...
stackexchange/codereview
I need the pseudocode for a C++ that will search through a tree to find the node with the value of “z”. the function is given the root node to the tree to begin with. The tree has the property where each node has at most two children nodes. Each node has 3 properties: left child, right child, and value.
stackexchange/codereview
I wand to replace URLs like www.example.com/profile/USERNAME by [user]USERNAME[/user] BBCode! $userURLSearch = "#((https?|ftp)://|www\.)example\.com/profile/([A-Za-z][A-Za-z0-9_-]+)(?!/)#i"; $userURLReplace = "[user]\\3[/user]"; $text = preg_replace($userURLSearch, $userURLReplace, $text); But it also transforms URLs...
stackexchange/codereview
I'm trying to control the behavior of components in my Flash Library using a .as file class, but it doesn't seem to be working. For example, if I have a Button in my library called exampleBtn and attempt to do this in the .as file: exampleBtn.visible = false; ... nothing happens. The button is still visible in my app...
stackexchange/codereview
When using the ArrayResolver, if I register multiple implementations of an interface and a class that depends on an array of said interfaces, I expect the array resolver to inject all the interface implementations that can be successfully resolved. If a registered implementation of that interface cannot be resolved, i...
stackexchange/codereview
Imagine this scenario: Alice and Bob both clones a central master Mercurial repository, containing 1 text file Both Alice and Bob makes a change to the same line in the file, and commits Bob pushes back to the central repository, but not Alice Alice now pulls into her repository, notices she now has two heads, and mer...
stackexchange/codereview
I just ventured into writing my first socket based programs in Delphi 2010. I tried with Indy, no success, just even writing a simple client and server that could send packets. Then I used TTCPServer and TTCPClient, same results using the following 'simple as it gets' demos :- Emmbercadero TTCPServer demo Emmbercadero ...
stackexchange/codereview
Typically the model for ORM's that I've used goes something like this: Program startup: Initialize ORM db connection While running: make/modify/delete domain objects, commit changes, rinse and repeat. Program shutdown: commit any uncommitted changes if necessary, disconnect ORM db connection What if someone is sniffing...
stackexchange/codereview
I am developing an Android application and I need to retrieve the Google account used on the phone. I want to do this for the C2DM, but I don't want to ask the user to enter in his/her Google email account if they are already logged in. Is there any way to do it?
stackexchange/codereview
I'm getting a 'File does not exist' error. In my ASP.NET app. This is a strange one, though. Firstly, there is no file IO code anywhere around - I'm not doing anything with any files when it occurs. Also, it's happening on the very last closing curly brace of the Application_Error() method in global.asax (that's the o...
stackexchange/codereview
TL;DR: Need help calling a rule with a fact I´ve started out with Prolog, coming from C and got stuff working... until they evidently got broken. I´m writing a small car-paint program for myself as I´m learning this new language I'm trying to call a rule with a fact (is this possible?), what I want to do is use one fac...
stackexchange/codereview
I'm very new at using JS and AJAX. Currently I'm working with Google Maps API and I need to store some locations (lat,long) to the server. What I want to do is store some sort of data in my existing MySQL database in server. I have got some good example as well like the following- http://www.tutorialspoint.com/ajax/aja...
stackexchange/codereview
I can figure out why this simple code would not compile. May be fresh eyes will see what I am missing. <table> <tr> <th></th> <th><%=h "Name <Email>" %></th> <th>Role</th> </tr> <% project.participations.each do |participation| %> <tr> <%= div_for(participation) do %> <td>some stuff</td>...
stackexchange/codereview
I have a table that is quite modest in size at the moment but will grow to a few million rows so I’m looking to build things right from the start. The table contains 15 or so column containing information for agent telephony performance but that is not really relevant. One of the queries that is run on this table looks...
stackexchange/codereview
(In Python 3) I have dictionary old. I need to change some of its keys; the keys that need to be changed and the corresponding new keys are stored in a dictionary change. What's a good way to do it? Note that there may be an overlap between old.keys() and change.values(), which requires that I'm careful applying the ch...
stackexchange/codereview
If my JSON data-file comes from a database result set and that result set is empty, how do I tell OFC2 to display an error message, instead of crashing because of a malformed JSON string?
stackexchange/codereview
Sorry, if question is too obvious — does Drupal 6 index nodes with custom content types, not only story, page, etc.?
stackexchange/codereview
I need to make a Rails form that responds back to the user live as they input fields. Specifically, the user will need to input four decimal fields representing data from some tests our company runs. The problem is that the testers often input incorrectly (leave out a digit, or hit a '4' instead of a '1', etc). This i...
stackexchange/codereview
I am looking for a clean way to do the following using XSLT. Convert this source: <para>blah blah</para> <list>num1</list> <list>num2</list> <list>num3</list> <para>blah blah</para> <list>num1</list> <list>num2</list> <para>blah blah blah blah blah</para> To this output: <p>blah blah</p> <ol> <li>num1</li> <li...
stackexchange/codereview
OpenSSL documents state that it can safely be used in multi-threaded applications provided that at least two callback functions are set, locking_function and threadid_func.... I've written programs which use OpenSSL API. Moreover, I know how to use pthreads. However, the OpenSSL documents are written in the form of a m...
stackexchange/codereview
I have one modal dialog in my application that works very nice. I do setup and open of the dialog with the following functions $(document).ready(function () { $("#__gsl_DialogPanel").dialog({ autoOpen: false, resizable: false, position: 'center', stack: true, height: 'auto', ...
stackexchange/codereview
Can you use oAuth to only authenticate like you can with Twitter?
stackexchange/codereview
is there a way to get emails from google, send emails, and add contacts to the address book using the google API? I'm doing an obj-c mac application.
stackexchange/codereview
I'm trying to write a regex in php that in a line like <a href="mypage.php?(some junk)&p=12345&(other junk)" other link stuff>Text</a> and it will only return me "p=12345", or even "12345". Note that the (some junk)& and the &(otherjunk) may or may not be present. Can I do this with one expression, or will I need mor...
stackexchange/codereview
Consider something like... for (int i = 0; i < test.size(); ++i) { test[i].foo(); test[i].bar(); } Now consider.. for (int i = 0; i < test.size(); ++i) { test[i].foo(); } for (int i = 0; i < test.size(); ++i) { test[i].bar(); } Is there a large difference in time spent between these tw...
stackexchange/codereview
I need to unzip a .ZIP archive. I already know how to unzip it, but it is a huge file and takes some time to extract. How would I print the percentage complete for the extraction? I would like something like this: Extracting File 1% Complete 2% Complete etc, etc
stackexchange/codereview
My database looks like (pligg cms, sample data) id catID parentID catName 1 1 0 location 2 2 0 color 3 3 1 USA 4 4 3 Illinois 5 5 3 Chicago 6 6 2 Black 7 7 2 Red Let say, how do I get top parentID of chicago, it...
stackexchange/codereview
I have this query: SELECT groups.name categories.name, categories.label FROM groups JOIN categories ON (categories.group1 = groups.id OR categories.group2 = groups.id) AND groups.label = :section AND categories.active = 1 Now, this is my JOIN using Zend_Db_Select but it gives me arr...
stackexchange/codereview
Can any one suggest me a Best IDE for C programming ( With auto completion feature)?
stackexchange/codereview
What is the syntax for adding an element to a scala.collection.mutable.Map ? Here are some failed attempts: val map = scala.collection.mutable.Map map("mykey") = "myval" map += "mykey" -> "myval" map.put("mykey","myval")
stackexchange/codereview
I have a UITableViewController fetching a collection of objects A with a NSFetchedResultsController. This works well and if these objet A's properties are updated, the UITableViewCell for A reflects the change. The problem: this object has a relationship A->[B1, B2, B3...]. The cell is using some of the B's properties...
stackexchange/codereview
I have the need to capture a time and time zone from users of a rails 2.3.8 app, but have been unable to think of a clean solution to create and parse the selections. Ideally I would have a drop-down menus for the following: hour (1-12) minute (0-59) AM/PM Time Zone Is there a gem/plugin that accomplishes what I am l...
stackexchange/codereview
I have two list objects in request. Now I want to use them in jsp page by the following approach: <c:forEach items="${listA}" var="A"> <tr><td>${A.propA}</td><td>${listB[A.index].propB}</td> </c:forEach> Is that possible? Thanks I got the correct approach: <c:forEach items="${listA}" var="A" varStatus="status"> <tr><t...
stackexchange/codereview
I m trying to use 2 comboboxes to display coursecodes for my studenthandler program. My Question is why the both the comboboxes are updated to my selected item when I select something in the list. I m loading my comboboxes in the constructor and both the list are beeing loaded just fine, but when i run the program an...
stackexchange/codereview
I need to query current domain controller, probably primary to change user password. (P)DC name should be fully qualified, i.e. DC=pdc,DC=example,DC=com (how to properly name such notation?) How can it be done using C#?
stackexchange/codereview
after scanning stackoverflow I stil could not find a good answer to a simple question: you want to develop a SaaS business app that has all the typical features: reports, forms, user administration etc. You don't want a CMS but develop it from scratch. what technologies would you choose? at first glance, many of you wo...
stackexchange/codereview
I am beginning to learn crypto algorithms and I understand how the above mentioned algorithms work. Is it that the key length of AES is longer? Which steps of AES encryption makes it less vulnerable than DES?
stackexchange/codereview
I'm using a Django app to export a string to a CSV file. The string is a message that was submitted through a front end form. However, I've been getting this error when a unicode single quote is provided in the input. UnicodeEncodeError: 'ascii' codec can't encode character u'\u2019' in position 200: ordinal not...
stackexchange/codereview
How come Eclipse compiles my project (automatically) without errors, but when I run Ant build.xml -> compile target, the build fails with compile error: <MyClass> is not abstract and does not override abstract method <someMethod> I understand this error message, but it seems not to be true, because 1) Eclipse shows no...
stackexchange/codereview
I am writing (hand written) recursive descent parser for SQL select statement in c++, i need to know whether the parse tree created by me is correct or not. I want to check but i didn't get a good sources for sql parse trees. My way of approach is - writing a function for each production and in that function the resul...
stackexchange/codereview
I'm trying the technique graham has shared on this topic (http://j.mp/cy6IRR) and I know I'm doing something super bonehead here. I'm hoping to get some help from someone that's successfully dealt with this Cufon issue. I'm seeing the flicker in all browsers it seems. Cufon JS Call in function initCufon() { Cufon....
stackexchange/codereview
I have a lsit view and i that i need to add some text. in the adapter, I need to append ... at the end and i used the following when i give android:ellipsize="end" in the only shows 2 line eg: asdnfsdfdsf asdfsdfasdf sdfsd sdfsdf sdfsd ad... And when i give android:ellipsize="start" it is as : asdnfsdfdsf asdfsd...
stackexchange/codereview
i have a problem with float divs. i try everything, i search everywhere but i cannot find (maybe i use wrong keywords to search, i dont know) here is the codes: <div class="mbody"> <div class="mheader"> header content </div> <div class="mmenu"> menu content </div> <div class="mcontent"> <div class="content-right"> ...
stackexchange/codereview
I am creating an event with g_timeout_add or g_timeout_add_seconds which returns an event id; I can cancel the event by calling g_source_remove. However, at some point what I would like to do is see how much time is remaining until the event is fired. Is there a simple way to do this with the glib api, or do I need to...
stackexchange/codereview
I know this is something easy but I just can't see it. Can anyone tell me why I am getting the error "missing } after property list" for the following code: var $newCandleDialog = $('<div></div>') .load('/prodash/dash_access.php?urlInit=candles/getCanStatus.php','it='+newData) .dialog({ auto...
stackexchange/codereview
Say you've got a UITextView populated with a chunk of text. When a user taps on a word within the text I want the app to copy (retrieve the string) that word immediately. In your knowledge, is there any practical way to do this? Side note: I looked at UIPasteboard and all that but it is NOT what I'm looking for as it ...
stackexchange/codereview
How to change the Delphi 2009 Build configuration? The only place I see is on top of the Project Options window, anyway I don't feel that the options are applied.
stackexchange/codereview
My script is supposed not to let the HTML form be submitted unless a user enters some data into a textarea control. However, the form gets submitted anyway and no message for the user is displayed. Could anyone see what I'm doing wrong? Here is my HTML: <textarea name="description" id="description" rows = "4" cols = "2...
stackexchange/codereview
I'm trying to troubleshoot a logout function for a web app. When you're logged in, the app has several cookies set for its domain. Here's the current logout procedure: You click a link, which sends you to a logout page The logout page runs a function that calls session_destroy() and also loops through all the cookies ...
stackexchange/codereview
I am attempting to create a Facebook IFrame Application using the Facebook Developer's Toolkit (language I'm using is VB). No matter what I do, I cannot get past this error message from Facebook. App may not request permissions that do not apply to all profiles in the selector I have tried dropping a CanvasIFram...
stackexchange/codereview
I am using SSIS with SQL Server 2008 R2. I am importing large-ish text files (approx 0.5 Gb), and these files use double quotes as a text qualifier, and the comma as a field delimiter. Many of the files have text qualified fields and include a comma between the terminating double quotes. SSIS should interpret this is...
stackexchange/codereview
i have a problem with this jquery, in the success function call, its mean to remove the `support' button, and fade in the msg, this is my jquery code: $('.stats').delegate('.against', 'click', function(e) { //stop event e.preventDefault(); // cache a reference to the previous <li> element //...
stackexchange/codereview
When I do http POST request via Web form, Is there any difference(practically or theoretically) between parameters specified in the URL and parameters passed with form on the server side? Can I do whole POST with url parameters and expect same result as with form inputs? Like: <form action="/?id=2" method="post"> ...
stackexchange/codereview
I am developing an asp.net page/application. I have created a textbox that i set as a datepicker using the datepicker from jqueryui. in firefox and chrome the datepicker does not render. in IE9 the date picker renders if i ignore the error. the error is at line 644 in jquery.ui.datepicker.js. the code where the e...
stackexchange/codereview
I'd been reading up on implementing ajax with jquery. Am I right to say, $.ajax() is the only function we ever need? ie. we don't actually need the $.get $.post functions? Lastly, lets say we're building this ajax form, we should bind the $.ajax function to a submit button using .click? We don't actually need to enclos...
stackexchange/codereview
I'm attempting to write a Gnome applet using Python and pygtk. Sadly all sources of information that I have been able to find are from 2004 or older, and while the general structures presented are still valid, most of the particulars are out-of-date. Even the example applets I've found through web searches no longer wo...
stackexchange/codereview
I am using WPF with a style sheet. In my Style, I have been trying to customized the look of the dotted focus border for a CheckBox. I need the focus border to only draw around the square an not the entire control. I set my style width to 15 and the dotted border is correct, but does not surround the square, its off to...
stackexchange/codereview
I have to query a database of thousands of entries and order this by the distance from a specified point. The issue is that each entry has a latitude and longitude and I would need to retrieve each entry to calculate its distance. With a large database, I don't want to retrieve each row, this may take some time. Is the...
stackexchange/codereview
I'm trying to print out an attribute value with the following code: ArrayList arrayList=new ArrayList(); String = "tagToFind"; Node n = node.getParentNode(); String printOut = ""; while (n != null && !n.getNodeName().equals(tagToFind)) { n = n.getParentNode(); } if (n != null){ arrayList.add(n.getNodeValu...
stackexchange/codereview
I need to add a folder in current classpath for ant script that I have written for running java files. How can it be done?
stackexchange/codereview
If I had something like this: Where would each class go? Does anyone have any links to good examples of MVC?
stackexchange/codereview
I am trying to use Net::SFTP to get connected to remote server. My script is: my %args = ( ssh_args => { user => 'canneu_scp', identity_files => [ '/home/home1/cgrshah/responsys/capgemini.private' ], debug => 1, } ); my $targetserver='files.responsys.net'; my $sftp = Net::SFTP->new($tar...
stackexchange/codereview
Where objects,variable variables,temporary variable are stored in java? How they are referenced? I know that methods are being stored in stack. where variables are stored heap or stack?
stackexchange/codereview
Updated: I need to figure out the best method for setting up an email account and automatically reading and processing emails. After some thought I want to check a POP account (Gmail) from my service. Are there any libraries/built in stuff I can use to do this? Free > Not Free.
stackexchange/codereview
I've run into an exception and looking at variables in the watch window, I'm seeing some question marks (???). Does this mean it's pointing to an invalid address?
stackexchange/codereview
I'm trying to write a durable WCF service, whereby clients can handle that the server is unavailable (due to internet connection, etc) gracefully. All evidence points to using the MSMQ binding, but I can't do that because my "server" is the Azure cloud, which does not support MSMQ. Does anyone have a recommended altern...
stackexchange/codereview
i am beginner of creating web services in java.i saw there are many ways create webservices in java.i am confused by seeing that and all .pl help which one is better. i am using myeclipse ide. Thanks in advance Aswan
stackexchange/codereview
I have a issue on building the jar at place. It is not generating all .class files. But if i manually complite the .java files i am able to generate all the .class files without any issue. What could be the issue?
stackexchange/codereview
I am doing some paging in my application, returning 20 rows from the database at a time using PostgreSQL's standard OFFSET and LIMIT keywords. For instance, to get page 1 page: SELECT stuff FROM table WHERE condition ORDER BY stuff OFFSET 0 LIMIT 20 It is a requirement of the application that we also show to the user...
stackexchange/codereview
This is a bit of a grey-area question, so I'll try both here and Server Fault... I have a utility app, built with VB6. I no longer have source for the app. The utility was last used successfully on Sunday morning. When attempting to run the app this morning, I get an error dialog complaining about 'Invalid Picture'. On...
stackexchange/codereview
Imagine you've got a big SVN tree with branches all over the place. There is the trunk, there are branches, those branches have branches, etc. So, given two branches in the tree, how can you find the common ancestor? I know that you could simply take the full log and compare it, but it get's kinda slow if your trunk ha...
stackexchange/codereview
Why does the following class declaration inherit from object? class MyClass(object): ...
stackexchange/codereview
This rails validation code is so ugly, and there must be a better way to do it. The short story is my user is inputting data from test results. Each specific test has 4 measurements. Usually the user inputs all 5 tests (20 measurements), but it's not always required. I just need to check that if a tester started inp...
stackexchange/codereview
I'm using PHP and was wondering how can i run my PHP script to run at midnight and check if a member has been inactive for six months if so delete.
stackexchange/codereview
I am using ASP.NET MVC 2. I have played around you the YUI samples that can be found on http://developer.yahoo.com/yui/2/. I have been wondering if any one has had the time to use the YUI controls in an MVC app? I want to start using the datatable and display my results from a SQL Server in this datatable. How is th...
stackexchange/codereview
I've got the following SQL, but I only want to return rows where 'hits' are greater than 10. SELECT clicks.affiliate, COUNT(*) AS hits, affiliates.title, affiliates.url FROM clicks INNER JOIN affiliates ON affiliates.id = clicks.affiliate GROUP BY clicks.affiliate Thanks.
stackexchange/codereview
I'm trying to assign a done-event to the upload_complete_handler for swfupload, unfortunately nothing happens. In my settings I have: upload_complete_handler : function(){ alert("finished"); } All parameters seem correct, I've already tried deactivating my upload script. Any idea what could be wrong?
stackexchange/codereview
Why doesn't Microsoft's C++/CLI allow me to pass strings by reference? I received the following error: C3699: '&': cannot use this indirection on type 'System::String'
stackexchange/codereview
there is a MonthCalender in C# There is a 2 buttons to select the month Jan, Feb and so on.. Anyway I can detect that the user changed the month?
stackexchange/codereview
So, it seems to me like a query on a table with 10k records and a query on a table with 10mil records are almost equally fast if they are both fetching roughly the same number of records and making good use of simple indexes(auto increment, record id type indexed field). My question is, will this extend to a table with...
stackexchange/codereview
I have opened a large web project on elance for a social network. I got over 30 bids on my project and many of the providers recommended php even though they had .net knowledge. many have said that php with drupal has many advanteges over the .NET framework but did not say what they were. Its hard to believe that a scr...
stackexchange/codereview
Consider the following code I wrote: import Control.Monad increasing :: Integer -> [Integer] increasing n | n == 1 = [1..9] | otherwise = do let ps = increasing (n - 1) let last = liftM2 mod ps [10] let next = liftM2 (*) ps [10] alternateEndings...
stackexchange/codereview
In my WPF application I want to add multiple 3D objects from xaml files. But if more objects I'm having in viewport3D performance of my application becomes worse with every object I add. As I can only work with only one 3D object at the same time I thought that maybe I can replace 3D objects that I'm not using with th...
stackexchange/codereview
I hope to play MPMediaItemcollection using MPMusicPlayerController. musicPlayer = [MPMusicPlayerController applicationMusicPlayer]; I have got the handler of MPMediaItem *mediaItem. How can I add MPMediaItem to MPMediaItemCollection? I try addObject, but no function.
stackexchange/codereview
My objective is to run a function every seconds. And check some time based functionality. For example, In my application I have five groups of users. Each of the users have a particular task. And allotted a particular period of time. The task firstly assigned to the lower level(ie, 5th level) Users. If that users coul...
stackexchange/codereview