Posts

Showing posts from June, 2011

php - Fatal error: Uncaught OAuthException: (#200) Requires extended permission: read_stream -

fatal error: uncaught oauthexception: (#200) requires extended permission: read_stream thrown in /home/a1607618/public_html/base_facebook.php on line 1033 my app tend read user wall posts if ($user) { $comments = $facebook->api('/me/home'); d($comments); } function d($d){ echo '<pre>'; foreach ($d $a => $b) { print "$a: $b\n"; } echo '</pre>'; } i give app extended permission: read_stream through apps_ >connectme _>permissions and here line 1033 protected function throwapiexception($result) { $e = new facebookapiexception($result); switch ($e->gettype()) { // oauth 2.0 draft 00 style case 'oauthexception': // oauth 2.0 draft 10 style case 'invalid_token': $message = $e->getmessage(); if ((strpos($message, 'error validating access token') !== false) || (strpos($message, 'invalid

sign - WiX-Bootstrapper - Set Productname and Companyname for UAC Dialog -

i have created bootstrapper wix 3.7. now, when start on windows7 machine, uac-dialog shown before installing .net 4.0 prerequisite. thats ok. searching way "sign" installer/bootstrapper, can set product-name , company-name uac-dialog. how can this? there signing tasks built wix.targets sign bundle. can read in insignia topic in wix topic . uac show information certificate.

c++ - Define Operator < in struct for 2 objects of another struct -

i have little problem in c++ , hope able me out. i want define struct mypoint. struct should able compare 2 objects type point (defined pair). want every "instance" of mypoint able compare 2 points on own. tried code: typedef pair<int,int> point; struct mypoint{ point p; inline bool operator<( point x, point y ){ return !ccw(p,x,y); } so every mypoint should consider own point p while comparing 2 points x,y. (translated) error is "error c2804: binary operator '<' has arguments/parameters" it seems it's syntacticly possible make operator 1 point, guess compare point mypoint, that's not should be. background of problem want use predefined sort function sort vector of points , sorting "function" want deliver mypoint object. i think (maybe) trying write functor struct mypoint { mypoint(point p) { this->p = p; } bool operator()(point x, point y) const { return !ccw(p,x,y);

c++ - opengl - flash of light (like when shooting) -

Image
i'm trying create flash of light (like when shooting). e.g. (it's real video, need similar, more simpler): i need using opengl - can't model one. nice if little random. can give me hints? i don't know how want look, can fake using alpha textured quads laid out in cross, can move texture little every frame in direction of muzzle pointing make if moving. it simple , easy implement , flash should quick thing user never know able tell difference.

javascript - find specified percentage with jquery -

i trying find percentage of integer in jquery: there variable different values gets based on selected attribute (for example variable have value 0.27) is there made function find 6.61375661375662% of value (0.27) ? or need manualy write formula? var percentage = your_var * .0661375661375662; or (for clarity): var percentage = your_var * 6.61375661375662 / 100;

sqlParameters Array in VB.Net -

i'm trying create typed-sized parameters array in vb.net: dim parameters() sqlparameter = new sqlparameter() _ { new sqlparameter("@first_name", sqldbtype.varchar, 50) {value = "john"}, new sqlparameter("@last_name", sqldbtype.varchar, 50) {value = "doe"}, new sqlparameter("@age", sqldbtype.int) {value = 18}, new sqlparameter("@id", sqldbtype.int) {value = 123} } but vs says: value' not declared. may inaccessible due protection level what's wrong code above? thanks! you need use vb syntax object initializers: dim parameters() sqlparameter = new sqlparameter() _ { new sqlparameter("@first_name", sqldbtype.varchar, 50) { .value = "john"}, new sqlparameter("@last_name", sqldbtype.varchar, 50) { .value = "doe"}, new sqlparameter("@age", sqldbtype.int) { .

javascript - Fill a range (multiple columns) down multiple rows - google-apps-script -

i had success filling single column (a) value found in range a1... var ss = spreadsheetapp.getactivespreadsheet().getsheetbyname("sheet1"); var lastrow = ss.getdatarange().getnumrows(); var rngval = ss.getrange("a1").getvalue() ss.getrange("a2:a"+lastrow).setvalue(rngval) so thought on easy-street, , tried modify/apply larger range filling multi-column range values found in range c1:h1... var ss = spreadsheetapp.getactivespreadsheet().getsheetbyname("sheet1"); var lastrow = ss.getdatarange().getnumrows(); var rngval = ss.getrange("c1:h1").getvalues() ss.getrange("c2:h"+lastrow).setvalues(rngval) apparently there bit more slapping "s" onto end of word "value". the error reads follows: incorrect range height, 1 should 10 (fyi: var lastrow = 11) btw, no error if use value instead of value s , although end cells full of value found in range c1. so i'm close....

python - Best way to add custom information to for logging -

i've been reading python logging documentation, , has lot of functionality...for everything. the problem i'm facing i'm not dutch , i'm not sure right way is. i running events in simulator, , prefix every log message timestamp of simulated time (probably length formatter too, keep looking good). change in subclass of logger or handler , don't think right way. i think right way use loggeradapter or filter . right, , if so, 1 should prefer? surely if need prefix every log message timestamp, need provide appropriate format string formatter? mentioned here in documentation. update: loggeradapter more appropriate situations contextual information moderately long-lived. example, in network server application handles multiple client connections, connection details (e.g. client ip address) might useful context, create loggeradapter instance when new client connection created. doesn't sound simulation scenario. a filter , on other hand, use

php - Grabbing specific variable from while loop for form submit -

i have while loop generating information checkbox, update database new "completed" value. how can select specific checkbox generated. please showing me how can grab specific value of checkbox , task_name. thanks, ryan while ($row = mysql_fetch_array($query)){ $task_name = $row['task_name'] ; $task_description = $row['task_description']; $task_completed = $row['completed']; $tasks .= '<div id="tasksbody"> <form action="" method="post">completed? <input name="completed" type="checkbox" '. ($task_completed == 1?'checked="checked"':''). ' /><input type="submit" value="update"><br /><br /> <b>'.$task_name.'</b><br /><br />'.$task_description.'<hr>&l

How to create a new Highstock chart with new Highchart and not jquery? -

all examples on highchart website creates stockchart using: $('#container').highchart('stockchart', config); how create stock chart using new? eg: var chart = new highchart('stockchart', config) i tried that, , this... var chart = new highstock(config) ...with no luck. i googled more , found it. code this: chart = new highcharts.stockchart(config) annoying that... anyway yeah, has 2 constructors, highcharts.chart , highcharts.stockchart.

c++ - ASCII country at war homework -

i have make converter take message :mmz\dxzmx]zpgy convert corresponding ascii number, use formula if(originalchar+key > 126) encryptedchar = 32 + ((orgiginalchar + key) - 127); else encryptedchar = (orginalchar + key); the key in problem number between 1 100 have try formula every possible key till message makes sense made. so can tell me i'm doing wrong or point me in right direction #include <iostream> #include <cstdlib> using namespace std; void converter(char originalchar, int key); int main() { char originalchar[16] = ":mmz\\dxzmx]zpgy"; int key; converter((int)originalchar, key); system("pause"); return 0; } void converter()(char originalchar, int key) { char answer; (key = 0; key <= 100; key++) { if (originalchar - key < 32) { answer = (((originalchar - key) + 127) - 32); } else { answer = (originalchar - key)

parallel processing - Getting rid of data dependency -

i have code: for(i=0; i<size; i++) { d[i] = d[i-1] + v[i]; } when parallel processing loop, have data dependency , initiation interval becomes 2 meaning have: initiation interval:2 |load v[i-1]|load d[i-2]| add |store d[i-1]| | | | load v[i]|load d[i-1] | add | store d[i] | i not want stall in between. initiation interval:1 |load v[i-1]|load d[i-2]| add |store d[i-1]| | |load v[i] |load d[i-1]| add | store d[i] | this not possible since d[i-1] not stored yet. how make initiation interval 1 changing code? you cannot reduce gap. also (loop unrolling) not efficient way of parallel processing kind of loop. loop looks prefix-sum operation. there fast parallel algorithms , implementations available prefix-sum. example, this question

php - Wordpress site making "holes" in output -

my page http://www.allyourpods.no/ has odd "holes" cant life of me figure out. i love figure out how make automagickly fill site in proper fashion. my template-file start-screen looks this: <?php /* template name: home template */ get_header(); ?> <?php query_posts('cat='.recpodcastcategory.'&showposts=30');?> <?php $categories = get_categories('child_of='.recpodcastcategory); ?> <?php if($categories): $count=0;?> <div class="recommended"> <div class="wrapper"> <div class="main_recommended_main_block"> <?php foreach($categories $category) { if($count<30) { $count++; if($count!=30) $class='recommend_block'; else $class='recommend_block_1'; ?> <?php if (function_exists('get_terms_meta')) { $cat_image = get_terms_meta($category->

html - Change background with javascript function -

i trying make button changes background of div. want give 2 parameters javascript function. the id of div wich change background number of background types. for example... <div id="background" class="background1"> <p>choose background</p> <a href="javascript:change(background,10)" class="btn"></a> </div> the function want changes class of background div background1, background2, background3, background4... until 10 (the paramter) i want function parameters because use in lot of divs! can´t =( try this... var nextid = 1; var highestid = 10; //highest image id function change(divid) { //change background image only... document.getelementbyid(divid).style.backgroundimage = '../' + nextid + '.jpg'; /*or set class instead, swap above line 1 below...*/ //document.getelementbyid(divid).classname = 'backgroundclass' + nextid; if(

java - How to reference a swf file in an external directory in Wicket -

we trying embed flash/swf files in our wicket application advertisements. followed tutorial here: object container, adding flash wicket application however can reference swf files within application resources folder. want reference files external directory c://advertisements/ is possible? check this blog post. in post @ imageresource class.

objective c - How can I set [NSTextView selectedTextAttributes] on a background window? -

Image
the default value [nstextview selectedtextattributes] unusable in app, because allow user select colors (syntax highlighting) same background color. i have written math determine suitable color , can use set it: textview.selectedtextattributes = @{ nsbackgroundcolorattributename: [nscolor yellowcolor], nsforegroundcolorattributename: [nscolor redcolor] }; but when window in background, still uses system default light grey. i've attached screenshots of above code active vs inactive window. — how can change selected text background colour of inactive window? you can override colour overriding drawing method of nslayoutmanager . final class layoutmanager1: nslayoutmanager { override func fillbackgroundrectarray(rectarray: unsafepointer<nsrect>, count rectcount: int, forcharacterrange charrange: nsrange, color: nscolor) { let color1 = color == nscolor.secondaryselectedcontrolcolor() ? nscolor.redcolor() : color color1.setfill()

c# - Custom Attribute that uses Type as a property -

i have following custom attribute have type name property. however, not want have use string representation of type when using attribute. example: public class helpmeattribute : attribute { public string typename { get; set; } } and use it, thought this [helpme(typename = typeof(myclass2).fullname] public class myclass1 { } public class myclass2 { } i error: "an attribute must constant expression, typeof expression or array creation expression of attribute parameter type." i prefer not do: [helpme(typename = "myclass2"] because seems bad have type in string. better let compiler check type putting in attribute exists. can point me down path of enlightenment fix this? attribute initializers can use compile-time constants or system.type properties. so why not use type ? public class helpmeattribute : attribute { public type type { get; set; } ... public helpmeattribute() { } } ... [helpme(type = typeof(myclas

jquery - On Django, cookie is assigned outside the boundary of string -

i tried use both document.cookie , $.cookie("productid",productid) on javascript/jquery, seems assignment goes out of boundaries. when run document.cookie command in chrome , expecting get: "csrftoken=bh1n0k3sbkjxqtclaowwt5dpgn22dxqh; productid=2;" but instead, get: "csrftoken=bh1n0k3sbkjxqtclaowwt5dpgn22dxqh; productid=; 2" i'm not sure if it's because of csrftoken has been assigned. problem is, happening, , how assign productid properly? i did not put in imported js file, instead, assigned on html onclick attribute as: onclick='document.cookie="productid={{ product.id }}"';

ruby on rails - How to fix NoMethodError in #show error? -

i'm trying access specific review through link: <%= link_to "full review", review_path(review) %>< show.html.erb: <%= @review.pro %> reviews_controller.rb: def show @review = review.find(params[:id]) end i have column in review table named pro shown in migration file here: class createreviews < activerecord::migration def change create_table :reviews |t| t.string :pro t.string :con t.string :advice t.string :date t.string :role t.string :company t.timestamps end end end the error is: undefined method `pro' nil:nilclass extracted source (around line #1): 1: <%= @review.pro %> even when include 'puts @review' in show method, nothing gets returned in rails console. advice on how fix this? update when manually include review.find(1) in show method: processing reviewscontroller#show html parameters: {"id"=>"1"} rendered reviews/show.html.erb wit

php - how to test/use Zend Framework + Zend Server -

i have installed zend framework + zend server on computer. using win 7. how use/test it? eg. how run below script test? <?php $date=new zend_date(); echo $date; ?> try how deploy php application http://www.zend.com/en/products/server/getting-started/hello-world-sample#behind-the-code http://www.zend.com/products/server/faq#faqd2

Disable maximizing WPF window on double click on the caption -

how disable maximizing wpf window on double click on caption , leave resizing available? i know resizemode disables maximizing, prevents resizing form resizemode="canminimize" i know how remove maximize , minimize buttons, it's still possible maximize double click on caption. in winforms can achieved easily. set formborderstyle none fixedsingle or fixed3d . it's not option in wpf more. p.s. i'm trying tricks handling wm_getminmaxinfo, wm_syscommand, etc. seems it's not working ... i had similar issue. window not have form border or title bar, can moved around (using mouse). problem if user moves window top edge of screen, windows automatically maximizes window. i managed work around issue attaching following handler window's statechanged event. private void onwindowstatechanged(object sender, eventargs e) { if (this.windowstate == windowstate.maximized) { this.windowstate = windowstate.normal; } }

c# - How to use Downloadfile to save an image into a specific folder -

for (int counter = 0; counter <= temparray.length - 1; counter = counter + 1) { if ((counter < temparray.length + 2) && (temparray[counter] == "><img") && (temparray[counter + 1] == "id='header-img'")) { string j = temparray[counter + 2]; int startindex = j.indexof('"') + 1; int length = j.indexof('"', startindex) - startindex; string jj = (j.substring(startindex, length)); client.downloadfile(jj, @"c:\image.png"); } } i url image saved string called jj , i'm trying save folder , not succeeding.

r - Creating a curve to fit x-y data where X is categorical -

Image
i've got dataset of diving behavior tagged animals, , i'm struggling fit curve data, think because x variable in case categorical, , not continuous data. let me give bit of background: my dataset has 184 observations of 14 variables: tagid ddmmyy hour.gmt.hour.local. x0 x3 x10 x20 x50 x100 x150 x200 x300 x400 1 122097 250912 0 9 0.0 0.0 0.3 12.0 15.3 59.6 12.8 0.0 0 0 2 122097 260912 0 9 0.0 2.4 6.9 5.5 13.7 66.5 5.0 0.0 0 0 3 122097 260912 6 15 0.0 1.9 3.6 4.1 12.7 39.3 34.6 3.8 0 0 4 122097 260912 12 21 0.0 0.2 5.5 8.0 18.1 61.4 6.7 0.0 0 0 5 122097 280912 6 15 2.4 9.3 6.0 3.4 7.6 21.1 50.3 0.0 0 0 6 122097 290912 18 3 0.0 0.2 1.6 6.4 41.4 50.4 0.0 0.0 0 0 the variables i'm interested in x0:x400

How to align arrows using CSS or jQuery or JavaScript -

Image
i'm trying create looks this: however, can this: this code i'm using. <div style="position:fixed;z-index:1;"> <a class="left" href="javascript:{}"><img src="images/leftarrow.png"/></a> <a class="top" href="javascript:{}"><img src="images/uparrow.png"/></a> <a class="bottom" href="javascript:{}"><img src="images/downarrow.png"/></a> <a class="right" href="javascript:{}"><img src="images/rightarrow.png"/></a> </div> how can make want to? not sure how suit req uses more of positioning. please check. http://jsfiddle.net/rfhrp/ a.left { top: 20px; left: 15px; } a.right { top: 20px; left: 55px; } a.top { top: 0px; left: 35px; } a.bottom { top: 45px; left: 35px; } .left, .right, .top, .bottom { po

c# - How to import C++ dll in Windows Phone Project -

i have created dll file in c++. want import in windows phone project. have followed number of instructions different sources, when run code getting following error: attempt access method failed: rough.mainpage.add(system.int32, system.int32). my windows phone c# code here: *//here c# code windows phone namespace testrsa { using system.runtime.interopservices; public partial class mainpage : phoneapplicationpage { [dllimport("myfunc.dll", entrypoint = "add", callingconvention = callingconvention.stdcall)] static extern int add(int a, int b); // constructor public mainpage() { initializecomponent(); int result = add(27, 28); system.diagnostics.debug.writeline(7); } } } my dll .h file here: #include "stdafx.h" #include "myfunc.h" #include <stdexcept> using namespace std; double __stdcall add(double a, double b) {

Resources exceeded during query execution with Google BigQuery -

i hitting "resources exceeded during query execution" error when executing query: select date_time,atok,segment, count(distinct googid) distusers, sum(case when eventtype=1 1 else 0 end) cntimp, sum(case when eventtype=2 1 else 0 end) cntclick, sum(case when eventtype=3 1 else 0 end) cntvisit, sum(case when eventtype=4 1 else 0 end) cntconv, logdata.unified_logs group each 1,2,3; any ideas? count distinct culprit... should able create subquery group (each) computes distinct users.

command prompt - Batch File Ending Prematurely -

i have batch file following commands (to set compiler): del yylex.java jflex scanner.flex del parser.java java -jar java-cup-11a.jar parser.cup however, reason, after conclusion of jflex scanner.flex , batch script ends , command prompt closes. if run command separately, not happen. know what's wrong? is jflex batch file? if so, try call jflex ... or start /wait "" jflex ... (well, - give whirl anyway, can't hurt...) when bat asked run batch, merely transfers control other batch , has no idea of return. call or start gives ticket home...

Nginx : For Http range request ie 206 , custom headers are blocked in case of x-redirect chain -

we came across strange behavior when wanted etag propagated through x-redirect chain part of http response range request ie http 206.it seems nginx filters out additional costume headers / tmp variable part of final response through x-redirect non-200 response. kindly suggest workaround issue. here's log data under debug mode normal vs range request clearing showing custom headers being filter out. without range : 2013/04/16 04:08:22 [debug] 23457#0: *385 event timer del: 11: 1366110562151 2013/04/16 04:08:22 [debug] 23457#0: *385 event timer add: 11: 300000:1366110802151 2013/04/16 04:08:22 [debug] 23457#0: *385 http run request: "get_file?path=/shared/documents/loader.html" 2013/04/16 04:08:22 [debug] 23457#0: *385 http upstream check client, write event:1, "/v2_0/get_file" 2013/04/16 04:08:22 [debug] 23457#0: *385 http upstream recv(): -1 (11: resource temporarily unavailable) 2013/04/16 04:08:22 [debug] 23457#0: *385 http upstream request: "/v2

c# - How to read part of string from .txt file? -

here problem, have read data text file. for example: "test1.txt" has data like test1ze g p 1 - ‘ = = û ¡ É É end1= = û test2 ¡ É É ‘end2 i have read data test2 end2 in c# later have convert data in byte array. http://msdn.microsoft.com/en-us/library/db5x7c0d.aspx may you, rest logic in c#. can find here: how 1 part of string

c# - Connect to a MSSQL DB using Web.config -

i have created asp.net c# mvc project. trying connect mssql db. in web.config file added following; <connectionstrings> <add name="sdbconnection" providername="system.data.sqlclient" connectionstring="data source=(localdb)\v11.0;attachdbfilename="c:\users\o\documents\visual studio 2012\projects\ppl\ppl\app_data\ppldb.mdf";integrated security=true" /> </connectionstrings> but, above code incorrect ; want follows; <connectionstrings> <add name="sdbconnection" providername="system.data.sqlclient" connectionstring="data source=(localdb)\v11.0;attachdbfilename=|datadirectory|ppldb.mdf;integrated security=true" /> </connectionstrings> but datadirectory ? specify ? what name="sdbconnection" ? can give name want ? first question quoting msdn : the |datadirectory| portion of connection string specifies mdf fil

ios - In what case that application:didFinishLaunchingWithOptions: been called? -

my app voip,and can run in background. when runs long time in background, `application:didfinishlaunchingwithoptions:' method called , app stop running.i want know :whey voip app run in background ,the application:didfinishlaunchingwithoptions method been called? , if method been called,what should make app keep running? can body help?thank you... i guessing think application may receiving memory warnings. , application:didfinishlaunchingwithoptions: called once each run of application . try investigate overriding - (void)applicationdidreceivememorywarning:(uiapplication *)application method in app delegate . may reason of crashing.

linux - Python. Second step of subprocess.Popen truncates results of first -

in snipet of python script below, think temp2 doesn't wait temp finish running, output can large, text. truncates result ('out') temp, stops mid line. 'out' temp works fine until temp 2 added. tried adding time.wait() subprocess.popen.wait(temp). these both allow temp run completion 'out' not truncated disrupt chaining process there no 'out2'. ideas? temp = subprocess.popen(call, stdout=subprocess.pipe) #time.wait(1) #subprocess.popen.wait(temp) temp2 = subprocess.popen(call2, stdin=temp.stdout, stdout=subprocess.pipe) out, err = temp.communicate() out2, err2 = temp2.communicate() according python docs communicate() can accept stream sent input. if change stdin of temp2 subprocess.pipe , put out in communicate(), data piped. #!/usr/bin/env python import subprocess import time call = ["echo", "hello\nworld"] call2 = ["grep", "w"] temp = subprocess.popen(call, stdout=subprocess.pipe) tem

image - Sparse matrix plot matlab -

Image
i have 5000 *5000 sparse matrix 4 different values. want visualise nonzero elements 4 different colors such can recognise ratio of values , relationships between them,i use imagesc can not recognise among different values, values smaller ratio.i think if use symboles each value , works don't know how in matlab. suggestion? result of dan code in figure below. you reform matrix set of [x, y, f] coordinates (re-using answer resampling matrix , restoring in 1 single matrix ): assuming matrix m [x, y] = meshgrid(1:size(m,1), 1:size(m,2)); mf = m(:); %used again later, hence stored v = [x(:), y(:), mf]; get rid of 0 elements v(mf == 0, :) = []; at point, if have access statistics toolbox can go gscatter(v(:,1), v(:,2), v(:,3)) correct plot otherwise continue following if don't have toolbox: find list of unique values in m vu = unique(v(:,3)); for each such value, plot points xy scatter plot, note hold makes sure colour changes each time new plot adde

orchardcms - Orchard Navigation - how to make menu link not clickable -

i have following menu navigation: home product product 1 product 2 news press releases every menu item above links content, except "product".i need make when user click "product" not go anywhere. i tried use "custom link", , enters "#" or "javascript:void(0)" in url, not work since orchard prefix url "/". also, tried use "html menu item" , enter "product" in html body, rendered <li><span class="raw"><p>product</p></span><ul>...</ul></li> i want either following: <li><a href="#">product</a><ul>....</ul></li> or <li>product<ul>....</ul></li> is there easy way this? in menu.cshtml file under core->shapes->views directory in orchard.web project, this: $(document).ready(function () { $("#nav a").click(function(e) {

Jquery onchange for input type dont work? -

i have question onchange , onblur learnt internet onblur called when focus lost, while on change called when value chaged. for html input type using onblur working desired, later realized ajax request should called when there change in input box value. changed onchange function working same onblur reason body me this. onchange called on blur html input elements if value has changed. onblur called every time input element loses focus.

javascript - Gps tracking google maps -

i developing application requires tracking service. app stores coordinates database if user has travelled x meters since last stored position.. i using phonegaps geolocation service locations etc.. problem gps isnt precise, if sit in chair , check position, if can differ couple of meters , then, resulting in cluttered track.. does have solution this? -i thinking of algorhitm checks acceleration, , prevents device storing location if acceleration increases much/suddenly. would approach, or have had similar problem before? thanks! found answer if still interested. android devices "jump" near antennas every , (at least ones tried on), , when position.coords.speed set null. needed prevent storing positions if speed == null.. =)

search - jqGrid filtertoolbar not firing after grid resizing -

Image
i have fixed row numbers 10 subgrids, if reccount less 10 want adjust height subgrid "auto" or "100%". so here code subgrid : // subgrid fourth level var subgrid_table_id = subgrid_id+"_d", pager_id = "p_"+subgrid_table_id; $("#"+subgrid_id).append("<table id='"+subgrid_table_id+"' class='scroll'></table><div id='"+pager_id+"' class='scroll'></div>"); $("#"+subgrid_table_id).jqgrid({ url:"sg31b.php?id="+row_id+"&clt="+clt, datatype: "json", idprefix:"sgd_", colnames: ['id','article','désignation','marque','equivalence'], colmodel: [ {name:'e.id',index:'e.id',hidden:true}, {name:'a.code',index:'a.code', width:100}, {name:'a.descr',index:'a.descr', wi

Converting video on client-side with javascript -

is there way convert video, using javascript , browser, on client-side. i'm looking solutions minimize our server's process , show progress of conversion. if there isn't such way, how show process of video conversion? there's no simple , standart way (its not impossible anyway, use components, certian big public, recuse security risks). for know how show progress of video conversion, need tools using in server convert video.

How to fit the content to WebView in Android without enabling zooming? -

i tried setting meta tag shown below in order make content fit webview, didn't work. <meta name=\"viewport\" content=\"width=device-width, initial-scale=1, maximum-scale=1, target-densitydpi=device-dpi, user-scalable=no\"> but when set following webview settings, working. webview.getsettings().setusewideviewport(true); webview.setinitialscale(1); now problem webview allowing me zoom on double tap don't want. how can avoid behavior? tried setting setsupportzoom(true) in webview settings still able zoom on double tap. can please suggest me solution?

oracle - Counting the total number of rows depending on a column value -

Image
i have query should count total number of rows returned depending on column value. example: as can see, m field should display total number of rows returned should 5 because ft_lot same value. here query have far: select distinct vbatch_id, maxim_pn, bagnumber, ft_lot , m , level n ( select vbatch_id, maxim_pn, bagnumber, ft_lot, qty, dc, printdate, ws_green, ws_pnr, ws_pcn, msl, baketime, exptime , una , dulo , (dulo - una) + 1 m ( select c.containername vbatch_id ,pb.productname maxim_pn ,bn.wipdatavalue bagnumber ,ln.wipdatavalue ft_lot ,aw.wipdatavalue qty ,decode(ln.wipdatavalue,la.attr_081,la.attr_083 ,la.attr_085,la.attr_087 ,la.attr_089,la.attr_091 ,la.attr_093,la.attr_095 ,la.attr_097,la.attr_099 ,la.attr_101,la.attr_103 ,la.attr_105,la.attr_107 ,la.attr_109,la.attr_111 ,la.attr_113,la.attr_116 ,la.attr_117,la.attr_119 ) dc ,to_char(sysdate,'mm/dd/yyyy hh:mi:ss pm') printdate ,decode(upper(la.attr_158),'green','hf',null) ws_green ,decod

google app engine - Issuing "appcfg.py --oauth update ." with multiple accounts? -

i configured oauth 1 account have, my.first.email@gmail.com . works appengine app_ids i'm using account. once try use on application 'foo' account (say my.second.email@gmail.com ), though, system gives me error (quite expectedly): $ appcfg.py --oauth2 update . 10:09 host: appengine.google.com 10:09 application: foo; version: 100 10:09 starting update of app: foo, version: 100 10:09 getting current resource limits. 10:09 scanning files on local disk. error 404: --- begin server output --- application not exist (app_id=u'foo'). is possible use oauth two (or more) accounts app engine? i'd able use oauth @ same time both accounts, maybe changing cli command 2 different tokens. thanks, riccardo use gcloud command change between multiple accounts. adding new account: gcloud auth login complete login process setting above account default(or switching accounts): gcloud config set account username@gmail.com

performance - Reproduce tcp CLOSE_WAIT state with java client/server -

is there easy way reproduce tcp close_wait state java program? i have legacy java application have problem , i'd able reproduce can test fix. thanks a connection in close_wait state when other side has closed connection side hasn't. easy reproduce: // client.java (will sleep in close_wait) import java.io.*; import java.net.*; public class client { public static void main(string[] args) throws exception { socket socket = new socket(inetaddress.getbyname("localhost"), 12345); inputstream in = socket.getinputstream(); int c; while ((c = in.read()) != -1) { system.out.write(c); } system.out.flush(); // should in close_wait thread.sleep(integer.max_value); } } // server.java (sends data , exits) import java.io.*; import java.net.*; public class server { public static void main(string[] args) throws exception { socket socket = new serversock

python - How to get current value from PyQt comboBox -

i using pyqt designer , converting using pyuic4. ui file has combobox looks this: self.combobox = qtgui.qcombobox(self.groupbox_3) self.combobox.setgeometry(qtcore.qrect(20, 30, 81, 22)) self.combobox.setobjectname(_fromutf8("combobox")) self.combobox.additem(_fromutf8("")) self.combobox.additem(_fromutf8("")) self.combobox.additem(_fromutf8("")) self.combobox.additem(_fromutf8("")) self.combobox.additem(_fromutf8("")) self.combobox.additem(_fromutf8("")) self.combobox.additem(_fromutf8("")) self.combobox.additem(_fromutf8("")) self.combobox.additem(_fromutf8("")) self.combobox.additem(_fromutf8("")) self.combobox.additem(_fromutf8("")) self.combobox.additem(_fromutf8("")) so can see, text put in combo box doesnt show in part of code, show in gui. usually when have user selection, radio

ruby on rails - Passenger: Could not find rake-10.0.4 in any of the sources (Bundler::GemNotFound) -

i have rails app running on debian apache2 + passenger message passenger: error message: not find rake-10.0.4 in of sources (bundler::gemnotfound) the strange thing rake-10.0.4 seems installed: > bundle show gems included bundle: * ... * rake (10.0.4) * ... do have idea come ? ! i think i've been struggling problem - posted solution at: https://stackoverflow.com/a/17088480/1578861 it sounds passenger configuration pointing different version of ruby 1 using run bundler check ruby version rvm using: $ rvm env --path find passenger.conf , update passengerruby - can using config utility provided passenger passenger-config --ruby-command make sure use use qualified path before passenger-config (to avoid frustrating late night mistake )

exit code - There's "0 but true", but is there "42 but false" in perl? -

as per question. know there's "0 true" true in boolean context false otherwise, can return false in boolean context non-zero value (the obvious place return statuses 0 success , else error). no. (except fun dualvars , overloaded objects) the truthiness of perl scalar depends on string value. if no string value present, numeric field used. false values are: undef , "" , 0 , , avoid issues testing stringification first: "0" . not numerically 0 evaluates false: "0e0" true, more self-documenting "0 true" . latter special-cased avoid non-numeric warnings. however, enter dualvars . numeric , stringy field of scalar don't have in sync. common dualvar $! variable errno in numeric context, error string containing reason string. possible create dualvar numeric value 42 , string value "" , evaluate false. use scalar::util qw/dualvar/; $x = dualvar 42, ""; $x; # empty string 0+$x; # force num

c - Why getppid() from the child return 1 -

i running program #include<stdio.h> #include <unistd.h> main() { pid_t pid, ppid; printf("hello world1\n"); pid=fork(); if(pid==0) { printf("i child\n"); printf("the pid of child %d\n",getpid()); printf("the pid of parent of child %d\n",getppid()); } else { printf("i parent\n"); printf("the pid of parent %d\n",getpid()); printf("the pid of parent of parent %d\n",getppid()); } } the output got was. $ ./a.out hello world1 parent pid of parent 3071 pid of parent of parent 2456 child pid of child 3072 pid of parent of child 1 i couldnt understand line the pid of parent of child 1 it should have been 3071? because parent process finished time child asks parent's pid. when process finishes, children reassigned children of init process, pid 1. try using wait() in parent's code wa

java - Automatically launching a pre-set configuration in VisualVM -

i trying profile functions in java application using visualvm (eclipse plug-in). right when run application, eclipse opens visualvm , takes me profilers tab can start profiling pressing cpu or memory buttons. unfortunately, in time take manually this, lose significant number iterations in application precise result. i know can set default profiler setting application under tools->options->profiling. there option in visualvm can automatically fire profiler on seeing particular main function/application being launched.

mask - Is there an inverse to the CSS "Clip" property; hide the clipped area? -

the css clip syntax gets define rectangular area of larger image wish visible. there way specify inverse? specify rectangular area of image wish become invisible. punching rectangular hole through page see what's underneath? reason (if have other ideas): want create 3 layer image in cms template. layer 1 (at bottom) background image. layer 2 sits on portion of layer 1 , rectangular screengrab image of a4 document. layer 3 (on top) transparent png (in centre , @ edges) adds border, drop shadow, doc type logo , page curl effect top right of layer 2 document. layers 1 , 2 uploaded separately in cms , css should combine them layer 3 image create effect. problem page curl effect work, top right corner of layer 2 needs masked can see way through layer 3 layer 1. hoping clip property allow me specify small square in top right corner of layer 2 should invisible . alternative: use graphics program combine layers 1 , 3 , leave transparent area layer 2. correct positioning place n

node.js - hesitation between two technologies for a little program -

i want make program (more precisely, service) periodically scans directories find video files (.avi, .mkv, etc) , automatically download associated files (mostly subtitles) 1 or several websites. program run on linux or windows well. on 1 hand, know qt long time , know benefits, on other hand, i'm attracted node.js , extreme flexibility , liveliness. i need offer interactivity end user of program (for instance, chose scans directories, etc). what best choice in opinion in 2013? i advise against node.js "small tools , programs". iterative tasks. the long story the reason quite way node.js works. asynchronous model makes simple tasks unnecessarily convoluted. additionally, because many callbacks called node.js event loop, can't use try/catch structures every tiny error crash whole application. of course there ways catch errors or work them , docs advise against of them , advise restart application gracefully in case prevent memory leaks.

Code for sending emails from Moodle Forum -

can know code sending emails forum? when replay on post in forum user received emails, need change email , grateful if 1 tell me code (function) send email. best regards, jordan if understand correctly may need utilise built in function 'email_to_user' found in /lib/moodlelib.php. function email_to_user($user, $from, $subject, $messagetext, $messagehtml = '', $attachment = '', $attachname = '', $usetrueaddress = true, $replyto = '', $replytoname = '', $wordwrapwidth = 79)

php - Magento : Get data from Varien_Data_Collection -

Image
hiho everybody! hope you'll give me clue because i'm still noob magento. i try display list of products in array. in mage/catalog/block/product/list.php , created new varien_data_collection() in pushed products objects (with ->additem($product) ). then return custom collection , list.php class work display list of products. when call page in browser, had right number of displayed products , when click on see product page, right page. however, data (like product name, price, etc) empty. guess methods used list class catch these data fail varien_data_collection object. to illustrate, here code sample : // getting particular product $mainproduct = mage::getmodel('catalog/category')->load($currentcat->getid()); $mainproduct = $mainproduct->getproductcollection(); $mainproduct = $mainproduct->addattributetofilter('product_id', $_get['cat_id']); // creating custom collection $mycollection = new varien_data_collec

maven - How do you handle multiple versions of same jar? -

i use apache_gora_0.2.1 , apache nutch_2.1 . nutch depends on gora. gora have modules gora-core , gora-hbase. gora-hbase depends on gora-core. all modules of gora use avro_1.3.3.jar . want use avro_1.3.3.jar gora-core , avro_1.5.3.jar gora-hbase . i compiled gora via maven , compiled nutch via ant , ivy. then seems 2 versions in nutch classpath (avro.1.3.3.jar , avro.1.5.3.jar). if exclude avro_1.5.3.jar via ivy.xml, gora-hbase don't use avro.1.5.3. how can solve problem? you should avoid situation when have in classpath same jars different versions. solve problem need find version of apache_gora_0.2.1 , apache nutch_2.1 uses similar versions of avro. try use apache nutch_1.6, since apache_gora_0.2.1 latest version. then, exclude lowest version , solve problem.

MySQL IF statement in a trigger- ELSE don't do anything -

i trying build trigger in mysql run after new rows inserted table. if there error detected, want write trigger table. otherwise, don't want write error table. want try , avoid adding endless blank rows. here code: create trigger character_validation4 after insert on address each row begin if(new.city regexp '^[^a-za-z0-9]') insert errorlog (city, mainprocessid) values("there error city", new.id)); end but seeing error on final bracket. can help? thanks delimiter \\ create trigger character_validation4 after insert on address each row begin if(new.city regexp '^[^a-za-z0-9]') insert errorlog (city, mainprocessid) values("there error city", new.id); end if; end \\ delimiter ;

model view controller - Spring: link between WebApplicationContext and ApplicationContext? -

i working on spring application. started creating small java app using spring. later, became necessary add web interface. decided use spring mvc. confused. in web.xml have <context-param> <param-name>contextconfiglocation</param-name> <param-value> /web-inf/mvc-dispatcher-servlet.xml, /web-inf/applicationcontext.xml </param-value> </context-param> where mvc-dispacher-servlet.xml contains beans necessary web logic while applicationcontext.xml contains beans performing specific operations. question is: beans in these files going aware of each other? going 1 big container includes beans both config files? or these containers separate? yes in 1 context loaded web application context. same when using application context , passing in multiple files it.

java - Bar chart not functioning the way I would want it -

i hoping if can me coding. i'm attempting create bar chart doesn't seem going my. m trying make output below when run [red, yellow, blue](0) repeating. feel i'm close solving this. if can push me in right direction in can appreciated greatly. import java.util.hashset; import java.util.arrays; import java.util.set; public class test { /** * @param args */ public static void main(string[] args) { // todo auto-generated method stub //these arrays not modified , should use these 2 arrays. short[] points ={1,2,1,1,1,1,1,1,3,4,1,5}; string[] teams ={"red","yellow","blue","blue","blue","red","yellow","red","yellow","red","blue","blue"}; set<string> uniqueteams = new hashset<string>(arrays.aslist(teams)); barchart(points, teams, uniqueteams); } public static void barchar

php - Setting plimus API in order to fetch an authentication token -

i need set plimus api in order fetch authentication token , use log customer plimus platform. i'm using following code: $url = "https://sandbox.plimus.com/services/2/tools/auth-token?shopperid=$shopperid&expirationinminutes=$expiration"; // use base64 encode credentials $authorization = base64_encode($username.':'.$password); $ch = curl_init(); // set url curl_setopt_array($ch, array(curlopt_url => $url)); // set headers curl_setopt($ch, curlopt_httpheader, array("authorization: basic $authorization", "content-type: application/xml")); // line mandatory every api call! // set http request curl_setopt($ch, curlopt_customrequest, "get"); // service (get token) implement via restful get, other services might use post , put // stop output of curl_exec standard output (don't send output screen) curl_setopt($ch,curlopt_returntransfer,1); // make http call , read response xml object $xml = new simplexmlelement(cur

Calling a Method from View ASP.NET MVC -

i'm getting start asp.net mvc. i'm having below in controller class. public actionresult test() { return view(); } public string myname() { return "chamara"; } how can print return value myname() method on test view? in controller, modify test() action so: public actionresult test() { viewdata["myname"] = "chamara"; return view(); } then in test.aspx view, can display name <%= viewdata["myname"] %> . even better, dave alludes in comment, create model information want display , create strongly-typed view knows how display information.

ios - Iphone: Audio Asset track not found when audio is created as a file, runtime in application -

when select audio asset,i noticed audio asset track not found in selected asset. " audio created runtime file "(means created in application , saved in document directory). i have used code link below ... work when audio selected resources in project not in case ( my case: audio created in app file , saved in doc. dir. ) https://stackoverflow.com/a/12630437/1328096 you can use statement check sound of video if([[songasset trackswithmediatype:avmediatypeaudio] firstobject]==null) { nslog(@"sound not present"); } else { nslog(@"sound present"); //you initalise things avassettrack *sourceaudiotrack = [[songasset trackswithmediatype:avmediatypeaudio] objectatindex:0]; }

asp.net - Simultaneously writing to same table with Entity Framework -

developing web site (using entity framework) have encountered in following questions: 1.what happens if lot (lets 10,000) people trying "to write" simultaneously same specific table in db (sql server) via entity framework ? 2.in project have modules , decoupling reasons using singleton class (modulesmanager) should take action each module , execute asynchronous following: public void insertnewrecord(action addnewrecordaction) { if (addnewrecordaction != null) { addnewrecordaction.begininvoke(recordcallback, null); } } is approach use singleton class place responsible write db ? 3.does entity framework can provide same speed using sql queries ? what happens if lot (lets 10,000) people trying "to write" simultaneously same specific table in db (sql server) via entity framework ? if mean inserting same table insert processed based on transaction isolation level in database. single transac

android - accessing JSON files, AsyncTask error -

there json output: {"status":"error","data":null,"message":"required parameters not available."} to access there json parsing java class , user function java class. i having confusion on accessing json file on loginactivity inside asynctask. task throws null pointer exception. think not referring "status" causing ... real reason why ?? new android have no idea. please help. code follows: jsonparser.java public class jsonparser { static inputstream = null; static jsonobject jobj = null; static string json = ""; static int = '1'; static int post ='2'; // constructor public jsonparser() { } public jsonobject getjsonfromurl(string url, list<namevaluepair> params, int method) throws urisyntaxexception { defaulthttpclient httpclient = new defaulthttpclient(); httpresponse httpresponse = null; httpentity httpentity = nu