Posts

Showing posts from January, 2014

android - Creating a shadow around a canvas drawn shape? -

what steps required create shape e.g. rectangle shadow scratch using canvas? adding shadow layer paint used draw rectangle yielded no success. no need bitmap, needed set layer type layer_type_software original approach worked. public class testshapeshadow extends view { paint paint; public testshapeshadow(context context) { super(context); paint = new paint(paint.anti_alias_flag); paint.setshadowlayer(12, 0, 0, color.yellow); // important apis setlayertype(layer_type_software, paint); } @override protected void ondraw(canvas canvas) { canvas.drawrect(20, 20, 100, 100, paint); } }

sql - WHERE CASE WHEN statement with Exists -

i creating sql query having where case when statement. doing wrong , getting error. my sql statement like declare @areaid int = 2 declare @areas table(areaid int) insert @areas select areaid areamaster cityzoneid in (select cityzoneid areamaster areaid = @areaid) select * dbo.companymaster areaid in (case when exists (select businessid dbo.areasubscription areasubscription.businessid = companymaster.businessid) @areaid else (select [@areas].areaid @areas) end) i getting error msg 512, level 16, state 1, line 11 subquery returned more 1 value. not permitted when subquery follows =, !=, <, <= , >, >= or when subquery used expression. please run query. logic checking conditional areaid in (statement) each row. i want select row when company has subscription entry areasubscription specific area passed @areaid table areasubscription not have subscription ...

javascript - Why do transparent objects become opaque when animating canvas element? -

i'm trying js app move balls on canvas element. set context.fillstyle = "rgba(12, 34, 56, 0.2)"; problem balls become opaque transparent after short period of time. how can maintain transparency , why become opaque? here simplified version of code: function startscript(){ var layer1 = document.getelementbyid("layer1"); var context1 = layer1.getcontext("2d"); var posx = 5; context1.fillstyle = "rgba(12, 34, 56, 0.05)"; animate(); function animate() { posx+=3; context1.arc(posx, 200, 5, 0, math.pi*2); context1.fill(); // request new frame requestanimframe(function() { animate(); }); } } window.requestanimframe = (function(callback) { return window.requestanimationframe || window.webkitrequestanimationframe || window.mozrequestanimationframe || window.orequestanimationframe || window.msrequestanimationframe || function(callback) { window.settimeout(callback, 1000 / 60); ...

Sleeping / Waiting in a CUDA Thread -

i'm trying write cuda code calculate longest common subsequence. can't work out how make thread sleep until dependencies calculate it's cell satisfied: i.e. // ignore spurious maths here, messy data structures. planning ahead strings bigger gpu blocks. & j correct though. int real_i = blockdim.x * blockidx.x + threadidx.x; int real_j = blockdim.y * (max_offset - blockidx.x) + threadidx.y; char i_char = seq1[real_i]; char j_char = seq2[real_j]; // & j = 1 length if((real_i > 0 && real_j > 0) && (real_i < sequence_length && real_j < sequence_length) { printf("i: %d, j: %d\n", real_i, real_j); printf("i need wait dependancy @ i: %d j: %d , i: %d j: %d\n", real_i, (real_j - 1), real_i - 1, real_j); printf("is true? %d\n", (depend[sequence_length * real_i + (real_j - 1)] && depend[sequence_length * (real_i - 1) + real_j])); //wait dependency satisfied //this need cod...

ruby on rails - Better way to make nested resources? -

in routes.rb have following code create nested paths students , subjects under student_groups : resources :student_groups resources :students, :subjects end i want nest goals under subjects without generating new routes subjects along nested routes goals . i've done via following (plus appropriate stub action in subject_controller ): resources :subjects, :only => :stub resources :goals end this works fine - have functionality of goals being nested under subjects without routes generated if didn't use stub. edit: question this: there better/less hack-y way in rails?

How to open a WPF project with Blend in Visual Studio 2012? -

i'm using visual studio 2012 professional edition , have wpf project. i'd open wpf project blend option doesn't exist in visual studio. should install blend separately? how can make option visible , enable it? look @ video: http://www.microsoft.com/en-us/showcase/details.aspx?uuid=ab9788fc-cd18-474a-942c-61754e9e428b there "open blend" option when right clicking on project. you can initiate new instance of blend 2012 , open corresponding project in that.. basic.. not working?

c# - One ViewModel containing a collection of ViewModels, different Views depending on value of ViewModel property -

i new mvvm-pattern, , trying out caliburn.micro on project. i want have 1 viewmodel (which contains collection of viewmodels) shared multiple views, each view displays items have value on 1 of it's properties. to specific, using service allows me monitor different values update frequently. object of type monitoreditem, contains property of type datavalue , in turn contains object value , property value's datatype. so far have monitoreditemviewmodel uses service's monitoreditem class it's model, , monitoreditemsviewmodel contains bindablecollection<monitoreditemviewmodel> monitoreditems, , commands adding/removing items. i have monitoreditemsview can see items monitoring. how go splitting view, can have monitoreditems datavalue integer/float/double displayed in 1 area in window, boolean values displayed somewhere else etc? don't in view, instead expose different collections on viewmodels according need filter. this can done eithe...

Javascript show multiple table rows from multiple select -

i code show multiple table rows depending on user selects in multiple select item. code shows last selected item reason, please me? code is: if(list[x].selected) { $('table#newspaper-a tr:not(#header, #trweeknummer)').hide(); $('table#newspaper-a tr:not(#header, #trweeknummer)').each(function(){ $('td:nth-child(1)',this).each(function(){ if($(this).text() == list[x].value) $(this).parent(this).show(); }); }); } i have fixed problem myself, solution was: $('table#newspaper-a tr:not(#header, #trweeknummer)').hide(); if(list[x].selected) { $('table#newspaper-a tr:not(#header, #trweeknummer)').each(function(){ $('td:nth-child(1)',this).each(function(){ if($(this).text() == list[x].value) $(this).parent(this).show(); }); }); }

jquery - On which jQgrid event I can apply changes to jQgrid -

i want load jqgrid data(i.e sorted column, sort order, page) cookie jqgrid can take changes cookie when user again reopen page code should take changes cokkie follows: function loadgridfromcookie(name) { var c = $.cookie(name /*+ window.location.pathname*/); if (c == null) return; gridinfo = $.parsejson(c); var grid = $("#" + name); grid.jqgrid('setgridparam', { sortname: gridinfo.sortname }); grid.jqgrid('setgridparam', { sortorder: gridinfo.sortorder }); grid.jqgrid('setgridparam', { page: gridinfo.page }); grid.trigger("reloadgrid"); } my entire code : <script type="text/javascript"> function getdata(jqgridparams) { var params = new object(); params.pageindex = jqgridparams.page; params.pagesize = jqgridparams.rows; params.sortindex = jqgridparams.sidx; params.sortdirection = jqgr...

javascript - An input in a form named 'action' overrides the form's action property. Is this a bug? -

i have form marked <form class="form1" method="post" action="form1.php" style="width:405px"> ordinarily, access action of form in javascript referring .action of form object, example document.forms[0].action which return value form1.php however, if have, component of form, item named "action", "action" becomes content of form's action. is, if form markup contains, example, <input name="action" type="hidden" value="check" /> then document.forms[0].action returns value <input name="action" type="hidden" value="check" /> now, did work out how around this: using document.forms[0].getattribute("action") however, it's nasty gotcha confused me long. bug? known gotcha of dom management? or should habit of using .getattribute()? i not call bug. effect occurs, because attributes can read using element...

inheritance - PHP __DIR__ evaluated runtime (late binding)? -

is somehow possible location of php file, evaluated @ runtime? seeking similar magic constant __dir__ , evaluated @ runtime, late binding. similar difference self , static : __dir__ ~ self ??? ~ static my goal defining method in abstract class, using __dir__ evaluated respectively each heir class. example: abstract class parent { protected function getdir() { // return __dir__; // not work return <<i need this>>; // } } class heir extends parent { public function dosomething() { $heirdirectory = $this->getdir(); dostuff($heirdirectory); } } obviously, problem occurs if parent , heir in different directories. please, take account. also, defining getdir on , on again in various heir classes not seem , option, that's why have inheritance... you can add following code in getdir method of parent class $reflector = new reflectionclass(get_class($this)); $filename = $reflector->getfilename(); return dirname($filen...

delphi - How to use component from the old indy9 package -

i have upgraded indy9 indy10 in delphi7. took time me change parts tcp servers , clients seems works nice now. now, noticed 1 part still not working, , thats idhttpserver component. our applications web page using mootools library. indy9 idhttpserver works perfectly, indy10 something, makes browsers fail display page. besides other errors, there nonsense error (firefox error console output): timestamp: 2013.08.07 13:13:56 error: syntaxerror: missing ] after element list source file: http://192.168.100.2:8780/lib/ui/core/mootools-1.2.4-more-yc.js line: 103, column: 60 source code: unction(){var b=["c?","c ","c","c?","c,","c¢","cÆ’","c£","c"","c¤","c.","c?","Ä,","ă","Ä"","Ä.","Ä?","Ä?","ÄŒ","Ĩ","c? -------------------------------------------------------------^ t...

wpf - Windows Narrator reads the names of all the controls in the window (even hidden ones) -

i need make application visually impaired friendly... , facing problem: windows narrator reads controls names in window despite of them hidden. i have app used winforms write it, , there works fine. after looking in ui spy saw winforms app not exposing hidden controls , wpf exposing controls in window. can it's bug in wpf? i having same problem. based on alexis's answer, wrote code bellow. works me. public class myautocomplete : radautocompletebox { public myautocomplete () { //init stuff here } protected override automationpeer oncreateautomationpeer() { return new myautomationpeer(this); } } internal class myautomationpeer : radautocompleteboxautomationpeer { public myautomationpeer(frameworkelement owner) : base(owner) { } protected override list<automationpeer> getchildrencore() { return new list<automationpeer>(); } }

asp.net - Blue Border around asp link button -

i have 2 asp linkbuttons encompass img tags within themselves. markup below: <asp:linkbutton id="default" runat="server" onclick="calldefaultfunction" onclientclick="default();"> <img style="border:none;" src="../images/btnsetdefault.png" alt="" id="imgdefault" onmouseover="this.src='../images/btnsetdefaulthover.png'" onmouseout="this.src='../images/btnsetdefault.png'" /> </asp:linkbutton> <asp:linkbutton id="delete" runat="server" onclick="calldeletefunction" onclientclick="return confirmondelete();"> <img style="border:none;" src="../images/btndelete.png" alt="" id="imgdelete" onmouseover="this.src='../images/btndeletehover.png'" onmouseout="this.src='../images/btndelete.png'" /> </asp:linkbutton> and below scr...

linux - How to run shortkeys using Python? -

i understand, can execute linux shell commands using subprocess import subprocess subprocess.call(["ls", "-l"]) what if want run ctrl + c action on terminal? my use case is: 1> open linux screen 2> run command on first window 3> create window in same screen 4> run command on second window it pretty obvious want automate part of daily routine. aah! found solution you; if use ubuntu or backtrack (a debian based linux flavour) can install this: apt-get install xautomation and invoking keystrokes little easier, people coding in english, more complicated: from subprocess import popen, pipe control_f4_sequence = '''keydown control_l key f4 keyup control_l ''' shift_a_sequence = '''keydown shift_l key keyup shift_l ''' def keypress(sequence): p = popen(['xte'], stdin=pipe) p.communicate(input=sequence) keypress(shift_a_sequence) keypress(control_f4_...

Doclava cannot find symbol SystemProperties (Android javadoc) -

i running doclava (javadoc android-style doclava doclet) on existing codebase. @ stage i'm using javadoc via simple command line, not ant or eclipse issue. i've paths seem necessary jar , source files , have closed off large number of warnings already. codebase builds , runs fine. however, left instances of 1 particular warning: com.blah.blah.filename:42: error: cannot find symbol import android.os.systemproperties; ^ symbol: class systemproperties location: package android.os does have suggestions need remove last warning? i've found answer of sorts. see where android.os.systemproperties? . essentially, android.os.systemproperies internal class deliberately 'hidden' published sdk api , shouldn't in use. because hidden @hide it's invisible javadoc / doclava, hence error. the ideal answer original question have been 1 somehow pacified javadoc without having mod source code. don't think possible if out th...

partitioning - PostgreSQL cannot drop index on partition -

i have several partition tables indexes on them. indexes can seen in response of select indexname pg_catalog.pg_indexes; but when i'm trying make drop index my_index_name; returns error declaring there no index my_index_name. how can drop indexes? could related search_path . try dropping index prefixed schema. eg. select schemaname,tablename,indexname pg_indexes indexname = 'my_index_name' using results of query, drop index: drop index some_schema.your_index_name;

javascript - ZF2- Can't hide select options on Zend\Element\Select -

i'm working on zf2 , i'm trying set 2 dependent dropdowns using javascript. began trying hide options second select field when firest changed. this form : $this->add(array( 'type' => 'zend\form\element\select', 'name' => 'category_list', 'options' => array( 'label' => 'event category ', 'style' => 'display:none;', 'value_options' => array( ), ), 'attributes'=> array( 'id'=>'list1', 'onchange'=>'hide()' ) )); $this->add(array( 'type' => 'zend\form\element\select', 'name' => 'subcateg_list', 'options' => array( ...

programmatically edit script in Google Drive document -

i have google drive document writes values google drive spreadsheet using google apps scripts. the script associated document looks lot this: // must change value actual spreadsheet id robproject.spreadsheetid = "spreadsheetid"; function onopen() { // stuff; } each time create spreadsheet , related documents, manually change value spreadsheetid spreadsheet's id documents know spreadsheet should write values. i programmatic way fill in correct value spreadsheetid documents' scripts. when search "edit scripts programmatically," tutorials creating google apps scripts, not editing scripts scripts. there way edit google apps scripts google apps script? if understand correctly, working document , spreadsheet. document needs know id of spreadsheet. there ways access google apps script code through api, standalone projects, not container-bound scripts (unfortunately). you consider using naming convention document , spreadsheet us...

c - Function pointers - pass arguments to a function pointer -

i have problem code uses function pointers, take look: #include <stdio.h> #include <stdlib.h> typedef void (*vfuncv)(void); void fun1(int a, double b) { printf("%d %f fun1\n", a, b); } void fun2(int a, double b) { printf("%d %f fun2\n", a, b); } void call(int which, vfuncv* fun, int a, double b) { fun[which](a, b); } int main() { vfuncv fun[2] = {fun1, fun2}; call(0, fun, 3, 4.5); return 0; } and produces errors: /home/ivy/desktop/ctests//funargs.c||in function ‘call’:| /home/ivy/desktop/ctests//funargs.c|11|error: many arguments function ‘*(fun + (unsigned int)((unsigned int)which * 4u))’| /home/ivy/desktop/ctests//funargs.c||in function ‘main’:| /home/ivy/desktop/ctests//funargs.c|16|warning: initialization incompatible pointer type [enabled default]| /home/ivy/desktop/ctests//funargs.c|16|warning: (near initialization ‘fun[0]’) [enabled default]| /home/ivy/desktop/ctests//funargs.c|16|warning: initialization incompatible ...

plot - R: plotting neighbouring countries using maptools -

say plotting countries on world map using maptools, if plot country, there way of plotting countries border country in different colour? using shapefile wrld_simpl comes maptools, plot china: plot(wrld_simpl[wrld_simpl$name=='china',], col='red', add=t) is there way can plot bordering countries china. want able lots of different countries i'd ideally want general solution, not 1 specific china. how gtouches or gintersects in rgeos ? library(rgeos) library(maptools) wc <- subset(wrld_simpl, name == "china") world <- subset(wrld_simpl, !name == "china") create vector store test: tst <- logical(nrow(world)) do test: for (i in 1:nrow(world)) { tst[i] <- gtouches(wc, world[i,]) } see result: levels(world$name)[world$name[tst]] [1] "india" "russia" plot(wc) plot(world[tst, ], add = true, col = "grey") (no further correspondence on world affairs entered into, gintersects...

Assign a user input string as a new variable name in javascript -

i have text field in user inputs text. i'd take first word of text , turn global variable name object holding rest of string content. more string content added object later, internal indexing inside object required. var textinput = $('#inputtext').val(); var splitstring = textinput.split(" "); var firstword = splitstring[0]; this stuck. how please create new object string referenced firstword object's reference? many in advance. i try this: globaluserobjects = {}; var textinput = $('#inputtext').val(); var splitstring = textinput.split(" "); var firstword = splitstring[0]; globaluserobjects[firstword] = {}; // later can add stuff globaluserobjects[firstword]["firstname"] = "john"; globaluserobjects[firstword]["lastname"] = "smith";

vb.net - Generating Three Unique Random Numbers in Visual Basic? -

i have been working on app lately displays 3 random photos. form consists of 3 pictureboxes , button. when user clicks button, 3 different images shown. problem is, however, these 3 images not unique, of time there doubles , triples too. tried implement function catch succeeded @ lowering chances of identical images. there on 50 images choose from, it's not there isn't enough. here code failed solution came with: private sub button1_click(byval sender system.object, byval e system.eventargs) handles button1.click randomimageone() randomimagetwo() randomimagethree() if imagenumber1.text or imagenumber2.text = imagenumber3.text randomimagethree() end if if imagenumber1.text or imagenumber3.text = imagenumber2.text randomimagetwo() end if if imagenumber3.text or imagenumber2.text = imagenumber1.text randomimageone() ...

php - How to quickly check what variables exist from a bunch of vars? -

if have 10 variables set, other times unset, there quick way echo ones exist without throwing exception? these vars come user input. i write if ($var_1 != null) { echo $var_1; } if ($var_2 != null) { echo $var_2; } if ($var_3 != null) { echo $var_3; } if ($var_other_1 != null) { echo $var_other_1 ; } if ($var_other_2 != null) { echo $var_other_2 ; } etc.. there more quicker way? compact function you

asp.net - disable button on master page -

on master page have rad menu. on page uses master page able make menu visible coded me.master.findcontrol("mymenu").visible = true do know how make 1 of buttons on menu disabled? kick hard , have end in wheelchair? or mean ask 'do know how disable 1 of buttons on menu?' maybe looking me.master.findcontrol("mymenu").enabled = false but i'm not sure property exists control...

What does the ~1 mean in this git reset command? -

git reset head~1 i under impression ~1 meant: start @ head, follow 1 link, , set head tag new commit node. expecting git reset head~2 to follow 2 links , set head tag. however, if try it, error: $ git reflog c83bbda head@{0}: reset: moving head~1 44c3540 head@{1}: commit: garbage c83bbda head@{2}: reset: moving head~1 aee7955 head@{3}: commit: 4 lines c83bbda head@{4}: reset: moving head~1 19ec1d5 head@{5}: commit: 3 lines c83bbda head@{6}: reset: moving head~1 a049538 head@{7}: commit: added new line c83bbda head@{8}: commit (initial): first commit $ git reset --hard head~2 fatal: ambiguous argument 'head~2': unknown revision or path not in working tree. use '--' separate paths revisions, this: 'git <command> [<revision>...] -- [<file>...]' apparently mistaken, doc page git reset not useful in clarifying this. so, ~1 mean , why need it? head~1 "the first parent of head ", while head~2 "the firs...

java - Annotations "not applicable to type" -

i quite new intellij being eclipse user many years, find error annotations expect @override showing error "not applicable type" e.g @postconstruct annotation jboss errai showing errors around, import there no error @ all. how fix this? update: e.g @postconstruct // when hovered mouse pointer '@postcontruct' not applicable method public void init() { } screenshot: http://snag.gy/q5cw5.jpg looking @ definition, 1 sees @target mentioning method . might have imported totally different postconstruct annotation. inspect imports / go definition in intellij. package javax.annotation; @documented @retention(value=runtime) @target(value=method) public @interface postconstruct

c# - How does a web reference know what address to use? -

i have make call web service inside new c# class library project. web service not accessible me yet (different geographic location , closed network until release). have wsdl , have added web reference in new class library project wsdl. my problem here not see can configure service address wsdl based on. it's fine developing against wsdl stub now, when release other development centre, need able set correct address service service call works. is there common practice here? i.e. config file entry can add or something? if added web reference using vs, automatically creating corresponding setting in .config file. you can view / modify in settings.settings. n.b. default vs sets setting generate default value (which based on original value use add reference, believe , gets buried somewhere in generated code file). can disable viewing project's properties --> settings, highlighting wsdl setting , in properties tab (docked window) set generatedefaultvalueinc...

memory management - PHP memory_get_usage is larger than memory_limit -

my php application has been running bit slow , it's not memory efficient @ moment. whole server has been going down , think have app blame. thought i'd monitor memory usage , check how have limit: echo 'memory in use: ' . memory_get_usage() . ' ('. memory_get_usage()/1024 .'m) <br>'; echo 'peak usage: ' . memory_get_peak_usage() . ' ('. memory_get_peak_usage()/1024 .'m) <br>'; echo 'memory limit: ' . ini_get('memory_limit') . '<br>'; this shows following: memory in use: 629632 (614.921875m) peak usage: 635696 (620.796875m) memory limit: 128m how be? memory in use way larger memory limit? either something's broken or not understand @ how memory_limit setting works (or memory_get_usage() ) thank all. memory_get_usage returns in bytes, calculating there in kb . divide 1024 again have in mb same goes memory_get_peak_usage e.g. echo 'memory in use: ...

sql - how to download database through joomla admin panel -

Image
i wondering, if access joomla administrator panel of website, how download sql database? there such feature? help. normally backup of mysql database in cpanel or virtualmin. can try of these extensions add feature in administration of joomla. or plugin, aparently want: jbackup system plugin

Get the email of my PayPal customer -

i need read email of buyer has completed transaction on ecommerce site. paypal send me email of notification, not contain email of buyer (instead, returns transaction-id - takes me account.) i looking through paypal developer api, can't find example level of detail. possible retrieve, , if so, how? paypal ipn returns address. when post paypal, request address default. ( source ) no_shipping =2 prompt requiring address.

c++ - Calculating used memory by a set of processes on Linux -

i'm having trouble calculating used memory (resident) set of processes. the issue came user set of processes share memory between themselves, simple addition of used memory ends nonsense number (>60gb when machine has 48gb memory). is there simple way approach problem? i can approximation. take (res mem - shared mem) * num proc + shared mem . not processes share same memory block. i'm looking posix or linux solution problem c/c++. you want iterate through each processes /proc/[pid]/smaps it contain entry each vm mapping of likes: 7ffffffe7000-7ffffffff000 rw-p 00000000 00:00 0 [stack] size: 100 kb rss: 20 kb pss: 20 kb shared_clean: 0 kb shared_dirty: 0 kb private_clean: 0 kb private_dirty: 20 kb referenced: 20 kb anonymous: 20 kb anonhugepages: 0 kb swap: 0 kb kernelpagesize: 4 kb mmupagesize...

php - How can I 301 Redirect and Change Url with .htaccess? -

i discovered have duplicate pages need remove pages should not exist indexed , generating small amounts of traffic. want redirect urls original ones. http://www.example.com/buy-something.php to http://www.example.com/something.php i need remove "buy-" in urls , make sure page redirected proper page. here have far: #301 redirect buy- none rewriterule ^([a-za-z\.]+).php$ /buy-$1.php [l,r=301] but nothing pages should redirected , adds loop of buy-buy-buy-buy-buy-buy- other pages , causes them time out. have tried few other variations no prevail. your appreciated. you mixed syntax, right redirecting .php /buy- .php, since want other way arround try: redirectrule ^buy-([a-za-z\.]+).php$ /$1.php [l,r=301] that should take buy-*.php domains , redirect them *.php code 301. source: http://httpd.apache.org/docs/current/mod/mod_rewrite.html

python - wait for button click on button click move button to a slot in tkinter -

i title wasn't best don't quite know how explain it. tkinter want make square widgets "slots on them. when app run want buttons show @ top of screen , 4x4 grid of square widgets. app wait user click on button. button should move top left slot on top left square. after done user should repeat process , next button should go next slot on top left square , on until square full, repeat process next square. should fixed position button allows me pass on slot without putting things in it? how should accomplish this? have loop need: elem in zip(*l): in elem: print(a) i'm not entirely sure if understand problem correctly, looks @ core, you're trying reposition tkinter widgets, correct? you can geometry manager. if use grid method (which in case recommend) can do: def changebuttonpostion(): button2.grid_remove() #gets rid of widget in top left corner button.grid(row=0, column=1) #the top left corner of 4x4 grid otherwise, can use p...

c++ - Start Debugging session in NetBeans -

i trying familiar netbeans debugging environment, c/c++ applications. followed procedures on https://netbeans.org/kb/docs/cnd/debugging.html every time want start debugging : debug>debug project ctrl+f5 , bothering error this: gdb has unexpectedly stopped return -1,073,741,515 any idea should ?! thanks

java - wowza onAppStart method call -

i try build module wowza 3.6.2 . module needs instance of iapplicationidstance , samples found in onappstart method, not called when access wowza application. i have following: public class testmodule extends modulebase { public void onappstart(iapplicationinstance appinstance) { string fullname = appinstance.getapplication().getname() + "/" + appinstance.getname(); getlogger().info("onappstart: " + fullname); } public void onappstop(iapplicationinstance appinstance) { string fullname = appinstance.getapplication().getname() + "/" + appinstance.getname(); getlogger().info("onappstop: " + fullname); } .... } application configuration: <module> <name>testmodule</name> <description>mytestmodule</description> <class>mnesterenko.testmodule</class> </module> also have applicati...

vim - how to compile cscope with quickfix -

in .vimrc , added set cscopequickfix=s-,c-,d-,i-,t-,e- ,but when use cscope command in vim, quick window not appear automatically. i read doc vim cscope, , tell me use "cscopequickfix=s-,c-,d-,i-,t-,e-" have compile cscope +quickfix feature. now question how compile cscope +quickfix feathre

objective c - ARC and UIView instance variables -

if have uiview instance variable add view subview; does calling removefromsuperview dealloc instance variable when using arc? or can add again different view? if have strong pointer view you're adding/removing, calling removefromsupeview not cause object deallocated. can have strong pointer either declaring uiview ivar, or declaring strong property (preferred). however, if have no other strong pointer view, deallocated arc if remove superview. (the superview keeping strong pointer, , breaking connection.)

java - onCreateOptionsMenu compile error -

i tried use oncreateoptionsmenu in application. followed developers blog , didn't work of me. when use code: @override public boolean oncreateoptionsmenu(menu menu) { // inflate menu items use in action bar menuinflater inflater = getmenuinflater(); inflater.inflate(r.menu.homepage_actionbar, menu); return super.oncreateoptionsmenu(menu); } i got compile errors: multiple markers @ line - syntax error on token ")", ; expected - illegal modifier parameter oncreateoptionsmenu; final permitted - syntax error on token "(", ; expected multiple markers @ line - void methods cannot return value my xml file: <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/add_option" android:title="add item" andr...

svg - Move Raphael path with png fill image, without breaking image in IE or moving image relative to element? -

there 3 basic ways move path in raphael. if path has fill image has png transparency, , need ie8 (vml), 3 flawed. jsbin demo if use simple transform... path1.animate({transform: 't20,100'},1000); ...then in ie8, png transparency in fill breaks , translucent pixels turn black . edges become pixelated , ugly, , depending on image might scuffy black outline around translucent edge of image. not good, , there doesn't seem reliable way fix after event. sometimes, inconsistently, background image doesn't stay relative element (more on below). if animate path attribute, example this: path2.animate({path: raphael.transformpath( path2.attr('path'), 't100,20') },1000); ...ie8 doesn't wreck image background. however, fix making background images relative element not paper not work method (and various ways i've tried bodge using improved background image offset additional "m-20,-20" element don't seem work), , can...

ios - UIViewController lifecycle calls in combination with state restoration -

i'm trying implement state restoration in app uses ios 6+ , storyboards, having problems finding way prevent duplicate calls heavy methods. if start app, need setup ui in viewdidload : - (void)viewdidload { [super viewdidload]; [self setupui]; } this works fine in normal, non-state-restoration world. i've added state restoration , after restoring properties need update ui properties: - (void)decoderestorablestatewithcoder:(nscoder *)coder { [super decoderestorablestatewithcoder:coder]; // restore properties , stuff // [...] [self setupui]; } so happens first setupui method called viewdidload , , again decoderestorablestatewithcoder: . don't see method can override that's called last. this normal order of method calls: awakefromnib viewdidload viewwillappear viewdidappear when using state restoration, called: awakefromnib viewdidload decoderestorablestatewithcoder viewwillappear viewdidappear i can't place c...

soa - Communicating between Servers using Websockets -

so let's in service oriented architecture, have 3 layers: the web/external layer - user sees application logic - generates layer 3. handles users, sessions, forms & etc... internal api - data, , how access data now 1 , 2 live in same network latency our least thought of problem. essentially, layer 2 consumes data layer 1 using rest. thinking of alternatives how data can consumed. what pros , cons of making layer 1 , 2 communicate websockets instead of rest? assuming, have multiple servers , layer 2 applications. this question purely out of curiosity. there old discussion on restfull http vs websockets. think of them being different. in general, websockets give finer control. comes perhaps more efficiency --imagine if you, say, define own protocol. downside have less standard approach. rest less flexible more standard , more loosely coupled. stefan tilkov summarized pretty in blog post . there related discussion here .

.net - OutOfMemoryException even when app doesn't seem to consume max amount of memory -

Image
i developing .net based application (.net 4) crashes after running time on system.outofmemoryexception when examining app's process in task manager or attempted use other tools such clr profiler , ants memory profiler, doesn't seem application maxing out on available ram or other limit may (i believe windows has limit per process .net limited in way). here's screenshot ants profiler time shortly before crash. total amount of unamanged memory (in case it's not seen in image ~ 285 mb, , total size of objects in heaps ~76mb) i checked "handles" count in taskmgr, looks around ~8120 handles app's process @ time of crash. how can further examine going on? possible causes can cause such exception? it's image (bitmap). not "very large" in size (around 50kb). can underlying native exception in disguise? (like coming gdi) yes, cause. gdi throws outofmemoryexception s when there error has nothing related memory consumption...

android - How to test localized prices with In-app billing v3 -

my app displays prices reported getskudetails() api. confirm working i'd setup device display prices different locales. i've tried logging in google accounts different countries , setting system language prices still appear in own locale. how can setup device can see prices reported in different locales? i guess that's not easy. in case experienced same issue. according information read, looks there several procedures google uses locate user. 1 of them consist of check procedence of credit card registered in google play, if users has one. if case, shown prices of locale corresponding credit card. second check, made thru sim card of mobile phone. if don't have sim card or device tablet without sim card, next step looking wifi connection. localization of wifi spot, , ipaddress, used geolocate user. finally if nothing of works, locale settings in device used. in way, google show prices according place are, couldn't match locale settings in device....

performance - The uncertainty principle of computer science -

when work on algorithm solve computing problem, experience speed can increased using more memory, , memory usage can decreased @ price of increased running time, but can never force product of running time , consumed memory below palpable limit . formally similar heisenberg's uncertainty principle: product of uncertainty in position , uncertainty in momentum of particle cannot less given threshold. is there theorem of computer science, asserts same thing? guess should possible derive similar theory of turing machines. i not familiar description of parallels heisenberg's uncertainty principle, per se , sounds me closely related computational complexity theory . problems can classified according inherent, irreducible complexity, , think that's you're getting @ limit of "the product of running time , consumed memory".

graph - Recreate plot in MATLAB using figure handle -

is there anyway create same plot twice saving type of axis handle? my plotting code creates special symbols each point in scatter plot. want create figure 2 subplots. first plot want set specific part of axis (0 10), second plot want (90:100). know recreate plot copy , pasting code, seems cumbersome , hassle manage if change else plots. is there anyway can create plot once, save handle , replot it? here functionality looking for: figure; hold on; x = [1 10 20 10 2000 3000]; y = [10 30 40 20 100 200 ]; // create plot 1 point @ time = 1:4 subplot(2,1,1); plot(x(i),y(i),'r'); // redacted code // there bunch of code here adjust of first plot each point // in order define of each marker in scatter plot, // has done 1 point @ time // redacted code end // adjust axis axis([1 60 0 50]); // figure handle handle = gcf; // create second plot same characteristics first plot different axis boundaries subplot(2,1,2); plot(handle); axis([90 250 1000 4000]); ...

c++ - Merge Sort and Queue -

im working on review sheet pretty got except not sure these two. please? q benefit of using queue merge sort? q suppose in mergesort replace queue stack (i.e. push instead of enqueue, pop in place of dequeue). explain effect replacement have. with queues things automatically added end of list; thus, when lowest level of mergesort 's recursion (individual elements), sorted array can enqueue largest of these elements new list. using stack should reverse list since elements added put @ front, you'd have search smallest element instead of largest.

jQuery Mobile doesn't load on JSON ajax result -

i'm trying load jquery mobile 'styles' (in case buttons). here html code (ajax): <!-- jquery + mobile (local) --> <link rel="stylesheet" href="../../jquery.mobile/jquery.mobile-1.3.2.min.css" /> <script type="text/javascript" src="http://code.jquery.com/jquery-2.0.3.js"></script> <script src="../../jquery.mobile/jquery.mobile-1.3.2.min.js"></script> <script> $.ajax({ type : "get", url : "http://localhost/asistencia/mant/scripts/s_m_zona.php?id_zona="+id_zona, async : true, success : function(datos) { var datajson = eval(datos); ( in datajson) { // code hede // guardar nombre zona $("#btn_guardar").html("<button data-ajax='false' onclick='guardarnombrezona("+datajson[i].id_zona+...

javascript - Jquery.Validate not working for file upload -

i'm using jquery validation in asp.net mvc project. working textbox . not work file upload. code shown below: @model ffyazilim.management.model.credential.createmodel @{ viewbag.title = "create"; layout = "~/areas/management/views/_managementlayout.cshtml"; } @section scripts { <script type="text/javascript"> $(function () { $('#form').validate({ rules: { title: { required: true, maxlength: 45, minlength: 5 }, description: { required: true, maxlength: 250, minlength: 5 }, order: { required: true, maxlength: 10, minlength: 1 }, fileinput: { required: true } ...

PHP: check if an element belongs to an array -

i know php 4 , php 5 supports built in function in_array determining element in array or not. but, using prior version of php reason , wanted know alternative it. use custom function. future compatibility, use function_exists check if current version of php you're using indeed have in_array . function inarray($needle, $haystack) { if (function_exists('in_array')) { return in_array($needle, $haystack); } else { foreach ($haystack $e) { if ($e === $needle) { return true; } } return false; } }

excel - Removing duplicates from large sheet -

i want remove rows based on duplicate cells in column large sheet, without leaving duplicate sample (like "remove duplicates" excel command does). if have: 1 2 2 3 i want, result: 1 3 this can accomplished conditional formatting, filtering or sorting duplicates , deleting filtered data, process slow large sheet. conditional formatting takes second, clicking on filter takes around 5min display filter context menu , additional 20-30min actual filtering based on color. tried process on different pcs 4 cores , plenty of ram , 100.000 rows sheet i thought write vba, iterate column cells , if cell colored, delete entire row (this possible in excel 2010, cells().displayformat ) processing takes more time. can suggest faster way remove duplicates on large sheet? edit: note have used 2 functions. of this, test function test whether function works (which have modify per scenario). also, filled cell a1 a100000 test values. please modify per needs. option e...

java - Syntax of Serializing a LinkedList<Object> -

as exercise, creating list of books linkedlist , using comparator interface sort them author or title. first, create class of books , ensure print screen way want to: class book { string title; string author; public book(string t, string a){ title = t; author = a; } public string tostring(){ return title + "\t" + author; } } next, created linkedlist takes object book: linkedlist<book> booklist = new linkedlist<>(); a class implements comparator created sorts according title/author , displays them on jtextarea inside of main frame. of working fine, there's 1 glaring bug...i cannot save file! i've tried class implements serializable takes linkedlist argument , writes .obj file. when load it, fails. creates file, notserializableexception. tried saving file .ser told make easier save it, failed on loading, well. does know method serializing linkedlist using bufferedreader? or there approach this? ...