Posts

Showing posts from June, 2013

c++ - Size of a class with only one function which do not have body -

this question has answer here: sizeof class int , function, virtual function in c++? 4 answers i have been asked question size of below give class: class { void abc(); } and if make function virtual size now class { virtual void abc(); } note: question in respect visual studio compiler. i told first have 1 byte , second have 5 bytes compiler adds v pointer second. i check on visual studio 2010 in 64 bit machine:- the size of class in first case 1 byte , in second case 4 byte.i play around , found below results putting in questions: i found if class have functions in it(with body or without) , no data members, size of class 1 byte , object created have size 1 byte below example: class myclass { void abc(){int x=0;} int getdouble(int y){return y*2;} }; int main() { myclass obj;; std::cout<<sizeof(myclass )<<"\n&qu

c# - Is it possible to create a GUI control that can be accessed from two Threads? -

in order create little 2d game scratch, i'd create panel on winform , draw using graphics-object (btw, have use panel or draw form directly? know can this, disadvantages?). now want continously run 2 loops in different threads. 1 thread should primary assigned calculations , other 1 should primary draw panel. in cases however, both threads should able draw panel , problem occurs. know, error occurs if try access gui control not created specific thread. don't want use code if (control1.invokerequired) { control1.invoke(new methodinvoker(delegate { control1.text = string1; })); } because i'm not familiar option. there way create panel in way both threads can access or impossible? is there way create panel in way both threads can access or impossible? no. don't want that. there lot of history behind why in windows, short answer is, gui thread should doing of drawing , accessing of controls. btw, have use panel or draw form directly? know can t

python - "TypeError: list indices must be integers, not str": yaml.load_all? -

i want parse yaml file having following data structure: version: 1 txncode: mpt messageid: "ffh-18544-1388620740-795905" recommendations: - {reqsegflightref: [[1,2]],totalpriceref: 1,priceinforef: 1} - {reqsegflightref: [[3,4,2]],totalpriceref: 2,priceinforef: 2} - {reqsegflightref: [[5,4,2]],totalpriceref: 3,priceinforef: 3} flights: - {opcarrier: sn,mktcarrier: sn,flightnb: 2902,dptdate: "0109",dpttime: "09:30",arrtime: "11:05",dptairport: vie,arrairport: bru} - {opcarrier: sn,mktcarrier: sn,flightnb: 243,dptdate: "0109",dpttime: "12:15",arrtime: "17:00",dptairport: bru,arrairport: fna} - {opcarrier: os,mktcarrier: lh,flightnb: 6325,dptdate: "0109",dpttime: "06:30",arrtime: "07:35",dptairport: vie,arrairport: muc} prices: - {totalprice: 1574.14,baseamount: 1368.00,totaltaxe: 206.14,totalsurcharge: 0.00,totalfee: 0.

How does this "higher-order functions" thing works in Javascript -

from book eloquent javascript marijn haverbeke, there this example while introducing concept of higher-order functions: function greaterthan(n) { return function(m) { return m > n; }; } var greaterthan10 = greaterthan(10); console.log(greaterthan10(11)); // → true i'm not quite sure how works... answering own question, how see it: first, greaterthan(n) called in line, assigning value greaterthan10 variable: var greaterthan10 = greaterthan(10); this makes function stored greaterthan10 looks like: function greaterthan(10) { return function(m) { return m > 10; }; } then, when call greaterthan10(11) calling function above, translates to: function greaterthan(10) { return function(11) { return 11 > 10; }; } hence returning true result 11 > 10 true indeed. could confirm whether i'm correct or not? also, if can provide further details , comments on how higher-order functions work in javascript, appreciated. you're correc

javascript - Local Storage Error on array push -

i'm doing tests local storage. in tests array, stuck in array part (push). what i've done: if (localstorage.myarray) { localstorage.myarray.push("green"); } else { localstorage.myarray = ["red", "blue"]; } this returns error: uncaught typeerror: localstorage.myarray.push not function i know localstorage itens string, don't know how works in array. since localstorage takes strings, have convert arrays json strings using json.stringify. parse json strings array while performing further operations on "arrays". if (localstorage.myarray) { var myarray = json.parse(localstorage.myarray); myarray.push("green"); localstorage.myarray = json.stringify(myarray); } else { localstorage.myarray = json.stringify(["red", "blue"]); }

sql - Can not use ORDER BY when creating materialized view with SDO geometry in Oracle 11g -

i using oracle 11g 2.0.1.0 spatial , oracle sql developer on client. have table places primary key id , view coordinates tw columns: id referencing post in places , , sdo geometry point . i want create materialized view following sql: create materialized view placecoordinates nocache noparallel build immediate using index refresh on demand complete disable query rewrite select places.id, coordinates.point places left outer join coordinates on places.id = coordinates.id order places.id this gives me error: ora-30373: object data types not supported in context no matter sort on (even if silly 1 ) same error. however, if remove order by statement works fine. works fine sorting if ordinary select without creating materialized view. why wouldn't able sort? there anyway around problem? the key thing order in materialized view makes no sense. under covers, materialized view table gets automatically updated when tables based on updated. being table

python - Django ManyToManyField not saving in admin -

models.py class document(models.model): document_type_d = models.foreignkey(documenttype, verbose_name="document type") class section(models.model): document_type_s = models.manytomanyfield(documenttype, verbose_name="document type") class documenttype(models.model): document_type_dt = models.charfield("document type", max_length=240) when create section in admin doesn't appear save document_type_s. in django shell can see documenttype saving properly: >>> dt = documenttype.objects.all() >>> d in dt: ... print d.document_type_dt ... campus lan wan unified communications when check sections get: >>> original_sections = section.objects.all() >>> in original_sections: ... print a.document_type_s ... lld.documenttype.none lld.documenttype.none lld.documenttype.none lld.documenttype.none lld.documenttype.none lld.docum

javascript - AngularJS - ngClick is blocking submit key action -

the user of web should enter simple code using buttons in form , after should click ok or hit enter , continue proccess. the thing enter key not submiting form, executing other method called ng-click . how can avoid enter key call ng-click method? myapp.js var myapp = angular.module('myapp',[]); myapp.controller('myformcontroller', ['$scope', function ($scope){ // procesing data form. $scope.signin = function () { } }]); myapp.controller('mycontroller', ['$scope', function ($scope){ $scope.do = function() { alert('ng-click pressed!'); } }]); myform.html <div ng-controller="myformcontroller"> <form name="myform" role="form" ng-submit="signin()" novalidate> <input type="text"/> <div ng-controller="mycontroller"> <a href="javascript:void(0);&q

php - Ad Hoc Validation on checkboxlist yii2 -

i have activeform model <?= $form->field($model, 'name')->textinput() ?> <?= $form->field($model, 'address')->textinput() ?> <?= $form->field($dynamicmodel, 'brands')->checkboxlist($brands); ?> ... i'm using ajax validation want add validation checkboxlist i found this: http://www.yiiframew...-hoc-validation , this: http://www.yiiframew...hvalidator.html but have no idea how use and how assign values dynamic model? it's junctiontable, know how them database, not how assign them $dynamicmodel = \yii\base\dynamicmodel::validatedata(['brands'], [ [['brands'], 'required'], ['brands', 'each', 'rule' => ['integer']], ]); i guess you: // controller code: $dynamicmodel = new dynamicmodel(); $dynamicmodel->defineattribute('brands', $value = null); $dynamicmodel->addrule(['brands'], 'required']);

iframe - YouTube embeds slowing down page -

i have page bunch of thumbnail images when clicked open embedded youtube videos in modals. here html: <li> <div class="videold"> <a class="video-link" title="video title" href="#video" role="button" data-toggle="modal" data-id="youtubeid"> <img class="responsive-imamge" src="//www.mysite.com/video.jpg" alt="" > </a> <h4>video title</h4> <p>video description</p> <div id="video" class="modal hide fade in" tabindex="-1" role="dialog" aria-labelledby="mymodallabel" aria-hidden="true"> <button type="button" class="close" data-dismiss=&qu

java - How to use function parameters if function have @Test annotation? -

is there way use parameters in function if function has @test annotation. have function below: @test(@test(priority=1, alwaysrun =true)) public void home_page_flextronics(string susername, string spassword) throws filenotfoundexception { commonfunctions.launchapplication(); commonfunctions.login(susername, spassword); commonfunctions.clickonmodule("customers"); commonfunctions.clickonhome(); commonfunctions.logout(); } however when trying run above code giving me error: method home_page_flextronics requires 2 parameters 0 supplied in @test annotation. if remove parameters , use hardcoded values, working fine , requirement of framework. have gone through other solutions suggest use @parameter annotation or data provider. don't want use want take testdata excel sheet. please let me know if there other way present handle this. in advance. you take @ junit theories (introduct

c# - Deserializing an array of objects with Json.Net -

Image
the received data this: inside each item, there object, customer , have identical class that. how can convert them using json.net? i have tried followings: var data = jsonconvert.deserializeobject<list<customer>>(val); and adding class: public class customerjson { public customer customer{ get; set; } } and trying deserialize it: var data = jsonconvert.deserializeobject<list<customerjson>>(val); with both of them exception: cannot deserialize current json object (e.g. {"name":"value"}) type 'system.collections.generic.list`1[customer]' because type requires json array (e.g. [1,2,3]) deserialize correctly. fix error either change json json array (e.g. [1,2,3]) or change deserialized type normal .net type (e.g. not primitive type integer, not collection type array or list) can deserialized json object. jsonobjectattribute can added type force deserialize json object. path 'rows', line 1, positi

python - Change text color of QCheckBox in pyqt -

i want change color of text next qcheckbox . have tried these 2 questions: how change qcheckbox text label color in qt? changing qcheckbox text color none of solutions seem working me. p = qtgui.qpalette(self.chkbox[i].palette()) p.setcolor(qpalette.active,qpalette.windowtext, qtcore.qt.red) self.top_grid.addwidget(self.chkbox[i],i+2,0) edit 1: here minimal working code: from pyqt4 import qtgui, qtcore import sys def main(): app = qtgui.qapplication(sys.argv) w = qtgui.qwidget() top_grid = qtgui.qgridlayout() chkbox=[] chkbox.append(qtgui.qcheckbox('1')) chkbox[0].setstylesheet("color: red") chkbox[0].settooltip('<b>abc</b>' ) top_grid.addwidget(chkbox[0],0,0) w.setlayout(top_grid) w.show() sys.exit(app.exec_()) if __name__ == '__main__': main() when this, color of tooltip changes red, text next checkbox remains black. edit 2: if add line app.setstyle('cleanl

How to autostart my app with windows 8.1 or windows phone -

is possible autostart app @ device boot having windows 8.1 or windows phone 8.1? if yes, how? it possible android using broadcastreceiver it isn't possible automatically launch application @ foreground on windows phone , windows 8.1 (be @ startup or @ other time). however, application can execute in background (given limitations) using background agents, , interact in ways user (for instance, using toast notifications).

variables - System.getEnv() method - deprecated or not? -

many places suggest system.getenv() jdk method has been deprecated. many places suggest has been reinstated. is there better api provides functionality environment settngs in susequent jdks? or system.getenv() still preferred way environment variables / properties? system.getenv() , system.getenv(string) introduced in days of java, , deprecated in java 1.2(!). java 5 reinstated them (see bug 4199068 ), , since there's been no sign of these methods going anywhere or being deprecated again last dozen years or so, think it's safe assume they're here stay, , use them need them.

proof - Idris rewrite tactic doesn't work as expected -

i have example o : type hom : o -> o -> type id : (a : o) -> hom a comp : hom b -> hom b c -> hom c idright : (f : hom b) -> comp f (id b) = f idleft : (f : hom b) -> comp (id a) f = f assoc : (f : hom b) -> (g : hom b c) -> (h : hom c d) -> comp f (comp g h) = comp (comp f g) h eqid : (f : hom b) -> (g : hom b a) -> (h : hom b a) -> comp f g = id -> comp h f = id b -> g = h eqid = ?eqidproof and try use tactics in order make proof 1. intro a, b, f, g, h, fg, hf 2. rewrite idleft g 3. rewrite hf 4. rewrite assoc h f g so 4 step nothing. nothing sym . i'm doing wrong? possible there bug in idris itself? your file contains type declarations. need fill in body definitions if want this. example o : type , type declaration o , , won't usable until write like o : type o = bool in order use rewrite, need supply proof of form a = b . m

swift - Open iOS App by http:// link -

i found lot of tutorials opening app custom url scheme like: myappname:// thats nice great open app registering real app domain on http link like http://www.myappdomain.com/blablabla so - example - if visitor comes webpage (on her/his mobile) opened in browser, excepts installed app listening opened url , opens instead of browser. how done (i've seen @ app). great. in advance! it new feature in ios9. explained in wwdc15 talk seamless linking app . you add small piece of javascript each page opens custom url-scheme.

c# - Handle position of other pages when SplitView pane is open -

i trying implement splitview in app.but when ii set ispaneopen = true; pivots not moving right of split view pane.insted splitview pane opens on pivotitems. please me resolve this. in advance. my main page: <page x:class="splitview.mainpage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:splitview" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:ignorable="d"> <grid background="{themeresource applicationpagebackgroundthemebrush}"> <relativepanel x:name="myrelativepanel"> <pivot x:name="mypivot" relativepanel.alignrightwith="spv">

php - Could not open input file: yii -

i'm working yii2 , trying init migration files. working few months ago, i'm getting following error 'yii' not recognized internal or external command command i'm trying run 'yii migrate/create init_my_table i've been looking around not sure problem is. seems should pretty generic , easy fix error... before delve proposing solution, check if installed yii's basic template or advanced template. $ php yii serve will work "basic" template. make sure @ terminal, have changed "basic" directory, enter command: $ php yii serve output server started on http://localhost:8080 document root "path/public_html/yiiproject/basic/web" quit server ctrl-c or command-c. if using advanced template, read thread , see if thread here helps. read till end: http://www.yiiframework.com/forum/index.php/topic/68728-php-yii-serve/ had same issue using advanced template. php yii serve not open input file: yi

ruby - How to extract each JSON object in an array and feed into API request body -

i have array of 647 json objects , want extract each object , feed them 1 one request body of api. api accept each json object separately individual http request each object. how do this? this have far using basic each block in ruby httparty gem: require "json" require "httparty" restaurants = json.parse file.read('pretty-regex2.json') new_rest_variable = restaurants.each |restaurant| end response = httparty.post("https://api.example/placeholder", { :body => new_rest_variable.to_json, :headers => { "content-type" => "text", "accept" => "application/x-www-form-urlencoded", "authorization" => "token example-placeholder" } }) puts response.body puts response.code puts response.message example of 4 "restaurant objects" enclosed in array square brackets 647: [ { "id": "223078", "name": "3 south place&quo

javascript - How to block port on wamp server? -

i made simple html file syntax <!doctype html> <html> <head> <title>html_using_div</title> <!-- <link href="border.css"rel="stylesheet"/> --> <style> .c1{ background-image:url("i/table2.jpg "); background-repeat:no-repeat; background-attachment:local; font: italic bold 20px/1.2 arial,sans-serif; } <!-- .c2{ background-size:1000px 1000px; background-image:url("i/dsc05441.jpg"); background-repeat:no-repeat; background-attachment:scroll; } --> </style> </head> <body style="background: linear-gradient(-45deg, red , blue , indigo, white );"> <div style=" width=500px ;height:400px; margin:auto ; " > here content </div> </body> </html> after execution in browser console got div , javascript file name: <script type="text/javascript" src="http://127.0.0.

python - No response in ssh.exec_command in paramiko -

i trying use python paramiko execute commands on remote server. when run following commands prompt , appears have succeeded prompt back >>> import paramiko >>> ssh = paramiko.sshclient() >>> ssh.set_missing_host_key_policy(paramiko.autoaddpolicy()) >>> ssh.connect('a.b.c.d', username='server', password='xyz') >>> the response when try execute command [] >>> stdin, stdout, stderr = ssh.exec_command("host") >>> stdout.readlines() [] almost command gives same output. command "host" when ssh executed shell gives several lines of usage output i error if don't give password >>> ssh.connect('a.b.c.d', username='server') traceback (most recent call last): file "<stdin>", line 1, in <module> file "build\bdist.win32\egg\paramiko\client.py", line 307, in connect file "build\bdist.win32\egg\paramiko\client.py

swift - How to retrieve the last message from Quickblox in iOS? -

i send message chat dialog not able retreive last messages. how the last messages chat dialog id , and forwards recipient ios? if have been joined room, access lastmessagetext directly: dialog.lastmessagetext or last message id using qbrequest : qbrequest.messageswithdialogid("id", extendedrequest: ["sort_desc" : "date_sent", "limit" : 1], forpage: nil, successblock: { (response, messages, page) -> void in println(messages) }, errorblock: { (response) -> void in println(response) } )

Is there a way of detecting cURL connections? PHP -

basically have php page want display data, want page downloadable , people can display locally. but! want add feature can check internet connection, connecting page's origin see if resources available such external style sheets etc. checking connection this: public function connection(){ const location='http://myresource.co.uk/'; $curl=curl_init(location); $result=curl_execute(); curl_close(); return($result==='i exist')?true:false; } now i'm bit stuck because want resources index display information. want use 'i exist' when checking resource. possible? or should use additional file sane person? xd this isn't going practically work because users typically aren't going have php installed. can allow them download php file.. sure unless have web server running it's not going work. on top of they'll need have curl extension etc.. see here check if extension loaded: http://php.net/manual/en/function.ext

testing - How can I generally categorize tests for web page flows? -

when creating tests flows refer 'happy' , 'sad' paths. there flows intent touch every single link (including headers , footers) on every page. there lightweight "smoke" tests. what useful characterization these various tests can used lay out strategy of test @ level? one approach use following: full every link on every page , every form element happy , sad paths, fonts, colors , formatting correct sad+ sad paths show appropriate errors fixed user sad sad paths options* show appropriate errors fixed user happy+ happy path options* completes happy happy path completes quotes light landing pages initial form submissions work smoke landing page displays form *all options means using form options add additional information not required main flow

python - How to build a blender build in Xcode 5? -

i have been trying create own custom build of blender following through wiki have had no luck building final version x code. have 140 warning messages , 32 error messages. can't figure out. below section of code errors in it. appreciate on one! "_controller_actuators_length", referenced from: bl::controller::controller_actuators_length_wrap(pointerrna*) in libbf_intern_cycles.a(blender_python.o) bl::controller::controller_actuators_length_wrap(pointerrna*) in libbf_intern_cycles.a(blender_session.o) bl::controller::controller_actuators_length_wrap(pointerrna*) in libbf_intern_cycles.a(blender_camera.o) bl::controller::controller_actuators_length_wrap(pointerrna*) in libbf_intern_cycles.a(blender_sync.o) bl::controller::controller_actuators_length_wrap(pointerrna*) in libbf_intern_cycles.a(blender_object.o) bl::controller::controller_actuators_length_wrap(pointerrna*) in libbf_intern_cycles.a(blender_shader.o) bl::controller::controller

ember.js - Ember get current url in RESTadapter -

using ember 1.13.2 ember data 1.13.4 in conjunction rails backend. trying implement hmac authentication ember , ember data (restadapter) class authhelper authheader: (adapter)-> ... frontend.applicationadapter = ds.restadapter.extend( headers: (-> 'authorization': new authhelper().authheader(@) ).property().volatile()) for need url request going send to. how can url? or need construct manually collecting host , pluralized models name? get params ? update i able accomplish following code: ember.$.ajaxprefilter (options, oriopt, jqxhr) -> authheader = authhelper.authheader(options.url) jqxhr.setrequestheader("authorization", authheader) return the complete solution can found here: https://github.com/psunix/js-frameworks-api-auth maybe knows more ember way doing this.

How to translate a Solr query into Elasticsearch -

i'm trying express solr (lucene) query in elastic search, i'm not sure how: q=field1:"value1"^10 or field2:("value2a"^20 or "value2b"^30) group=true group.field=fieldgroup is there way pass lucene query es, don't need first translate it? it's possible pass lucene query elasticsearch using query_string query. should plausible: get /_search { "query": { "query_string": { "query": "field1:\"value1\"^10 or field2:(\"value2a\"^20 or \"value2b\"^30)" } } } you can use aggregations mimic field collapsing: https://www.elastic.co/guide/en/elasticsearch/guide/current/top-hits.html

android - Verify interactions in rxjava subscribers -

picture situation in mvp pattern presenter subscribes service returning observer: public void gatherdata(){ service.dosomemagic() .observeon(schedulers.io()) .subscribeon(androidschedulers.mainthread()) .subscribe(new thesubscriber()); } now class thesubscriber calls onnext method view, say: @override public void onnext(returnvalue value) { view.displaywhatever(value); } now, in unit test verify when method gatherdata() called on non-erroneous situation, view's method displaywhatever(value) called. the question : is there clean way this? background : i'm using mockito verify interactions , lot more of course dagger injecting entire presenter except thesubscriber what have tried : inject subscriber , mock in tests. looks bit dirty me, because if want change way presenter interacts service (say not rx) need change lot of tests , code. mock entire service. not bad, requires me mock lot of methods , didn't quite reach want

c# - Asp.Net - IEnumerable properties not binding to model -

i nullpointerexception error when attempt render @model.columns in view. i'm using linqtoexcel. relevant code parts: model: namespace steer.models { public class upfile { // irrelevant properties (name,size,filetype) omitted public ienumerable<string> columns { get; set; } public ienumerable<linqtoexcel.row> rows { get; set; } public class upfiledbcontext : dbcontext { public dbset<upfile> upfiles { get; set; } } } } view: @model steer.models.upfile @foreach (var item in model.columns) { <th>@item</th> } controller: upfile = new upfile(); // name, size, filetype binding omitted // here attempt bind columns , rows uploaded excel file var excel = new excelqueryfactory(appdomain.currentdomain.basedirectory + "uploaded\\" + up.name); var firstsheet = excel.getworksheetnames().first(); // rows ienumerable up.rows = c in excel.worksheet(fir

vector - OpenCL result changes depending on result of printf? What? -

opencl kernel crunches numbers. particular kernel searches array of 8 bit char4 vectors matching string of numbers. example, array holds 3 67 8 2 56 1 3 7 8 2 0 2 - kernel loops on (actual string 1024 digits long) , searches 1 3 7 8 2 , "returns" data letting host program know found match. in combo learning exercise/programming experiment wanted see if loop on array , search range of values, array not char values, char4 vectors, without using single if statement in kernel. 2 reasons: 1: after half hour of getting compile errors realized cannot do: if(charvector[3] == searchvector[0]) because may match , may not. , 2: i'm new opencl , i've read lot how branches can hurt kernel's speed, , if understand internals of kernels correctly, math may faster if statements. case? anyway... first, kernel in question: void search(__global uchar4 *rollsrc, __global uchar *srch, char srchlen) { size_t gx = get_global_id(0); size_t wx = get_local_id(0); __p

javascript - jQuery dropdown menu with css -

i've made bit lists , think i'm lost them when comes jquery , making menu toggle on click event. here have: http://jsfiddle.net/3rc63e3l/ the problem in menu. when mouse hovering element, showing , when click - hides. when i'm deleting css ol > li:hover > ul { display: block; } it won't work while clicking on menu2 tab. idea delete "hover" thing on menu2 , make work "click". how can fix it? you’re trying toggle list elements instead of list itself. use following javascript: $('ol li.submenuone').click(function() { $('ol li.submenuone ul').toggle(); }); and remove css above. demo: jsfiddle

bash - cd command fails when directory is extracted from windows file -

i have 1 text file in windows contains lots of directories need extract. tried extract 1 directory , tried cd in shell script, cd command failed, prompting cd: /var/gpio/: no such file or directory . i have confirmed directory exists in local pc , directory correct (though relative). have searched lot, seems special windows characters exist in extract file. tried see them cat -a check , result ^[[m^[[k^[[m^[[kvar/gpio/$ i don't know meaning of m^ or [[k . please me problem? use cygwin in windows 7 64-bit. below related code review: templt_dir=$(cat temp | grep -m 1 "$templt_name" |head -1 | sed -n "s#$templt_name##p" | sed -n "s#\".*##p") echo $templt_dir ###comment, runs output: /var/gpio/, that's correct! cd $templt_dir ###comment, cd error prompts cat temp | grep -m 1 "$templt_name" |head -1 | sed -n "s#$templt_name##p" | sed -n "s#\".*##p" > check ###comment, problem checking

I want to count different strings from a column in excel and print it -

my excel sheet has order of t-shirts. column f contains size of t-shirts, i.e s, m, l, xl, xxl. want count number of each type of shirt , print them somewhere on sheet order placed. please help. you make new sheet in first column possible sizes. using countif function can count how many times every size occurs in column. more specific, if first sheet called "sheet1", , if placed sizes in column of sheet. code result in: =countif(sheet1!f:f,concatenate("=",a1)) or short =countif(sheet1!f:f,a1) value of b1. can drag formula on other rows.

inline - Java - Check Not Null/Empty else assign default value -

i trying simplify following code. the basic steps code should carry out follows: assign string default value run method if method returns null/empty string leave string default if method returns valid string set string result a simple example be: string temp = system.getproperty("xyz"); string result = "default"; if(temp != null && !temp.isempty()){ result = temp; } i have made attemp using ternary operator: string temp; string result = isnotnullorempty(temp = system.getproperty("xyz")) ? temp : "default"; the isnotnullorempty() method private static boolean isnotnullorempty(string str){ return (str != null && !str.isempty()); } is possible of in-line? know this: string result = isnotnullorempty(system.getproperty("xyz")) ? system.getproperty("xyz") : "default"; but calling same method twice. something (which doesn't work): stri

javascript - "file format different from extension" when creating an xls file -

i trying create xlsx file, simple script: myapp.factory('excel',function($window){ var uri='data:application/vnd.ms-excel;base64,', template='<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/tr/rec-html40"><head><!--[if gte mso 9]><xml><x:excelworkbook><x:excelworksheets><x:excelworksheet><x:name>{worksheet}</x:name><x:worksheetoptions><x:displaygridlines/></x:worksheetoptions></x:excelworksheet></x:excelworksheets></x:excelworkbook></xml><![endif]--></head><body><table>{table}</table></body></html>', base64=function(s){return $window.btoa(unescape(encodeuricomponent(s)));}, format=function(s,c){return s.replace(/{(\w+)}/g,function(m,p){return c[p];})}; return { tabletoexcel:function(worksheetnam

Is the SonarQube Java analyser supposed to be able to analyse semantically incorrect Java source code? -

given following java source code, public class test { private static int a; private static int a; } you run error while analyzing, expected? think should log parser failure, not stop analysis, right? error: error during sonar runner execution org.sonar.runner.impl.runnerexception: unable execute sonar @ org.sonar.runner.impl.batchlauncher$1.delegateexecution(batchlauncher.java:91) @ org.sonar.runner.impl.batchlauncher$1.run(batchlauncher.java:75) @ java.security.accesscontroller.doprivileged(native method) @ org.sonar.runner.impl.batchlauncher.doexecute(batchlauncher.java:69) @ org.sonar.runner.impl.batchlauncher.execute(batchlauncher.java:50) @ org.sonar.runner.api.embeddedrunner.doexecute(embeddedrunner.java:102) @ org.sonar.runner.api.runner.execute(runner.java:100) @ org.sonar.runner.main.executetask(main.java:70) @ org.sonar.runner.main.execute(main.java:59) @ org.sonar.runner.main.main(main.java:53) caused by: org.sonar.squidb

ios - custom segue top bar -

when creating custom segue 1 view controller another, there's problem showing top bar properly. this code custom segue: @implementation customsegue - (void)perform { uiviewcontroller *sourceviewcontroller = self.sourceviewcontroller; uiviewcontroller *destinationviewcontroller = self.destinationviewcontroller; [sourceviewcontroller.view addsubview:destinationviewcontroller.view]; destinationviewcontroller.view.alpha = 0.0; [uiview animatewithduration:0.5 delay:0.0 options:uiviewanimationoptioncurveeaseinout animations:^{ destinationviewcontroller.view.alpha = 1.0; } completion:^(bool finished){ [sourceviewcontroller presentviewcontroller:destinationviewcontroller animated:no completion:null]; [destinationviewcontroller.view removefromsuperview];

checking login with php -

i'm making api simple forum ,, trying check login php on control page : checklogin.php <?php error_reporting(e_all); ini_set('display_errors', 1); if(!isset($_post['username']) or (!isset($_post['password']))) { die('type username & password'); } require_once('usersapi.php'); if(empty($_post['username']) || empty($_post['password'])){ tinyf_db_close(); die('bad user info'); } $user = tinyf_users_get_by_name($_post['username']); if(!$user) { die('bad user'); } //check connection if mysqli couldn't fetch $pass = md5(mysqli_real_escape_string($tf_handle, strip_tags($_post['password']))); tinyf_db_close(); // if(strcmp('n','n')) 0 , if(0) doesn't work :d if(strcmp($pass,$user->password !== 0)){ die('bad__user'); } die('success'); ?> the result ===> bad__user i expected result succ

android - sqLite not storing records for next month -

i developing app. activity opened asking "title", "description ", "venue using google api place picker", "date , time using date , time picker" , clicks on create button causes data saved on database. the problem when date of current month selected user date picker working fine , storing in db when user selects date of next months, not storing data in db entry. create.java package com.example.akshay.eventmanager; import android.app.activity; import android.app.datepickerdialog; import android.app.timepickerdialog; import android.content.intent; import android.os.bundle; import android.text.inputtype; import android.util.log; import android.view.view; import android.widget.button; import android.widget.datepicker; import android.widget.edittext; import android.widget.textview; import android.widget.timepicker; import android.app.timepickerdialog.ontimesetlistener; import android.widget.toast; import com.google.android.gms.common.google