{"QuestionId": 14507049, "AnswerCount": 0, "Tags": "", "CreationDate": "2013-01-24T17:19:48.417", "AcceptedAnswerId": null, "Title": "Limit the default years range on Symfony 2 php form", "Body": "

Im generating a form field using php on Symfony like this:

\n\n
  <?php\n  echo $view['form'] -> row($form[\"validend\"], array(\n      //widget\n        \"widgetArgs\" => array(\"attr\" => array('id' => \"gift_validbegin\")), 'label'  => 'Data Fine',\n        \"widgetArgsDay\" => array(\"attr\" => array(\"class\"=>\"span1\",'validate-type'=>'complete')),\n        \"widgetArgsMonth\" => array(\"attr\" => array(\"class\"=>\"span1\",'validate-type'=>'complete')),\n        \"widgetArgsYear\" => array(\"attr\" => array(\"class\"=>\"cspan1\",'validate-type'=>'complete'))));\n ?>\n
\n\n

This generates the default year range, I wonder how can I set a diffrent range, lets say from the actual year to 5 more.

\n", "Lable": "No"} {"QuestionId": 14596207, "AnswerCount": 1, "Tags": "", "CreationDate": "2013-01-30T03:30:35.583", "AcceptedAnswerId": "14596264", "Title": "Initializing global object in Python", "Body": "

In summary, my problem is how do you easily make a connection resource a global variable? To be specific, I'd like to open a Redis queue connection and would like to use that in multiple functions without the hassle of passing it as a parameter, i.e.'

\n\n
#===============================================================================\n# Global variables\n#===============================================================================\nREDIS_QUEUE <- how to initialize\n
\n\n

Then, in my main function, have

\n\n
# Open redis queue connection to server\nREDIS_QUEUE = redis.StrictRedis(host=SERVER_IP, port=6379, db=0)\n
\n\n

And then use REDIS_QUEUE in multiple functions, e.g.

\n\n
def sendStatusMsgToServer(statusMsg):\n    print \"\\nSending status message to server:\"\n    print simplejson.dumps(statusMsg)\n    REDIS_QUEUE.rpush(TLA_DATA_CHANNEL, simplejson.dumps(statusMsg))\n
\n\n

I thought REDIS_QUEUE = none would work but it gives me

\n\n
AttributeError: 'NoneType' object has no attribute 'rpush'\n
\n\n

I'm new to Python, what's the best way to solve this?

\n", "Lable": "No"} {"QuestionId": 14671842, "AnswerCount": 1, "Tags": "", "CreationDate": "2013-02-03T11:12:34.950", "AcceptedAnswerId": "14671853", "Title": "Jump to errors with logcat", "Body": "

I develop android apps.

\n\n

I'm in some confusion about LogCat.

\n\n

If I sometimes can't Judge where is the error exactly if my app force closes. Is there any way or shortcuts to know where our error exactly ?

\n", "Lable": "No"} {"QuestionId": 14725317, "AnswerCount": 3, "Tags": "", "CreationDate": "2013-02-06T09:15:21.557", "AcceptedAnswerId": "14725409", "Title": "Wait until popToRootViewControllerAnimated:YES animation is done", "Body": "

I have a menu based navigation. The menu is a tableView. Everytime a user presses one entry in that table I want to switch to another viewcontroller, and if there is any view pushed I want to clean the navigation stack first.

\n\n

This is what I am doing

\n\n
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {\n\n    [(UINavigationController *)self.tabBar.selectedViewController popToRootViewControllerAnimated:YES];\n\n\n    self.tabBar.selectedIndex = indexPath.row;\n\n}\n
\n\n

But

\n\n
    self.tabBar.selectedIndex = indexPath.row;\n
\n\n

Dont let the popToRoot animation finish. Is there any way to know when the animation is done?

\n\n

Thanks

\n", "Lable": "No"} {"QuestionId": 14770087, "AnswerCount": 1, "Tags": "", "CreationDate": "2013-02-08T10:06:05.443", "AcceptedAnswerId": "14770781", "Title": "GWT - how to precisely set rendered width of TextArea in pixels?", "Body": "

I need to render a TextArea in an exact pixel width for the special purposes of my GUI.

\n\n

When I set its width to \"250px\", it comes out as 256px.

\n\n

Is there a way to override this behavior so I can render it as 250px exactly?

\n", "Lable": "No"} {"QuestionId": 14773828, "AnswerCount": 1, "Tags": "", "CreationDate": "2013-02-08T13:39:54.847", "AcceptedAnswerId": "14774045", "Title": "The results viewer cannot execute a query with more than 655 columns in the project list", "Body": "

I am using Visual Studio 2008's server explorer and I need to search through a database for invoice lines. So I find this one table named ixvFact but when I try to retrieve the results, visual studio gives me the following error and does not show me the results.

\n\n
\n

The results viewer cannot execute a query with more than 655 columns in the project list.

\n
\n\n

What does this mean? How can I solve this?

\n", "Lable": "No"} {"QuestionId": 14774101, "AnswerCount": 1, "Tags": "", "CreationDate": "2013-02-08T13:54:06.287", "AcceptedAnswerId": "14774834", "Title": "What causes NSURLConnection to stop receiving before it's done?", "Body": "

My game needs to fill tableView cells with a bunch of things from my server database. This has been working fine. Then I upgraded Xcode to 4.6 and targeted iOS6.1, to please the App Review Team folks. Now, one of my connections never completes. (All of the other Posts seem to work correctly, as always.) Here's my post:

\n\n
- (void) fillCells {\n    Cell_QtoA *newCell = [[Cell_QtoA alloc] initCellUser:usrID Grp:grpID Qtn:0 Gnm:@\"na\" Cat:@\"na\" Sit:@\"na\" Pfl:@\"na\" Lks:0 isA:0 ddA:0 ];\n    NSMutableURLRequest *reqPost = [SimplePost urlencodedRequestWithURL:[NSURL URLWithString:kFillCells] andDataDictionary:[newCell toDictC]];\n    (void) [[NSURLConnection alloc] initWithRequest:reqPost delegate:self];\n}\n
\n\n

I think it's working fine. The PHP and database haven't changed. Everything worked great yesterday, before the upgrades. Here's my connection method:

\n\n
- (void) connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {\n   NSLog(@\"data = %@\", data);\n   NSString  *error;\n   NSArray *array = (NSArray *)[NSPropertyListSerialization propertyListFromData:data mutabilityOption:NSPropertyListImmutable format:0 errorDescription:&error];\n   if( error ) {\n       NSLog(@\"Error = %@\", error);\n       return;\n   }\n   NSLog(@\"1st object in array of %d is %@\", [array count], array );\n}\n
\n\n

Because I suspected net speeds to be an issue, I added a timer to the call, which I never needed before:

\n\n
timer = [NSTimer scheduledTimerWithTimeInterval:2 target:self selector:@selector(fillCells) userInfo:nil repeats:YES];\n
\n\n

The timer didn't help. Still get errors:

\n\n
\"Unexpected EOF\" and \"Unexpected character z (or whatever) at Line 1\"\n
\n\n

The NSLog of data shows hex data that appears cut off, like:

\n\n
<3c3f786d 6c207665 ... 63743e0a 3c2f6172 7261793e 0a3c2f70 6c697374 3e>\n
\n\n

It's like the reception is being interrupted. Anyone know what's happening here? Thanks!

\n", "Lable": "No"} {"QuestionId": 14795615, "AnswerCount": 2, "Tags": "<.net>", "CreationDate": "2013-02-10T07:18:07.983", "AcceptedAnswerId": "16215039", "Title": "Debug Microsoft SharePoint code - disable optimization", "Body": "

I want to debug Microsoft code on SharePoint site.

\n\n

I download .NET Reflector Visual Studio Extension so I can step into Microsoft code, but when I try to get the value of some variables - I get the error: \"Cannot obtain value of local or argument <this> as it is not available at this instruction pointer, possibly because it has been optimized away.\"

\n\n

I try to cancel the optimization, I saw what Cameron MacFarland wrote here, So I created a file with the commands that open VS without JIT optimizations. As for the second action - I do not know how to do it when it comes to a SharePoint application that IIS is running it.

\n\n

How to achieve this?

\n\n

EDIT: My question is basically: How to disable code optimization when the code is run by IIS?

\n", "Lable": "No"} {"QuestionId": 14798434, "AnswerCount": 1, "Tags": "", "CreationDate": "2013-02-10T13:51:04.653", "AcceptedAnswerId": null, "Title": "ffmpeg: converting to mp4 with error: unsupported codec", "Body": "

i am converting a videofile with the latest version of ffmpeg in php:

\n\n
exec(\"ffmpeg -y -i capture.wmv capture.mp4 2>&1\", $output);\nvar_dump($output);\n
\n\n

This is the result:

\n\n
array(21) {\n  [0]=>\n  string(99) \"FFmpeg version SVN-r0.5.9-4:0.5.9-0ubuntu0.10.04.3, Copyright (c) 2000-2009 Fabrice Bellard, et al.\"\n  [1]=>\n  string(451) \"  configuration: --extra-version=4:0.5.9-0ubuntu0.10.04.3 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --disable-stripping --disable-vhook --enable-runtime-cpudetect --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --enable-shared --disable-static\"\n  [2]=>\n  string(35) \"  libavutil     49.15. 0 / 49.15. 0\"\n  [3]=>\n  string(35) \"  libavcodec    52.20. 1 / 52.20. 1\"\n  [4]=>\n  string(35) \"  libavformat   52.31. 0 / 52.31. 0\"\n  [5]=>\n  string(35) \"  libavdevice   52. 1. 0 / 52. 1. 0\"\n  [6]=>\n  string(35) \"  libavfilter    0. 4. 0 /  0. 4. 0\"\n  [7]=>\n  string(35) \"  libswscale     0. 7. 1 /  0. 7. 1\"\n  [8]=>\n  string(35) \"  libpostproc   51. 2. 0 / 51. 2. 0\"\n  [9]=>\n  string(43) \"  built on Jan 24 2013 19:42:59, gcc: 4.4.3\"\n  [10]=>\n  string(34) \"Input #0, asf, from 'capture.wmv':\"\n  [11]=>\n  string(60) \"  Duration: 00:04:11.45, start: 3.000000, bitrate: 1755 kb/s\"\n  [12]=>\n  string(62) \"    Stream #0.0: Audio: wmav2, 44100 Hz, stereo, s16, 128 kb/s\"\n  [13]=>\n  string(82) \"    Stream #0.1: Video: wmv2, yuv420p, 1280x720, 1600 kb/s, 1k tbr, 1k tbn, 1k tbc\"\n  [14]=>\n  string(33) \"Output #0, mp4, to 'capture.mp4':\"\n  [15]=>\n  string(83) \"    Stream #0.0: Video: mpeg4, yuv420p, 1280x720, q=2-31, 200 kb/s, 90k tbn, 1k tbc\"\n  [16]=>\n  string(62) \"    Stream #0.1: Audio: 0x0000, 44100 Hz, stereo, s16, 64 kb/s\"\n  [17]=>\n  string(15) \"Stream mapping:\"\n  [18]=>\n  string(21) \"  Stream #0.1 -> #0.0\"\n  [19]=>\n  string(21) \"  Stream #0.0 -> #0.1\"\n  [20]=>\n  string(40) \"Unsupported codec for output stream #0.1\"\n}\n
\n\n

I need a standard mp4-file for playing in web with html5. Where could be the problem? Is the codex not installed? Or is something wrong with the console command?

\n\n

EDIT:\nAfter using a static build i try to convert a wmv to mp4 with

\n\n
exec(\"/www/htdocs/xxxx/video/ffmpeg -y -i capture.wmv capture.mp4 2>&1\", $output);\n
\n\n

The result file has a size of only some bytes - this is the output:

\n\n
array(40) {\n  [0]=>\n  string(77) \"ffmpeg version N-49805-gfd6a021 Copyright (c) 2000-2013 the FFmpeg developers\"\n  [1]=>\n  string(61) \"  built on Feb 11 2013 05:23:18 with gcc 4.6 (Debian 4.6.3-1)\"\n  [2]=>\n  string(609) \"  configuration: --prefix=/root/ffmpeg-static/64bit --extra-cflags='-I/root/ffmpeg-static/64bit/include -static' --extra-ldflags='-L/root/ffmpeg-static/64bit/lib -static' --extra-libs='-lxml2 -lexpat -lfreetype' --enable-static --disable-shared --disable-ffserver --disable-doc --enable-bzlib --enable-zlib --enable-postproc --enable-runtime-cpudetect --enable-libx264 --enable-gpl --enable-libtheora --enable-libvorbis --enable-libmp3lame --enable-gray --enable-libass --enable-libfreetype --enable-libopenjpeg --enable-libspeex --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-version3 --enable-libvpx\"\n  [3]=>\n  string(40) \"  libavutil      52. 17.101 / 52. 17.101\"\n  [4]=>\n  string(40) \"  libavcodec     54. 91.102 / 54. 91.102\"\n  [5]=>\n  string(40) \"  libavformat    54. 62.100 / 54. 62.100\"\n  [6]=>\n  string(40) \"  libavdevice    54.  3.103 / 54.  3.103\"\n  [7]=>\n  string(40) \"  libavfilter     3. 37.101 /  3. 37.101\"\n  [8]=>\n  string(40) \"  libswscale      2.  2.100 /  2.  2.100\"\n  [9]=>\n  string(40) \"  libswresample   0. 17.102 /  0. 17.102\"\n  [10]=>\n  string(40) \"  libpostproc    52.  2.100 / 52.  2.100\"\n  [11]=>\n  string(54) \"Guessed Channel Layout for  Input Stream #0.0 : stereo\"\n  [12]=>\n  string(34) \"Input #0, asf, from 'capture.wmv':\"\n  [13]=>\n  string(11) \"  Metadata:\"\n  [14]=>\n  string(32) \"    WMFSDKNeeded    : 0.0.0.0000\"\n  [15]=>\n  string(32) \"    DeviceConformanceTemplate: @\"\n  [16]=>\n  string(37) \"    WMFSDKVersion   : 12.0.7601.17514\"\n  [17]=>\n  string(23) \"    IsVBR           : 0\"\n  [18]=>\n  string(60) \"  Duration: 00:04:13.40, start: 0.000000, bitrate: 1742 kb/s\"\n  [19]=>\n  string(90) \"    Stream #0:0(ger): Audio: wmav2 (a[1][0][0] / 0x0161), 44100 Hz, stereo, fltp, 128 kb/s\"\n  [20]=>\n  string(125) \"    Stream #0:1(ger): Video: wmv2 (WMV2 / 0x32564D57), yuv420p, 1280x720, 1600 kb/s, SAR 1:1 DAR 16:9, 1k tbr, 1k tbn, 1k tbc\"\n  [21]=>\n  string(35) \"[libx264 @ 0x2f082e0] using SAR=1/1\"\n  [22]=>\n  string(63) \"[libx264 @ 0x2f082e0] MB rate (3600000) > level limit (2073600)\"\n  [23]=>\n  string(88) \"[libx264 @ 0x2f082e0] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2 AVX\"\n  [24]=>\n  string(45) \"[libx264 @ 0x2f082e0] profile High, level 5.2\"\n  [25]=>\n  string(684) \"[libx264 @ 0x2f082e0] 264 - core 129 r2230 1cffe9f - H.264/MPEG-4 AVC codec - Copyleft 2003-2012 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00\"\n  [26]=>\n  string(33) \"Output #0, mp4, to 'capture.mp4':\"\n  [27]=>\n  string(11) \"  Metadata:\"\n  [28]=>\n  string(32) \"    WMFSDKNeeded    : 0.0.0.0000\"\n  [29]=>\n  string(32) \"    DeviceConformanceTemplate: @\"\n  [30]=>\n  string(37) \"    WMFSDKVersion   : 12.0.7601.17514\"\n  [31]=>\n  string(23) \"    IsVBR           : 0\"\n  [32]=>\n  string(35) \"    encoder         : Lavf54.62.100\"\n  [33]=>\n  string(122) \"    Stream #0:0(ger): Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 16k tbn, 1k tbc\"\n  [34]=>\n  string(90) \"    Stream #0:1(ger): Audio: aac ([64][0][0][0] / 0x0040), 44100 Hz, stereo, s16, 128 kb/s\"\n  [35]=>\n  string(15) \"Stream mapping:\"\n  [36]=>\n  string(39) \"  Stream #0:1 -> #0:0 (wmv2 -> libx264)\"\n  [37]=>\n  string(45) \"  Stream #0:0 -> #0:1 (wmav2 -> libvo_aacenc)\"\n  [38]=>\n  string(31) \"Press [q] to stop, [?] for help\"\n  [39]=>\n  string(96) \"frame=  158 fps=0.0 q=33.0 size=       0kB time=00:00:00.10 bitrate=   3.6kbits/s dup=155 drop=0\"\n}\n
\n\n

slhck - thanks for your tipps - do you see the problem?

\n", "Lable": "No"} {"QuestionId": 14844781, "AnswerCount": 1, "Tags": "", "CreationDate": "2013-02-13T01:03:50.023", "AcceptedAnswerId": "14865333", "Title": "Google charts axis rendering issue on Android Honeycomb Emulator", "Body": "

I am about to release an update to my application to use the new JavaScript Google Charts API having taken note of the deprecation warning against the Google Image Charts API. I am encountering JavaScript issues with the axis labelling apparently dependent on the version of the Android WebKit. I am aware that using the Google Charts API simply won't work pre-3.1 owing to the lack of SVG support within the Webkit client.

\n\n

Background

\n\n

The application currently supports Eclair (API Level 7) upward with SVG support only arriving on the in-built WebKit client in Honeycomb MR1 (API Level 12). To address this discrepancy in functionality my code employs a simple if-else statement inspecting the Android version prior to deciding which charting API to use.

\n\n

The rendering issue

\n\n

This is best shown with a picture. Please note that;

\n\n
    \n
  1. The same JavaScript is being run on the Android Honeycomb Emulator as on the Jelly Bean device.
  2. \n
  3. The comparison is between an emulator (not working) and a real phone (working)
  4. \n
  5. The JavaScript is being run from within a WebView leveraging the in-built android.webkit.WebViewClient
  6. \n
  7. The axis on the emulator show as [Object object] but correctly on the real device
  8. \n
\n\n

\"Chart

\n\n

Figure 1 - The incorrect axis labelling found on the Honeycomb Emulator.

\n\n

\"Chart

\n\n

Figure 2 - The correct axis labelling found on the Real device.

\n\n

The code

\n\n

Without 'paste-bombing' the issue with masses of irrelevant code the bits of JS and Java driving the naming of the vertical (v) axis are described below;

\n\n

JavaScript

\n\n
...\nAs part of the chart options...\n...\n// Vertical axis.\nvAxis: {title: yAxisTitle.toString(),\n        baselineColor: 'white',\n        titleTextStyle: {color: 'gray'},\n        textStyle: {color: 'gray'}, \n        gridlines: {color: 'gray'}\n        }\n
\n\n

where yAxisTitle has been injected in via the Android WebView.addJavascriptInterface like so;

\n\n

Java

\n\n
chart.addJavascriptInterface(String.format(getString(string.height_label), getUnits().getSymbol()), \"yAxisTitle\");\n
\n\n

Investigation to date

\n\n

From briefly encountering the [Object object] description previously (I'm new to the world of JS) I understand that I am simply executing a toString on a JavaScript object and that's what it looks like. But does this mean there has been a change in Java-JavaScript injection between Android 3.1 and 4.1 which means the datatypes being inject via the addJavascriptInterface are now being 'remembered' whereas previously they were not? Should I be serialising the string into a JSON object or is that overkill for what is passing an (almost) primitive type? Finally should I be explicitly casting on the JS side to enforce that the sorts of objects being used for items such as axis labels are indeed strings? Thoughts appreciated.

\n", "Lable": "No"} {"QuestionId": 15023478, "AnswerCount": 3, "Tags": "", "CreationDate": "2013-02-22T11:45:31.617", "AcceptedAnswerId": "15023554", "Title": "How to get content between HTML tags that have been loaded by jQuery?", "Body": "

I'm loading data using jQuery (AJAX), which is then being loaded into a table (so this takes place after page load).

\n\n

In each table row there is a 'select' link allowing users to select a row from the table. I then need to grab the information in this row and put it into a form further down the page.

\n\n
$('#selection_table').on('click', '.select_link', function() {\n    $('#booking_address').text = $(this).closest('.address').text();\n    $('#booking_rate').text = $(this).closest('.rate').val();\n});\n
\n\n

As I understand it, the 'closest' function traverses up the DOM tree so since my link is in the last cell of each row, it should get the elements 'address' and 'rate from the previous row (the classes are assigned to the correct cells).

\n\n

I've tried debugging myself using quick and dirty 'alert($(this).closest(etc...' in many variations, but nothing seems to work.

\n\n

Do I need to do something differently to target data that was loaded after the original page load? where am I going wrong?

\n", "Lable": "No"} {"QuestionId": 15153044, "AnswerCount": 4, "Tags": "", "CreationDate": "2013-03-01T07:57:05.753", "AcceptedAnswerId": "15153088", "Title": "Call self.viewDidAppear when App comes to foreground", "Body": "

I would like to have my app call viewDidAppear again when the user brings the app to the foreground.

\n\n
- (void)appReturnsActive{\n\n    //THIS IS THE BIT THAT DOESNT WORK, BUT [self.viewDidLoad] DOES WORK\n    [self.viewDidAppear];\n}\n
\n\n

I am creating appReturnsActive in my viewDidAppear method like this. It works well:

\n\n
[[NSNotificationCenter defaultCenter] addObserver:self \nselector:@selector(appReturnsActive) name:UIApplicationDidBecomeActiveNotification \nobject:nil];\n
\n\n

I can do self.viewDidLoad, but I can't choose viewDidAppear. Does anyone know how I might get this to work?

\n\n

Thank you!!

\n", "Lable": "No"}