Posts

Showing posts from May, 2010

c++ - MFC OnInitialUpdate never gets called -

i have cformview dynamically created @ runtime. however, weird going on, because oninitialupdate never gets called view. set breakpoint in function , never gets hit once, though can see view being displayed onscreen. problem because whenever try work view's member controls, program crashes because aren't initialized. gives? edit: can call oninitialupdate manually; don't need override it. i think might victim of this bug. workaround override oninitialupdate() , call manually, after view dynamically created. worked if first line in overridden function call parent cformview::oninitialupdate() .

Hibernate generates error in your SQL syntax with MySQL -

i getting error while try fetch record table using hql caused by: com.mysql.jdbc.exceptions.jdbc4.mysqlsyntaxerrorexception: have error in sql syntax; check manual corresponds mysql server version right syntax use near '.userinfo userinfo0_ userinfo0_.login_id='muskan' , userinfo0_.pwd='musk' @ line 1 full error trace: from userinfo userinfo userinfo.loginid='muskan' , userinfo.pwd='muskan@admin' , userinfo.role='administrator'exception in thread "main" org.hibernate.exception.sqlgrammarexception: not execute query @ org.hibernate.exception.sqlstateconverter.convert(sqlstateconverter.java:92) @ org.hibernate.exception.jdbcexceptionhelper.convert(jdbcexceptionhelper.java:66) @ org.hibernate.loader.loader.dolist(loader.java:2452) @ org.hibernate.loader.loader.listignorequerycache(loader.java:2192) @ org.hibernate.loader.loader.list(loader.java:2187) @ org.hibernate.loa

SQL Server Adding summing values based on the month -

i have table has following 2 columns: date , price i want sum prices based on same month of same year. have: 2012-07-27 00:00:00.000 0 2012-07-27 00:00:00.000 15000 2012-08-27 00:00:00.000 0 2012-08-27 00:00:00.000 12000 2012-09-28 00:00:00.000 1000 2012-09-28 00:00:00.000 9000 2012-10-26 00:00:00.000 0 i want following: 2012-07-27 00:00:00.000 15000 2012-08-27 00:00:00.000 12000 2012-09-28 00:00:00.000 10000 2012-10-26 00:00:00.000 0 thank you. you desired result given sample data , output with: select date, sum(price) yourtable group date order date if had multiple dates in month , wanted return each distinct date still show monthly sum each record use: select date, sum(sum(price)) on (partition year(date),month(date)) yourtable group date order date

jquery - Queueing ajax requests -

trying make "queue manager", can't quite wrap head around on how accomplish this. realize can disable async , blocks , need things trigger. my idea use callbacks or signal queue manager can let item through. have attempted multiple times , can't quite right. this how imagine it: mc.queuemanager = function(ajaxrequest) { var queue = []; // "queue", array this.request = ajaxrequest; queue.push(this.request); this.curtask = queue.shift() // grab , remove first item queue $.ajax({ type: "post", url: "handler.php", data: {"data": this.curtask}, success: function(data) { // handle data retrieved }, complete: function() { // so, request completed, callback if (queue.length > 0) { mc.queuemanager(queue.shift()); // grab next item , repeat } } }); }; right can understand nothing preventing multiple requests firing, can't figure out how right now

javascript - Multipart request does not work -

this have, put different blogs trying describe how multipart request in angular. however, not work. says bad request (400). wrong? because miss content-type beneath content-disposition header? how add if case? var fd = new formdata(); fd.append('data', server); return $http.post('/servers', fd, { transformrequest: angular.identity, headers: { 'content-type': undefined } }); request payload chrome ------webkitformboundaryowougkw6gayclwsb content-disposition: form-data; name="data" {"status":"rejected","description":"test"} ------webkitformboundaryowougkw6gayclwsb--

cakePHP readonly field size -

i have following bit of code echo $this->form->input('users.failure', array ("label" => 'reason failed', 'id'=> 'reasonautopop','size' => '100', 'readonly'=>'readonly')); the field auto-populated via javascript. has kept read-only per customer specification, in conditions. longest failure reason 100 characters. can display 27 characters only. there different way set width/size readonly fields? my tip: use hidden read-only field, , mimic input field - designed needs <p> or <pre> . edit echo $this->form->input('users.failure', array ("label" => 'reason failed', 'id'=> 'reasonautopop','size' => '100', 'readonly'=>'readonly', 'type'=>'hidden')); // since it's hidden, shouldnt care size. // now, add css designed element. echo "<p class='loo

sql - Ignoring null values in in a postgresql rank() window function -

i writing sql query using postgresql needs rank people "arrive" @ location. not arrives however. using rank() window function generate arrival ranks, in places arrival time null, rather returning null rank, rank() aggregate function treats them if arrived after else. want happen these no-shows rank of null instead of imputed rank. here example. suppose have table dinner_show_up looks this: | person | arrival_time | restaurant | +--------+--------------+------------+ | dave | 7 | in_and_out | | mike | 2 | in_and_out | | bob | null | in_and_out | bob never shows up. query i'm writing be: select person, rank() on (partition restaurant order arrival_time asc) arrival_rank dinner_show_up; and result be | person | arrival_rank | +--------+--------------+ | dave | 2 | | mike | 1 | | bob | 3 | what want happen instead this: | person | ar

binning - Manually Weight a Binned Variable in R Logistic Regression -

i looking credit scoring using logistic regression in r , stumped on this... if have categorical variable "residence" factors "own", "rent" , "other" , want set weight of "other" 0 neutral in model best way in glm in r? we can manually using fico model builder i'm not sure how in r. thanks. if want omit cases residence=="other" use subset argument glm() . logmod <- glm(binaryvar ~ covar1 + residence, data=dat, subset= residence =="other", family="binomial")

radcombobox - Telerik control events always being triggered -

i'm using telerik combo box create cascading multi-select drop down lists. i have several drop down lists on page ddlproject, ddlunit, ddldiscipline, ddldoctype. i using telerik radajaxmanager trigger updates of controls , markup of follows: <telerik:radajaxmanager id="ajaxmanager" runat="server" defaultloadingpanelid="lpnlloading" > <ajaxsettings> <telerik:ajaxsetting ajaxcontrolid="ddlproject" eventname="textchanged"> <updatedcontrols> <telerik:ajaxupdatedcontrol controlid="ddlunit" updatepanelrendermode="inline"/> <telerik:ajaxupdatedcontrol controlid="ddldiscipline" updatepanelrendermode="inline" /> <telerik:ajaxupdatedcontrol controlid="ddldoctype" updatepanelrendermode="inline" /> <telerik:ajaxupdat

fadein - Fade in and out with jQuery Image Gallery -

i've made simple jquery image gallery http://jsfiddle.net/rvermeulen/xnshc/3/ but can't make nice fadeout , in in it, because if (with fadeout , in in it): $(document).ready(function() { $(".small_image").click(function() { event.preventdefault(); var image = $(this).attr("rel"); $('#current_image').fadeout(300); $('#current_image').html('<img width="370" src="' + image + '"/>'); $('#current_image').fadein(300); }); }); it looks .html function loads faster fadein, it's no "smooth" fade. know how fix delay or something? you need use complete callback change image after image faded out: $(".small_image").click(function () { event.preventdefault(); var image = $(this).attr("rel"); $('#current_image').fadeout(300, function() { $('#current_image').html('

c++ - IO operator overloading error -

in .h file ostream& operator <<(ostream &os,const object &); in .cpp file ostream& operator <<(ostream &os,const object &mono) { os << mono.coef<<" *x^"<<mono.degree; return os; } errors getting: error c2143: syntax error : missing ';' before '&' error c4430: missing type specifier - int assumed. note: c++ not support default-int error c2061: syntax error : identifier 'ostream' error c4430: missing type specifier - int assumed. note: c++ not support default-int error c2805: binary 'operator <<' has few parameters i've checked every io overloading tutorial can found yet cannot fix this. edit: adding std:: fixed every error except "> error c2805: binary 'operator <<' has few parameters " dont know means edit2: declaring function friend solved this. everyone! you using ostream without qualifyi

how can i write java output in text file continuously -

i tried output of java program text file.but when print output in text file , next set of input overwrites on it.i want see of output in order in text file.how can i? if using filewriter , pass true second argument filewriter turn on "append" mode. fout = new filewriter("filename.txt", true); filewriter usage reference

oop - PHP Fatal error Call to private Uploade::__construct() from invalid context (Construct is Public) -

the problem i'm having strange one, log file says __construct method in class called 'upload' private, in reality public! error makes no sense. class code; class upload { public $errors; public $imagetypes; public $cdn_url; public $uploadpath; private $maxheight; private $maxwidth; private $maxtokenlength; private $forcemaxdimensions; private $maxfilesize = 5; public function __construct() { include_once 'config.php'; $this->imagetypes = array('jpg', 'png'); $this->errors = array(); # convert megabytes bytes $this->maxfilesize = $this->maxfilesize * 1048576; } } this how initiate class; include_once 'upload.php'; $upload = new upload; this error log file; php fatal error: call private upload::__construct() invalid context i've looked @ many answers online , non have helped me, i'm hoping answer stackoverflow! hel

cpu - Intel HAXM not supported in Windows 8 -

i have haxm working in windows 7 on laptop. replaced harddrive , installed windows 8. when install haxm tells not supported. if place old hdd haxm works. intel processor identication utility tells intel vt-x on in windows 7 , off in windows 8 bios has no option change vt-x is there way enable in windows 8? uninstall hyper-v windows 8 , unlock visualization in windows 8

java - Two Main methods with different signatures -

i have following class. public class test { public static void main(integer[] args) { system.out.println("this not main"); } public static void main(string[] args) { system.out.println("this main"); } } in here there 2 main method accept integer[] , string [] input argument. question how jvm load second method main method of class. why consider input argument array of string ? because that's java looks for. java language specification, section 12.1.4 : the method main must declared public, static, , void. must specify formal parameter (§8.4.1) declared type array of string

c# - Managing the same project with TFS & Git -

my company works tfs our source control server. our teamwork on it. however, we'd publish our projects comfortably in open source format within organization, we've set local github git server. i've used git plugin visual studio 2012 push 1 of projects server. proved successful, however, required me copy existing solution bound tfs, directory in order 'lose' tfs bindings. if team makes changes on tfs solution, i'll need manually re-apply them git-bound solution. is possible switch between source controls on same solution ? at moment, switching entirely git not option. tfs more reliable , backed company. git-tf way go (as commented @daveshaw). should work : first, clone tfs repo git-tf. may want use --shallow if tfs history long , want quick clone, won't have entire history, last commit (like first one). git tf clone --shallow http://myserver:8080/tfs/mycollection $/teamprojecta/main add github repo remote git remote add github ht

Javascript array push is not working -

i stuck on why array push not work... appreciated. var addons = new array(); myservice.addon_dependencies(arr[i]['addoncode']).then(function(dependency) { console.log(dependency[0].addon_depend); //returns a6002 addons.push(dependency[0].addon_depend); }); console.log(addons); //returns [] this because addon_dependencies method not finishing before run console.log . then method shows you're using sort of promise framework. if print out in then block should work.

sql server - SQL unique field: concurrency bugs? -

this question has answer here: only inserting row if it's not there 7 answers i have db table field must unique. let's table called "table1" , unique field called "field1". i plan on implementing performing select see if table1 records exist field1 = @valueforfield1, , updating or inserting if no such records exist. the problem is, how know there isn't race condition here? if 2 users both click save on form writes table1 (at exact same time), , have identical values field1, isn't possible following happen? user1 makes sql call, performs select operation , determines there no existing records field1 = @valueforfield1. user1's process preempted user2's process, finds no records field1 = @valueforfield1, , performs insert. user1's process allowed run again, , inserts second record field1 = @valueforfield1, viola

vb.net - Writing a specific listview tag property to a text file -

the code below removed user listview based on name. want add ability first write listview's tag property text file first i'm confused how should specify listview item want tag before removing it. can advise me? thanks. public sub removeuser(byval name object) if _mainview.lvwchannelusers.invokerequired _mainview.lvwchannelusers.invoke(new parameterizedthreadstart(addressof removeuser), name) else dim lvi listviewitem = getlistviewitemsindex(directcast(name, string)) dim file_name string = application.startuppath & "\accounts\" & directcast(name, string) dim objwriter new system.io.streamwriter(file_name) objwriter.write("this need call tag write.") objwriter.close() _mainview.lvwchannelusers.items.remove(lvi) end if end sub here have corrected version of sub performing actions want: public sub removeuser(byval name object) if _mainview.lvwchannelusers.invokerequ

php - How to show a div when user is logged in and on their profile but disable it when they go on some other user profile -

i'm trying figure out how can disable upload picture functionality on profile isn't own. user should able view upload button on own profile , not other profiles. <?php if(logged_in() === true && user_id_from_username($username) === true && isset($_get['username']) === true){ $username = $_get['username']; $user_id = user_id_from_username($username); ?> <script type="text/javascript"> $('.profile_wrapp').mouseenter(function(){ $('.select_buttons').fadein('fast'); }).mouseleave(function(){ $('.select_buttons').fadeout('fast'); }); </script> <?php }else{ ?> <script type="text/javascript"> $('.select_buttons').hide(); </script> <?php } ?>

Setting Up a Public Git Repo -

my team has been working on platform past few months, , we're ready release rest of firm. we'd follow "integration manager workflow" found here: http://git-scm.com/book/en/distributed-git-distributed-workflows . we have proprietary code in our team repository we'd rather not share rest of firm, , must create "stripped-down" version of our current team repository. i'm looking @ doing following: clone our existing team repository create "integration manager repo" rm proprietary files commit rms rebase -i --root squash commits , prevent rewinds clone --bare "integration manager repo" create "blessed repo" now, being relatively inexperienced git, couple of things uncertain me approach: can still pull "blessed repo" our team repo? assuming can #1, think rms pulled, deleting of our proprietary files. need git view our team repo's more-advanced state child state of blessed repo state. c

stored procedures - Will using a conditional variable negate execution plan retention and reuse -

i want write stored procedure in sql server utilizes "conditional variables". conditional, referring along these lines: create procedure [dbo].[order_sel] @begindate datetime = null , @enddate = null = null begin select id , customerid , dateordered orders ( @begindate null or dateordered between @begindate , @enddate ) end now, know 1 of benefits of using stored procedures execution plan retention , reuse. methodology used above negate advantage?

tkinter - Python - Configuring multiple buttons at once in Tk -

i have eighteen buttons need change 1 image upon press of button. call .configure on each , set way, however, feel though there cleaner simpler way. ideas? if buttons in list, can loop on them, this: self.buttons = [button1, button2, ..., button18] def updatebuttonimage(self): button in self.buttons: button.configure(image=self.newimage) updatebutton = button(root, text="change button image", command=self.updatebutton) is had in mind?

Jquery - Change Button Function -

this question has answer here: event binding on dynamically created elements? 18 answers i new jquery , i'm trying write code changes clicked button both in text , function. here code: $('.button1').click( function() { $(this).val('button2'); $(this).removeclass('button1').addclass('button2'); } ); $('.button2').click( function() { alert('button 2 clicked'); } ); the problem is, second event not fire , call alert. thanks in advance event handlers bound elements, , changing class of element doesn't change binding. in case, need use event delegation. from jquery 1.7 onward, use .on() that: $(document).on('click', '.button1', function() { $(this).val('button2'); $(this).removeclass('button1').addclass(&

javascript - How to Add a Drop Down List in a Kendo UI Grid -

using kendo ui , row template, have grid started following: http://jsfiddle.net/xf4ck/ i'm wanting alter actions column contain drop down list populated actions object. actions object contains display text , relative url path following example: var actions = [ { name: "edit", url: "reports/report/1" }, { name: "delete", url: "reports/delete/1" } ]; this actions object on each row of grid , may vary per row/user/etc. intended usage user selects drop down list , chooses 1 of options. on choosing option url value posted. i'm not sure begin, or if possible in row template. appreciated. i able figured out. in row template calling js function , returning html markup list. setting .kendodropdownlist on items based on class attribute. have updated jsfiddle here doesn't seem work in jsfiddle. working when test in ie10 , chrome on dev machine. here's relevant code changes: in rowtemplate, changed

java - thrift : Unable to get a generator for "python" -

i have thrift installed on machine (ubuntu 12.04).the version of thrift using 0.9.0.i have tried generate python file thrift interface file follows thrift -gen python example.thrift i following error [warning:generation:1] unable generator "python". do need install additional packages in order thrift able generate python files.i able generate java file using thrift. try replacing "python" "py": thrift -gen py example.thrift

templates - Error 500/fatal error: Class 'Jhtml' not found -

i'm struggling improve joomla website. i'm getting 500 error when try open articles in front end, changed error reporting "developed". received following error: fatal error: class 'jhtml' not found in /xxx/components/com_comment/templates/default/default.php on line 49 how prevent error occuring? point out free template website if problem lays in me changing template? you should try update comment component. had same problem after update joomla 3.1.5. download latest version of comment component , install (if no other instruction update given developer of component).

excel - Export data in multiple columns into multiple sheets -

i export column data separate sheets export individual ascii text files. specific data shown whereby copy first 2 columns (x, y coordinates) , each individual column thereafter own sheet. x y comp1 comp2 comp3 comp4 … comp23 -40 -20 55.29 0 0 73 … 105.67 -40 -19.9 56.79 0 33 72 … 112.5 -40 -19.8 69.29 0 31 89 … 114 -40 -19.7 70.29 0 58.14 108 … 125 … … … … … … … … 40 55 72.29 0 49 117 … 132 i'm still getting grips writing macros right trying adapt recorded macro 1 of iterations work entire sheet looks follows: sub copycoldata() activecell.range("a1:b1").select range(selection, selection.end(xldown)).select selection.copy sheets.add after:=activesheet activesheet.paste sheets("sheet1").select sheets("sheet1").name = "comp1" sheets("sum&

c# - Specified Cast not Valid error using Nhibernate -

using nhibernate, visual studio 2010, c#. i having problem converting decimal? type. code gives specified cast not valid error and fails on .uniqueresult<> line. following code. private decimal? getcostvaluefromquery(string query, itempricecontext item) { var session = activerecordmediator.getsessionfactoryholder() .createsession(typeof(object)); return session.createsqlquery(string.format(query, item.itemcode)) .uniqueresult<decimal?>(); } the result of sql query 62.3891005516052 i suspect result has lot of decimal places , hence fails. any suggestions how round result or reduce result such supported? use whatever rounding, truncating etc. need in select-part of sql query. but should check actual return type of sql query is. decimal?

api - Paypal Pro NVP Sandbox PHP Payment Impossible -

i have build own paypal pro system don't work can't access template nvp ack success. i've tried change encoding nothing change. things unable process payment. please contact merchant directly. code : session_start(); $total = 0; $total = $_session['navig']->commande->total; $total -= $_session["navig"]->commande->remise; // r?f?rence $reference_cde = urlencode($_session['navig']->commande->transaction); // montant $montant = $total; // récupération de l'adresse de payement $server = $serveur_api; $version = "87.0"; $method = "bmcreatebutton"; $user = $username_api; $pwd = $password_api; $signature = $key_api; $buttoncode = "token"; $buttontype = "payment"; $data = array( "paymentaction" => urlencode("sale"), "amount" => urlencode(round($montant, 2)), "tax" => urlencode("19.6&qu

R variable string replacement in a data frame -

i have dataframe looks follows: df <- data.frame(one=c("s1_below_10", "s2_below_20"), two=c("s3_above_10","s4_above_10")) i want replace strings number preceding first underscore. in other words, desired output is 1 3 2 4 i know how can perform replacement (the dataset large). help. the basic gsub call like: gsub("^.+?(\\d+)_.+","\\1",df$one) [1] "1" "2" which lapply each column: data.frame(lapply(df, gsub, pattern="^.+(\\d+)_.+",replacement= "\\1")) 1 2 1 1 3 2 2 4

Java Programing For Android App Wont Load -

ive been making android app using android develepor kit , created layout medium text , 1 button it meant show text in dialog when click buttom when run app on device test it freezes , doesnt show button or text added whole device freezes. i cant figure out ive dont wrong im complete noob @ im hoping can me figure out. public class mainactivity extends activity implements onclicklistener { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); button button1 = (button)findviewbyid(android.r.id.button1); button1.setonclicklistener(this); } @override public void onclick(view v) { dialog d = new dialog(this); d.settitle("success!"); textview tv = new textview(this); tv.settext("some text here."); d.setcontentview(tv); d.show(); } } if there in logcat, helpful. b

jquery - Strange message coming from Chrome debugger -

i debugging jquery code using chrome , every few iterations of testing, message appears in console: [mon aug 12 2013 5:32:45 pm] solid savings i have googled message , find nothing. its chrome extension. remove extensions , error go away. may want run anti-virus/malware on computer.

ruby on rails - using @college.name inside of an image_tag -

i'm using rails 3.2.13. i have @college.name variable available me in view file. have carousel of pictures (3 per school). names of jpg files in form of university_of_pittsburgh1.jpg , university_of_pittsburgh2.jpg , , university_of_pittsburgh3.jpg . i'd link them doing <%= image_tag "@college.name1.jpg" %> but doesn't seem working. how link pictures properly? <%= image_tag "#{@college.name}1.jpg" %> you want use string interpolation wrapping @college.name in set of braces: #{...} this replace actual college name, while 1.jpg part outside of braces added on. above interpreted as: <%= image_tag "university_of_pittsburgh1.jpg" %>

Chrome Extension Get User's Password For Website -

i'm fooling around chrome extensions, , wondering. is possible password website that's saved google chrome (as in, it's autosaved password feature)? it cumbersome have button in bar login website, , annoying prompt user every time password needed. so far know, can not want to. but, can develop extension, stores password using chrome.storage api or localstorage api of html5. and then, when open website page, extension read password storage of it, fill in corresponding website. logging automatically. just idea. using chrome.storage.sync, data can synchronized between devices use chrome extension , google account. thx comment. data can not encrypted, think twice before work answer. sorry that.

ios - Delete Core Data Entry from Table View Controller -

i trying delete core data entry table view controller, when swipe left, delete button comes , deletes entry. unfortunately, getting error: "property 'classes' not found on type "classtableviewcontroller *" on line 251 , 260 (code posted below) , not sure do. have nsmutableobject class called classes.m , classes.h, , have been imported, xcode doesn't seem recognize it. here code: classtableviewcontroller.m #import "classtableviewcontroller.h" #import "classes.m" #import "classes.h" #import "classtableviewcell.h" #import "newclassviewcontroller.h" #import <coredata/coredata.h> @interface classtableviewcontroller () - (void)configurecell:(classtableviewcell *)cell atindexpath:(nsindexpath *)indexpath; @end @implementation classtableviewcontroller @synthesize fetchedresultscontroller = _fetchedresultscontroller; @synthesize managedobjectcontext = _managedobjectcontext; @synthesize managedobjectm

scala - Is there there any difference or reason to prefer one of these function signatures? -

i don't think there's difference, or reason prefer 1 on other, wanted check... def length(l: list[any]) def length[t](l: list[t]) if want length of list , there no difference you. but if want operatations elements of list, there is. val l = list(1, 2, 3, 4) def secondelementany(l: list[any]) = l.tail.head def secondelementgen[a](l : list[a]) = l.tail.head giving 2 functions , list, expect 2 list . val secondany = secondelementany(l) val secondgen = secondelementgen(l) if print values console, spot no diference, if try cast them float example, error. secondany.tofloat tell us, secondany type of any , cannot use function tofloat on any . in contrast secondgen.tofloat give float value. the reason is, compiler aproximates full signatures follows. def secondelementany(l: list[any]): = l.tail.head def secondelementgen[a](l: list[a]): = l.tail.head as can see return type of first function any , any whereas return type of second function depends on

oop - Interfaces to allow unit's ability to attack ground, air, or both in Java using Design Patterns -

im making text game has abstract fighter class. within fighter have variable called protected boolean isground. have 2 abstract classes extend fighter called airfighter , groundfighter set isground true or false, depending on if ground units or not. i want set game in battle phase game checks if player 1's speed faster player 2, , depending on faster p1.attack(p2), , print out stats of battle, remaining health of each player or that. i want way airfighters attack air, or attack air , ground, , want groundfighters attack ground only, or ground , air. how go doing while staying loosely coupled? design pattern's class , frustrating me. there design pattern me this? think of game starcraft, that's game mimicing, units marine can attack ground , air, air units can attack air, can both. want able without having nasty if else checking statement. an easy way have method in base fighter can used check if fighter can attack another: public abstract class figh

c - Evaluation of this statement -

i reading c book , don't understand statement asking me evaluate. here statement, !(1 && !(0 || 1)) i can understand things here... have far, not(1 , not(0 or 1)) so it's not 1 , not 0 or 1 ? or not 1 , 0 or 1 ? 2 ! cancel each other out double negative? answer true expected false . can explain? (0 || 1) == 1 !1 == 0 1 && 0 == 0 !0 == 1 known true :) keep in mind || , && short circuit operators, in case still have evaluate right side because operators not short circuit

linux - Can I intercept audio on a rooted Android? -

i understand not possible redirect audio output pre-existing android app - spotify - usb sound card or file instance. believe may have had privacy , recording telephone calls. i not understand linux know flexible , read piping output of 1 program input of another. see in dev directory of androids “files” names “audio”. my question - of these correspond raw audio output , if tablet/phone rooted stream intercepted linux magic? my motivation provide higher quality audio output basic speaker / headphone / bluetooth options. short answer yes, might able hack together. audio implementation on particular handset manufacturer there no guarantee. unlikely simple think. there no one-line command line magic it. android doesn't use usual linux alsa user space code can not generalize linux , "if can in linux can on rooted android". i think android implementations use tinyalsa not requirement. if case might able recompile tinyalsa own intercept logic or interpose

joomla2.5 - Auto closure of process in task manager using php on server -

how auto closure of process in task manager using php on server? i have use below script auto closing of ie browser tab while running cron using task manager, <script type='text/javascript'> var win = window.open("","_self"); /* url = "" or "about:blank"; target="_self" */ win.close(); </script> but ieexplorer.exe process not ending in task manager on server side ending on local host. can explain how end process or auto close ie tab on server using php?

ios - The difference between captureImage.image; and [captureImage].image; -

i trying use captureimage.image; in code can explain code mean , correct captureimage.image; or [captureimage].image; or [captureimage.image]; i using code .h iboutlet uipickerview *savetopicker; nsmutablearray *arraygenre; } @property(nonatomic, retain) avcapturestillimageoutput *stillimageoutput; @property (weak, nonatomic) iboutlet uilabel *categorylabel; @property (weak, nonatomic) iboutlet uiview *imagepreview; @property (weak, nonatomic) iboutlet uiview *saveimage; @property (weak, nonatomic) iboutlet uiimageview *captureimage; @property (weak, nonatomic) iboutlet uisegmentedcontrol *cameraswitch; @property (weak, nonatomic) iboutlet uiview *pickerviewcontainer; @property (nonatomic, retain) uiaccelerometer *accelerometer; @property (weak,nonatomic) iboutlet uiscrollview *bgscrollview; - (ibaction)savebutton:(id)sender; - (ibaction)closebutton:(id)sender; - (ibaction)switchcamera:(id)sender; - (ibaction)snapimage:(id)sender; fo

how to convert int array to bitmap in android? -

this question has answer here: converting array of int bitmap on android 3 answers i'm working @ steganography project using lsb algorithm ,i change least significant 2 bits @ every pixel other bits dependent on data want hidden when convert int array bitmap can't pixels changed .. code ...thanks edittext text = (edittext) findviewbyid(r.id.message); string msg = text.gettext().tostring(); int msg_size=msg.length(); if(msg_size!=0) { imageview imageview = (imageview) findviewbyid(r.id.imgview); bitmap bmap = bitmap.createbitmap(imageview.getwidth(),imageview.getheight(),bitmap.config.argb_8888);//i imageview whch u want convert in bitmap canvas canvas = new canvas(bmap); imageview.draw(canvas); int width = bmap.getwidth(); int height = bmap.getheight(); int[] oned = new int[width * height]; b

android sdk missing system-images -

i'm trying setup multiple target on ci server (centos 64_x86) automated android app testing, run multiple emulator heedlessly. after extracting latest sdk http://dl.google.com/android/adt/adt-bundle-linux-x86_64-20130729.zip , run, android update sdk --no-ui suppose should have installed existing component properly, 2 problems found, after selected "arm eabi v7a system image, android api 18" , agreed "android-sdk-license-bcbbd656", seems installed next time update sdk shows again , installable. note installed them through command line no window ui available, not sure if difference here.. (however emulator api 18 working...) looking @ folder $sdk_path/system-images, "android-18/armeabi-v7a" available, compared sdk installation on macbook, same folder contains richer content including whatever api available, not api 18. i guess difference above caused 3rd issue (for example on api 15 don't have "system-images/android-18/armeab

matlab - Write field name and value form structures to a file -

i wondering how can write full structure in output file *.txt fieldnames , respectives values. example allvariables= names='raw.txt' date= = '**/**/2013' user = mr/mrs * timeprocessing = 20 numberiterations = 1000; should written in output.txt information displayed before. this example structure has length of 50 fieldnames, appreciate suggestion! here's can use: %// extract field data fields = fieldnames(allvariables); values = struct2cell(allvariables); %// optional: add enclosing apostrophes around string values idx = cellfun(@ischar, values); values(idx) = cellfun(@(x){['''', x, '''']}, values(idx)); %// convert numerical values strings idx = cellfun(@isnumeric, values); values(idx) = cellfun(@num2str, values(idx), 'uniformoutput', false); %// convert cell arrays of strings comma-delimited strings idx = cellfun(@iscellstr, values); stringify_cellstr = @(x){['{' sprintf('''%s&#

php - strip_tags() function is not working during insert records in Codeigniter -

i inserting register details of user through codeingniter strip_tags() not working in codeigniter. code - $u_name=strip_tags($this->input->post('username')); // strip not working $data = array( 'user_name' => $u_name ); $this->db->insert('table', $data ); if can't please me option strip html tags. in advance. okay try if works or not: $string = htmlentities(trim($string), ent_quotes, 'iso-8859-15');

actionscript 3 - How to make movieClip dash by pressing the key double with AS3? -

so question clear think. if player press or d key movieclip moves normal. if player press or d , release , press or d character dash or sprint or whatever. here code : function key_down(event:keyboardevent) { switch (event.keycode) { case 65 : leftkey = true; break; case 66 : punchkey = true; break; case 87 : upkey = true; break; case 68 : rightkey = true; break; case 83 : downkey = true; break; case 78 : jumpkey = true; break; case 77 : kickkey = true; break; } } function key_up(event:keyboardevent) { switch (event.keycode) { case 65 : leftkey = false; num++; if(num % 2 ==1){ canrun = true; } else { canrun = false; } break; case 66 : punchkey = false

ASP.NET Web API with x509 security certificate -

i'm going use membershipreboot asp.net web api authentication , i'm supposed implement x509 certificate . there article in msdn how to: secure service x.509 certificate , wcf services uses servicehost class. question how achieve in asp.net web api services? possible? there "prerequisites" work ssl is: setting iis work ssl you may want take at: custom authentication methods web api here full article on: how secure web api using ssl certificate :

statistics - Why does this Excel formula work? -

in this answer following formula given. {=percentile(if(column(indirect("1:"&max(data!n3:n15)))<=data!n3:n15,data!m3:m15,""),0.25)} it supposed calculate first quartile of data weights. i've been trying understand formula says, can't. first of all, curly brackets? (probably silly question.) second, <= operator when it's given 2 data ranges operands? thrid, how can possibly give right answer, if, regardless of condition in if-statement does, returned data value column? seems me formula is if weird condition satisfied, calculate first quartile of value column. if it's not, calculate first quartile of "". this seems wrong... also, can find complete manual of excel functions , operators? online file says nothing comparing 2 ranges. personally wouldn't use quoted formula - doubt if author thinks , in circumstances give incorrect results. can see problem because part =column(indirect("1:&qu

wpml - How to avoid affecting other queries when using posts_orderby? -

in wordpress must known, when using get_posts() or query_posts() or wp_query , not possible order returned posts specifying list of post id in order want. instead have loop through results , re-order them on php side. performance hit , bad practice. instead should use built-in mysql functions retrieve posts in desired order upfront. thankfully there posts_orderby can used specify custom orderby statement, this: // list of post ids in custom order $my_post_ids = array(1,3,2); // apply filter orderby sql statement add_filter('posts_orderby', 'my_custom_orderby'); function my_custom_orderby($orderby_statement) { global $my_post_ids; $orderby_statement = 'field(id, '.implode(',',$my_post_ids).')'; return $orderby_statement; } // custom query $my_custom_query = new wp_query(array('post_type' => 'post', 'post__in' => $my_post_ids); however there problem above code, affect order of all que

Python - identify items from list where sublist items are duplicated -

awful title, please rename or generalise appropriate. scenario: inputlist = [[1, "data x"], [2, "data z"], [3, "data x"]] i want find there duplicates of index[1]. desiredoutput = [[1, "data x"], [3, "data x"]] ideally, [1] list, instead of string: [[1, ["data x1", "data x2"], [2, ["data x1", "data x2"]] how (just alternative) inputlist = [[1, "data x"], [2, "data z"], [3, "data x"]] operator import itemgetter collections import defaultdict dd = defaultdict(list) i, v in enumerate(inputlist): dd[v[1]].append(i) dupes = [itemgetter(*v)(inputlist) v in dd.itervalues() if len(v) > 1] # [([1, 'data x'], [3, 'data x'])]