Posts

Showing posts from March, 2012

android - FacebookAuthorizationException: User logged in as different Facebook user -

android - FacebookAuthorizationException: User logged in as different Facebook user - i putting simple android activity displays facebook placepicker. when user selects place list, should post selection wall. should not require login button; app not request permissions ( publish_actions in case) until needed. my placepicker works fine. places expect loaded, , selecting 1 triggers appropriate function, requestnewpublishpermissions() phone call fails every time. exception beingness thrown is: com.facebook.facebookauthorizationexception: user logged in different facebook user. i have been able find 2 other discussions online include error message, , neither of them of help me. have logged out of facebook app, logged out of facebook on mobile browser, , still throws same exception. what heck going on here? oncreate() log.d(tag, "checkin: oncreate"); super.oncreate(savedinstancestate); isshared = false; setcontentview(r.layout.activity_checkin); initloca

c# - Using Entity Framework Efficiently -

c# - Using Entity Framework Efficiently - i'm using entity framework in asp.net mvc project. need know if i'm dealing correctly next scenario. lets employee table has on 100000 records , have apply various filtering according client requirement. so write 1 method readall() retrieve records database , apply filtering datasource using lambda expressions. ex: employee id public list<employee> readall() { // homecoming list<employee> } private employee(int id) { employee obj=readall().where(o=>o.empid == id).first(); } i'm trying utilize 1 read method because there various filtering applied , not have write separate database access methods each of them. will impact application performance adversely? change readall homecoming iqueryable won't execute query until after you've applied filter , called first() or tolist(). public iqueryable<employee> readall() { // homecoming list<employee> } entit

Form - Passing array from controller to view - PHP - Laravel -

Form - Passing array from controller to view - PHP - Laravel - i'm new laravel, , i'm not sure know i'm doing. have form in main view. i'm passing input controller, , want info displayed in view. can't seem array controller sec view. maintain getting 500 hphp_invoke. here's i'm passing array controller view2. public function formsubmit() { if (input::post()) { $name = input::get('name'); $age = input::get('age'); $things = array($name, $age); homecoming view::make('view2', array('things'=>$things)); } } view1.blade.php {{ form::open(array('action' => 'controller@formsubmit')) }} <p>{{ form::label('name') }} {{ $name = form::text('name') }}</p> <p>{{ form::label('age') }} {{ $age = form::text('age') }}</p> <p>{{ form::submit('submit') }}</p> {{ form:

sorting - jqGrid place sort arrow icon on the left -

sorting - jqGrid place sort arrow icon on the left - how can place sort arrow icon on left in filter headers? i see problem implementation because arrows container (s-ico) within container header (ui-jqgrid-sortable) ... <div id="jqgh_mylist_pdate" class="ui-jqgrid-sortable"> date <span class="s-ico"> <span sort="asc" class="ui-grid-ico-sort ui-icon-asc ui-state-disabled ui-icon ui-icon-triangle-1-n ui-sort-ltr"></span> <span sort="desc" class="ui-grid-ico-sort ui-icon-desc ui-icon ui-icon-triangle-1-s ui-sort-ltr"></span> </span> </div> a long time seek find reply question , made own solution difference between sortable , not sortable columns in style in first span tag - display:none in begin tried observe sortable columns utilize :hidden selector, columns have blank spans , selector homecoming true both

javascript - How to implement the simplepagination plugin that i'm using with php? -

javascript - How to implement the simplepagination plugin that i'm using with php? - this html php code: <?php $sql = mysqli_query($con, "select * blog_posts poststatus = 'accepted' order date_accepted desc"); while($row = mysqli_fetch_array($sql)) ?> <article> <?php echo $row['posttitle']." posted on ".date('js m y', strtotime($row['postdate']))." ".$row['postdesc']; ?> </article> <?php } } ?> <div id="selector"> <ul class="selector"> <li> <p>one</p> </li> <li> <p>two</p> </li> <li> <p>three</p> </li> <li> <p>four</p> </li> <li> <p>five&l

postgresql - Copy From csv to postgres -

postgresql - Copy From csv to postgres - i having problem using re-create command in postgresql import info in csv file. first created table in postgresql next code. create table sfmap ( address varchar(100), city varchar(50), state varchar(5), zip varchar(6), county varchar(20) ) i used next code re-create info in table. copy sfmap(address, city, state, county) 'h:\sfmap.csv' delimiter ',' csv header every time this, follow error message. error: not open file "h:\sfmap.csv" reading: no such file or directory sql state: 58p01 i sure location of file correct. have tried using forwards slash, 2 backwardslashes. don't see doing wrong. copy command must run postgres superuser. might worth checking that. postgresql csv

php - sql query to select count of only max value from table -

php - sql query to select count of only max value from table - partyname state constituency candidatename district votes bjp maharashtra nagpur-east nitin gadkari nagpur 1200 aap maharashtra nagpur-east arvind kejriwal nagpur 750 bjp maharashtra nagpur-west vicky nagpur 4800 aap maharashtra nagpur-west lucky nagpur 3500 bjp maharashtra nagpur-north rakesh nagpur 100 aap maharashtra nagpur-north ravan nagpur 1500 below expected output above table query select max vlue votes grouping partyname , constituency , display below output. partyname count bjp 2 aap 1 bcoz bjp leads nagpur -east , nagpur west so display count 2 and aap leads nagpur - north display 1 count. plz suggest me query...... you can seek this: select max(votes) tablename grouping constituency

Posting to friend's wall using Facebook API (Python) -

Posting to friend's wall using Facebook API (Python) - i trying post friend's wall on behalf, using next code: import facebook graph = facebook.graphapi(token) graph.put_object("/1000000000007/feed", "feed",{'message':'test'}") # `1000000000007` right user id the code above doesn't work - i've tried different syntaxes seems cannot right. i have no problem posting on own wall, have publish_stream permission. it not possible (anymore) post wall of friend, no serious app anyway. also, publish_stream deprecated, should utilize publish_actions if want post on wall of authorized user. python facebook facebook-graph-api

java - Compile error "The final field cannot be assigned" for non final static variable in Eclipse -

java - Compile error "The final field cannot be assigned" for non final static variable in Eclipse - why compiler in eclipse says "the final field cannot assigned" non final static variable declared in class? java android eclipse

c# - Clickonce manifest postactions -

c# - Clickonce manifest postactions - i have vsto application using clickonce, , using post-deployment action, whitch done http://msdn.microsoft.com/en-us/library/bb772100.aspx set document of solution onto end user's computer (document-level customizations only) <vstav3:postactions> <vstav3:postaction> <vstav3:entrypoint class="clickoncelibrary.clickoncelibrary"> <assemblyidentity name="clickoncelibrary" version="1.2.0.8" language="neutral" processorarchitecture="msil" /> </vstav3:entrypoint> </vstav3:postaction> </vstav3:postactions> mage -sign foo.dll.manifest -certfile soft_certificate.pfx -pwd bar mage -update foo.vsto -appmanifest "application files\foo_1_2_0_8\foo.dll.manifest" -certfile "application files\foo_1_2_0_8\soft_certificate.pfx" -pwd bar so after signing clickonce manife

asp.net - unable to use telerik mvc extension under area like admin -

asp.net - unable to use telerik mvc extension under area like admin - i new mvc & telerik mvc control. have added telerik.web.mvc dll (2013.2.611.340) nuget in sample project. have followed next steps configure telerik command (asp.net mvc 4-5) (from url) 1 added under namespaces tag in in web.config 2 added <sectiongroup name="telerik"> <section name="webassets" type="telerik.web.mvc.configuration.webassetconfigurationsection, telerik.web.mvc" requirepermission="false"/> </sectiongroup> in web.config i able utilize extension command in rood site, unable reference in area admin area. anyone help figure out ? found there no issue extension. real issue area. unable intellisense of html helper (not 3rd party telerik) in advance. telerik mvc extensions deprecated while ago. you want @ telerik kendo ui. asp.net asp.net-mvc telerik-grid

html - how to remove shadow-root (user-agent) -

html - how to remove shadow-root (user-agent) - i wrote in html is, <asp:textbox id="txtcomment" runat="server" onkeyup="loadvalues(this,250)" maxlength="250"></asp:textbox> but chrome browser shows <input name="birthdaywish1$txtcomment" type="text" maxlength="250" id="birthdaywish1_txtcomment" onkeyup="loadvalues(this,250)"> #shadow-root(user-agent) <div id="inner-editor"></div> </input> i want remove #shadow-root(user-agent) because input field shows greenish color segments. i found error comes external css class. have given greenish color image this case problem. input[type=text],input[type=password],textarea{color:#626262;display:inline-block;background:#fff url(../images/forminput.gif) top left repeat-x;border-radius:2px;width:100%;border:1px solid #ccc;height:17px;margin:2px 0;padding:2px 1px;}

vba - Refresh user-defined function when input values change -

vba - Refresh user-defined function when input values change - hi have problem getting user-defined function created refresh when input values change. in fact, input values "governed" macro , why think function not triggered (in fact, getting refreshed delayed "1 step". , using application.volatile :) can please help me? :) here function: public function avcolor(byref myrange range) double activesheet.unprotect application.volatile dim sum integer sum = 0 dim count integer count = 0 each cell in myrange if cell.interior.colorindex = 3 sum = sum + 1 elseif cell.interior.colorindex = 44 sum = sum + 2 elseif cell.interior.colorindex = 6 sum = sum + 3 elseif cell.interior.colorindex = 43 sum = sum + 4 elseif cell.interior.colorindex = 33 sum = sum + 5 elseif cell.interior.colorindex = blank sum = sum end if count = count + 1 next cell avcolor = round(sum / count) activesheet.protect end function and here macro used whol

Logstash pipe elasticsearch through ssl? -

Logstash pipe elasticsearch through ssl? - i'm not sure if possible - i'm pretty new using logstash (watched talk few weeks , started toying today). problem this: i have several machines out on big, bad net need ship logs home. have elasticsearch setup behind nginx reverse proxy that's going handle ssl me on central log point. but client machines as400 beasts, can't fun run logstashforwarder (lumberjack) on them. given i've seen of logstash, think might possible this: (most inputs) --> elasticsearch output --> <something> --> https output --> (scary internet) --> nginx --> elasticsearch would work? , if so, how that? what appears work using logstash forwarder protocol. have on central logserver logstash instance running so: $ bin/logstash -e 'input { lumberjack {port => 7766 ssl_certificate => "my.crt" ssl_key => "my.key"} } output { elasticsearch { host => localhost } }' an

ios - Dependencies in Xcode Workspaces -

ios - Dependencies in Xcode Workspaces - i'm trying set workspace different projects can access same files. in project a, did "save workspace..." then created project b in new workspace. i can see both in project navigator. so have category in project called "uiview+awesome" want utilize in project b, how set dependency? in view controller of project b this: #import "uiview+awesome.h" //uiview+awesome.h file not found here how solve it. click on target that's importing uiview+awesome.h . click on build settings. enter header search paths search box. double click on value cell. click + sign. set path project you're referring. let's it's called awesomelib . path relative root of referring project (the project that's using awesomelib ). example: ../awesomelib/src/headers/ or wherever .h file lives. click done . clean , build . ios xcode workspace

Pass generic list in console app from asp.net -

Pass generic list in console app from asp.net - i have solution need phone call console app asp.net , need pass variables. 1 variable generic list of class. i have tried passing got error cannot convert generic list string correct. i not sure if there way pass this. i know webservice can solve issue. there other options? is possible or string possible pass here generic list sample. list<person> personlist = new list<person>(); person p = new person(); p.name = "test"; p.age = 12; p.birthdate = 01/01/2014 personlist.add(p) thanks. ok, console application accepts strings. defined in main method static void main(string[] args) since have complex object list it'll bit hard pass info console application (but not impossible). there several options you. pass values comma separated values string long string not long. web services or web api suggested. serialize object xml file , deserialize in console application. write , r

Perl Regex not finding pattern within script -

Perl Regex not finding pattern within script - i'm reading contents of log file, performing regex on lines , putting results in array, reason there no output. use strict; utilize warnings; $logfile = "log.file"; $outfile = "out.file"; open(log, "$logfile") or die ("could not open $logfile: $!\n"); open(tmp, ">", "$outfile") or die ("could not open $outfile: $!\n"); @data = (<log> =~ /<messagebody>(.*?)<\/messagebody>/sg); print tmp "this test line. \n"; foreach (@data){ print "@data\n"; print "\n=======================\n"; } close tmp; close log; my output file (out.file) , content "this test line." know regex works because tried @ prompt with: -lne 'begin{undef $/} while (/(.*?)</messagebody>/sg) {print $1} log.file > test.file what doing wrong? your info spans lines. you'll hence need slurp enti

php - How load phtml of custom module in magento -

php - How load phtml of custom module in magento - i need know how load phtml on custom module... i need load phtml file on blocks...in magento my code bellow.....i m creating module learning purpose ..... what best way load phtml in custom block... and if have model,controller other mvc... then need of block in magento.. my controller ----------- class packt_new_indexcontroller extends mage_core_controller_front_action { public function indexaction() { echo "this new controller "; } public function newaction(){ $this->loadlayout(); $this->renderlayout(); } } config.xml ---------------- <?xml version="1.0" encoding="utf-8" ?> <config> <!-- module configuration --> <modules> <packt_new> <version>0.0.1</version> </packt_new> </modules> <!-- module configuration end --> <global> <b

android - Center aligned selection with animation in ListView (?) -

android - Center aligned selection with animation in ListView (?) - i need component works image below i'm having problem coming kind of decent solution works. i want list have center locked selection beingness scrollable d-pad. application running on tv no need touch scroll. when pressing downwards on remote d-pad list scroll , new item size , current selected 1 size downwards , new selection still in middle. i've tried doing using listview extended , programmatically scrolling when pressing downwards or up. on scroll finished called notifydatasetchanged() on listview re-inflating of childs , in listviews adapters getview() made animation of view located @ current selected position. this not optimal since need phone call notifydatasetchanged(), re-inflates visible views, animation apply. ui becomes laggy when doing , scrolling fast. it's not possible create som kind of compress animation when current selected item goes out of selection. there problem

c# - Execute multiple controller actions in one call with MVC.Net 5 -

c# - Execute multiple controller actions in one call with MVC.Net 5 - we have upgraded our code base of operations .net 4.0 .net 4.5.1 , mvc 2.0 mvc 5.2.2. we have custom method in our base of operations controller class allowed update multiple parts of our views within single request. since upgrading, no longer works. original code: class="lang-cs prettyprint-override"> protected void includeaction(string actionname, string controllername, object routevalues) { //get url routevaluedictionary routes = null; if (routevalues != null) routes = new routevaluedictionary(routevalues); else routes = new routevaluedictionary(); routes.add("action", actionname); if (!string.isnullorempty(controllername)) routes.add("controller", controllername); else routes.add("controller", this.controllercontext.routedata.values["controller"].tostring()); var url = routetable.

Android: notifydatachanged not updating listview -

Android: notifydatachanged not updating listview - when user clicks item on list view, changing background color manually of selected listview item. plan on changing more background, (eventually icons , more), hence need listview redraw itself. the problem when notifydatachanged nil happens. because of log's placed in functions, when item clicked, can verify onitemclick triggered, , notifydatasetchanged phone call made adapter. i expect "getview" should called 1 time again each position, info gets linked views. not occuring. there no sign of of happening. missing here? class myonitemclicklistener implements adapterview.onitemclicklistener{ @override public void onitemclick(final adapterview<?> parent, view view, final int position, long id) { log.i(tag, "listview on click " + position); mylistadapter adapter = (mylistadapter) parent.getadapter(); adapter.mselected = posi

java - Not a valid identifier error in UNIX -

java - Not a valid identifier error in UNIX - while using unix got java : command not found error. referred stack overflow post java command not found on linux. when gave path of java suggested in reply of above post (c:\program files\java\jdk1.6.0_41\jre ), got export: `filesjavajdk1.6.0_41jre': not valid identifier. please help me out here. java unix

How to share data between two modules in AngularJS? -

How to share data between two modules in AngularJS? - i using angularjs along c# mvc. have home page user enters info , should passed sec module utilize info processing , decisions. have utilize info entered or updated in first module within sec module. can help me how accomplish this? hope next implementation help understanding. angular.module('app.a', []) .service('servicea', function() { this.getvalue = function() { homecoming this.myvalue; }; this.setvalue = function(newvalue) { this.myvalue = newvalue; } }); angular.module('app.b', ['app.a']) .service('serviceb', function(servicea) { this.getvalue = function() { homecoming servicea.getvalue(); }; this.setvalue = function() { servicea.setvalue('new value'); } }); angularjs angularjs-module

How do you build the Generic Math Template Library on Windows with Visual C++ -

How do you build the Generic Math Template Library on Windows with Visual C++ - currently, i'm trying implement vector , matrix library project. after searching on web, found suggestion , decided on generic math template library because more focused graphics programming. after downloading source, found out can built (at to the lowest degree less effort) on linux / unix using scons. so, wanted inquire is, how build windows using visual c++? in advance. ps: if have different sentiment selection of library, please don't shy enlighten me. thinking switching on eigen. from did take gmtl? http://sourceforge.net/projects/ggt/files/generic%20math%20template%20library/0.6.1/ if utilize version should include of header files, don't need scons or whatever. c++ windows visual-c++ build

oracle - Sent Email process not working -

oracle - Sent Email process not working - i have question application built in oracle apex 4.2. application has process send emails (when user changes password or requests password reset). when run application online on "apex.oracle.com" account, runs fine. when run on home computer (running windows 7), email process doesn't work. because home server not email server. can please help me home computer able send emails via above mentioned application? thanks in advance. you have several options: configure local smtp server can utilize apex , send emails. connect remote server - google - , sends emails way (you have open new business relationship , connect , there's certificate problems, https://arkatec.wordpress.com/2011/08/15/sending-email-using-oracle-database-and-google-mail-service/) use htmldb_mail bundle (i haven't tried one) in first options need build procedure work you. you can utilize 1 of this: http://www.orafaq.com/wiki/s

c++ - How do I use std::enable_if to enable or disable constructors depending on template types? -

c++ - How do I use std::enable_if to enable or disable constructors depending on template types? - i have next templated object: template< typename type_1, typename type_2 > struct result { // want enable these 2 constructors if type_1 != type_2 result( type_1 f ) : foo{f} {} result( type_2 b ) : bar{b} {} // want enable constructor if type_1 == type_2 result( type_1 f, type_2 b ) : foo{f}, bar{b} {} // other fellow member functions removed. type_1 foo; type_2 bar; }; how utilize std::enable_if enable or disable constructors required? e.g: this 1 have first 2 constructors: result<string,int> // type_1 != type_2 this 1 have 3rd constructor: result<int,int> // type_1 == type_2 this seems working, not sure optimal way so add together new template parameters default values constructor enable sfinae #include <type_traits> template< typename type_1, typename type_2 > struct result {

r - Replace for-loop with apply()? -

r - Replace for-loop with apply()? - i trying optimise r code , have started replacing loops have been implemented “quick , dirty” functions , on. have arrived @ situation believe apply-function handy. cannot wrap head around though. a <- c(10,20,15,43,76,41,25,46) c <- c(2,5,8,3,6,1,5,6) myframe <- data.frame(a,c) newframe <-vector(length=3) constant <- data.frame(a,c,a,a,a,a,a,a,a,a,a,a,c) a.function <- function(frame){ newframe <- frame*22 return(newframe)} result <- matrix(nrow=nrow(myframe),ncol=3) for(i in 1:nrow(myframe)){ newframe <- a.function(myframe[i,]) newframe[ncol(myframe)+1] = newframe[ncol(myframe)+2] = constant[i,9] #more columns added newframe <- rbind(result,newframe) } i have tried cut down loop far possible , hope can still understood. going through rows of dataframe should prime illustration utilize of function. still cannot work. ideas? edit: i've added working e

javascript - First Example in JQgrid -

javascript - First Example in JQgrid - i new jqgrid. want utilize in project. have set php server. want simple operations sorting, grouping, editing, saving etc. comfortable showing data, sort , grouping using jqgrid not sure how show, store , edit info on local server. can help me it? if there working demo please share me. javascript jquery jqgrid jqgrid-php mvcjqgrid

javascript - Create multiple elements in QML XmlListModel -

javascript - Create multiple elements in QML XmlListModel - i trying xml info qml xmllistmodel, i've gotten of working bit lost lastly part multiple category streams. the xml looks this: <root> <fullscreen>false</fullscreen> <aspectratio>default</aspectratio> <audiodelay>0</audiodelay> <apiversion>3</apiversion> <currentplid>4</currentplid> <time>1</time> <volume>0</volume> <length>9907</length> <random>false</random> <rate>1</rate> <state>paused</state> <loop>false</loop> <version>2.1.5 rincewind</version> <position>0.00018763827392831</position> <repeat>false</repeat> <subtitledelay>0</subtitledelay> <category name="meta"> <info name="title"> film </info> <info name="filename">

python - Rotating part of xticks -

python - Rotating part of xticks - on x-axis, display numbers (with no rotation) rotated names below each number. have next separately rotate names 'one', 'two' , 'three'. plt.xticks([1,2,3], ['1\n one', '2\n two', '3\n three'], rotation=45] you can place major , minor ticks @ same positions. here minimum example: class="lang-py prettyprint-override"> import pylab pl pl.clf() ax = pl.gca() ax.set_xticks([1, 2, 3]) ax.set_xticks([1, 2, 3], minor=true) ax.set_xticklabels(['one', 'two', 'three'], minor=true) pl.setp(ax.xaxis.get_minorticklabels(), rotation=-45) t in ax.get_xticklabels(minor=true): t.set_y(-0.03) (with inspiration this answer.) python matplotlib

How to find GUID of Wix Burn executable for programmatically uninstall? -

How to find GUID of Wix Burn executable for programmatically uninstall? - i've created wix bootstrapper project. while installing creates registry key hkey_local_machine\software\microsoft\windows\currentversion\uninstall\{some_guid} so can uninstall using arp.but i'd uninstall programmatically.to need value of {some_guid} search key in registry uninstallstring value. it's impossible info project, because bundle element not have attributes set guid. i found out guid equal bundle's providerkey guid, if providerkey assigned automatically. when seek alter providerkey using bundle "providerkey" attribute 2 guids not equal anymore. each time compile bootstrapper project, assigned new identity—a guid called bundleid cannot change. in respect, every bundle create unique. upgradecode attribute allows link 2 bootstrappers, making them related bundles. relationship allows 1 bundle observe , upgrade installed packages of other. wix unins

Problems with Java particle trail collision for loop -

Problems with Java particle trail collision for loop - so i'm creating simple game play white star attacking ghosts colliding them, if immortal ghost particle trail gets either shorter or resets (as seen in code) problem collision particle trails doesn't seem work properly, collides if ghost hits tail end of it, when should on tail head, , when nail tail end, though remove ghost list, seems run through calculations more once, example, see `score += 5' instead anywhere between 100 , 500 gets added. (int = 0; < entityhandler.getenemies().size(); i++) { enemy e = entityhandler.getenemies().get(i); if (collideswith(e)) { if (e.gettype() == ghost_immortal) { traillife = 100; score -= 100; } else { score += 15; traillife -= 5; } entityhandler.removeenemy(e); } (int k = 0; k < trails.size(); k++) { pa

backbone.js - Backbone project organization -

backbone.js - Backbone project organization - i'm struggling bit coming clean, solid way organize backbone application. i'm using requirejs, handlebars, , requirejs text plugin dynamically load html views. simplify things, let's site has next pages: home: displays collection of products about: static page account: contains business relationship information. products purchased, allows various updates. lots of functionality. has tabs navigate different sections. so i'm going spa loads new pages div ('.backbone-view'). should have general appview el: $('.backbone-view') called when route changes , loads appropriate template? or should have view every page (homeview, aboutview, accountview), el set backbone-view? beyond that...do need model except products? static page, load in html template , that's it. products, need phone call products collection, renders each product view, each of beingness associated product model. that&#

Making an elasticsearch nested query for match on all fields of nested object -

Making an elasticsearch nested query for match on all fields of nested object - the basic question follows: there convenient way specify multi-field match on fields nested query? normal query { match : { _all : "query string" }} works. doesn't work in nested query perhaps because nested object doesn't have _all? the more detailed question below: i have nested document called "parent" follows: { "children" : [ { "field_a": "value_a_1", "field_b" : "value_b_1", "field_c" : [ { "field_c_a" : "value_c_a_1", "field_c_b" : "value_c_b_1" } ] }, { "field_a": "value_a_2", "field_b" : "value_b_2", "field_c" : [ { "field_c_a" : "value_

php - Degrading a jpg image quality each time a user visits a page? -

php - Degrading a jpg image quality each time a user visits a page? - i'm trying work out best way degrade quality of jpeg image in web page http://vimeo.com/3750507 is there server-side way of saving , re-saving @ lower quality displaying image each time page served? thanks in advance. the next script degrade original image 1 'quality point' on each page load, starting @ 99. isn't robust, should demonstrate concept. warning: replace original image! utilize re-create if original important! session_start(); if (empty($_session['quality'])) $_session['quality'] = 99; $file = 'degrade.jpg'; imagejpeg(imagecreatefromjpeg($file), $file, $_session['quality']); $_session['quality']--; header('content-type: image/jpeg'); echo file_get_contents($file); on first page load: tenth page load: one hundredth page load: php image-processing

java - Get message 'deprecated APIs' in GoBackN client/server programs -

java - Get message 'deprecated APIs' in GoBackN client/server programs - my s/w simulation of goback n protocol gives warning- [deprecation] readline() in datainputstream has been deprecated (while reading streams) while running both client & server programs .please tell me solution.is there alternative readline() ? here client/server programs //server programme import java.io.*; import java.net.*; import java.lang.*; public class gobacksender { public static void main(string[] args)throws exception { //establishing connection serversocket ss=new serversocket(4444); system.out.println("waiting connection........"); socket s=ss.accept(); system.out.println("connected client at:"+s); datainputstream in=new datainputstream(system.in); datainputstream in1=new datainputstream(s.getinputstream()); printstream p=new printstream(s.getoutputstream())

python - "lock" resource when user opens and unlocks when he finishes -

python - "lock" resource when user opens and unlocks when he finishes - i using flask version 0.10.1 , python version 2.7.6 i have web application manages orders. let's have 3 orders: order 1 order 2 order 3 there view @main.route(/prder/<int:orderid>, methods=['get']) edit(orderid): pass the view accesible registered users , have user object. let's have users user , user b. when edits order 1 order should not editable user b. i need mechanism "locks" order , order inaccessible edits when user working on order. this "lock" need revoked when user finishes editing* there scenario user closed browser or stopped working on order. not want order "locked" forever. any ideas best way accomplish above functionality? i've never used flask, sounds want mutex (example multi-threading here). behaviour should when b tries edit editing matter. as not beingness locked forever, little more i

javascript - How to open a downloaded file? -

javascript - How to open a downloaded file? - i have link file. how know user clicked on link , download file? need downloadid? google chrome api has method chrome.downloads.open (integer downloadid). how know downloadid, open file? help me please. you can seek illustration code below tested in google chrome version 38.0.2125.111 m (64-bit) chrome.downloads.onchanged.addlistener(function (detail){ console.log("detail",detail); //save log debugging //if file download finished if(detail.state.current == "complete"){ var downloadid = detail.id; //download id console.log("download id",downloadid); //save log debugging /* */ } }); javascript google-chrome-extension

How to convert array object to arguments in javascript -

How to convert array object to arguments in javascript - i have class this: enum = function() { (var = 0, len = arguments.length; < len; i++) { var k= arguments[i]; this[k] = i; } object.freeze(this); }; to create enum of string, phone call : var options = new enum("eat","drink","sleep"); // many arguments if have array of arguments stored in variable. ex: var arg_array = ["eat","drink","sleep"] , how pass new enum(...) use function.prototype.apply : var = {}; enum.apply(a, ["eat","drink","sleep"]); will give you: { "eat": 0, "drink": 1, "sleep": 2 } javascript arrays arguments

sql server - TSQL Sum aggregating multiple columns with a group by -

sql server - TSQL Sum aggregating multiple columns with a group by - hi have 3 tables part of much larger query , trying aggregate of values calculation result doubling sum aggregate totaling rows before grouping occurs. tables: sr01 select * sr01 reportkey = 109626 ac95 select * ac95 reportkey = 109626 ac96 select * ac96 reportkey = 109626 note 2 rows in case query select 'month' [period], isnull(zone.zoneid,'') zoneid, isnull(zone.zonename,'') zonename, isnull(region.regioncode,'') regioncode, isnull(region.regionname,'') regionname, branch.branchid, isnull(branch.branchname,'') branchname, sr01.servicingrep, isnull(lcrep.repname,'') repname, ac95.preptime, ac95.svcpreptime , ac95.traveltime , ac95.svctraveltime , ac95.visittime , ac95.svcvisittime, sum(ac95.preptime + ac95.svcpreptime + ac95.traveltime + ac95.svctraveltime + ac95.visittime + ac95.s