Posts

Showing posts from August, 2014

c# - Why does this implementer method not see its sibling? -

i've got class implements interface: public class sqlitehhsdbutils : ihhsdbutils { void ihhsdbutils.setupdb() { . . . if (!tableexists("appsettings")) . . . bool ihhsdbutils.tableexists(string tablename) { . . . it can't find own brother sitting right below (the if (!tableexists() ): the name 'tableexists' not exist in current context how can / why not see it? you have explicit interface implementation. can't access interface methods directly unless cast current instance interface type: if (!((ihhsdbutils)this).tableexists("appsettings")) from 13.4.1 explicit interface member implementations it not possible access explicit interface member implementation through qualified name in method invocation, property access, or indexer access. explicit interface member implementation can accessed through interface instance, , in case referenced member name.

java - replace random number of characters at random position with wildcard -

i trying create program replace random number of characters @ random position "*". star letter used in main program , replaced "." wildcard matches possible result. so far manage create code see bellow. replaces 1 character of specific word. here on appreciated. example: input word: mouse random generator how characters replace: 3 random generator @ places replace: 1, 3, 5 result: *o*s* public class random_2 { public static void main(string[] args) { string test; int dolzina = 0; string outputfile = "random_2.txt"; arraylist<string> list = new arraylist(); try { file file = new file("random1.txt"); filereader filereader = new filereader(file); bufferedreader bufferedreader = new bufferedreader(filereader); string vrstica; while ((vrstica = bufferedreader.readline()) != null) { list.add(vrstica); // dolzina=list.size(); // sy

python script to scan a pdf file using online scanner -

i used code scan multiple pdf files contained in folder online scanner " https://wepawet.iseclab.org/ " using scrip. import mechanize import re import os def upload_file(uploaded_file): url = "https://wepawet.iseclab.org/" br = mechanize.browser() br.set_handle_robots(false) # ignore robots br.open(url) br.select_form(nr=0) f = os.path.join("200",uploaded_file) br.form.add_file(open(f) ,'text/plain', f) br.form.set_all_readonly(false) res = br.submit() content = res.read() open("200_clean.html", "a") f: f.write(content) def main(): file in os.listdir("200"): upload_file(file) if __name__ == '__main__': main() but after execution of code got following error: traceback (most recent call last): file "test.py", line 56, in <module> main() file "test.py", line 50, in main upload_file(file) file &

php - How to modify OpenFire default password encryption algorithm? -

by default, openfire server encrypts passwords using blowfish encryption whereby key stored in table ofproperty where propvalue = 'passwordkey' . how can customize behavior? how can set openfire use encryption algorithm, or replace encryption algorithm hashing instead? change system properties store plain password in openfire server , encrypt password(as per need) before sending password. to change system property: go to server->server manager->system properties edit property user.useplainpassword , give property value true .

titanium alloy get value of field in view -

i've been building first titanium alloy app , have 5 step signup form has different form fields spread across 5 views. on last step want post values of form elements. best way access each fields value? eg. in screen5 how value of $.name field in screen1 view? here of code: <scrollableview id="indexsv" showpagingcontrol="false" scrollingenabled="false" top="0"> <require src="screen1" id="screen1"></require> <require src="screen2" id="screen2"></require> <require src="screen3" id="screen3"></require> <require src="screen4" id="screen4"></require> <require src="screen5" id="screen5"></require> </scrollableview> and here how screens structured: <alloy> <view> <label top="20&q

latex - How to reduce the size of captions in all figures -

Image
i want captions of figures , table have same size \footnotesize. there put in preambule of document this? use caption package set font key-value footnotesize : \documentclass{article} \usepackage{caption} \captionsetup{font=footnotesize} \begin{document} regular text set in \verb|\normalsize|. \begin{table}[t] \caption{a table using \texttt{\string\footnotesize}.} \end{table} \begin{figure}[t] \caption{a figure using \texttt{\string\footnotesize}.} \end{figure} \end{document} it possible adjust label , text formats individually figure s , table s separately. however, consistency better option here.

How to post/upload recorded video as blob in MVC using HTML5/ Javascript at client side and C# code at controller? -

i building video surveillance application requirement save recorded video feeds server can served viewer later. using mediarecorder api so, , continuous stream end in large file difficult posted @ once, plan chop stream blob multiple chunks , keep posting periodically. recording event fired toggle switch in html page , javascript takes over. here code have far: html: some code... <div class="onoffswitch"> <input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox" id="switch1"> <label class="onoffswitch-label" for="switch1" onclick="togglevideofeed();"> <span class="onoffswitch-inner"></span> <span class="onoffswitch-switch"></span> </label> </div> some code... javascript: var mediarecorder; var pushinterval = 6000; var id, counter

android - Get Static NFC Tag Id with HCE mode -

i'm new in nfc thing, tested several phones calling gettagid() method in hce mode, , result: device | uid lg g2 | random lg g3 | static s4 | random htc 1 mini | static xiaomi mi3 | static my questions: why phones have static uid , not? chipset related? is possible fixed uid? need authenticate device. on other side, i'm using kitkat cyanogenmod 11 on xperia m, did not manage use hce, why? any documents can explain/support answer? why phones have static uid , not? chipset related? that depends on chipset , implementation of nfc stack. far i'm aware of, there 3 different scenarios used various android nfc devices: the device has secure element , uses static uid of secure element. the device generates new random uid whenever turned on. the device generates new random uid on every activation external reader device. i.e. whenever external hf field applied nfc antenna of android device. the device has no secure eleme

javascript - Transition not working -

my goal given value in seconds(resp_time), want create counter in anticlock direction end once resp_time becomes 0. i following tutorial: http://bl.ocks.org/mbostock/1096355 create polar clock. need arc decrease in go anti-clockwise. tried updating endangle value same, doesn't seem work. here's code: var width = 960, height = 800, radius = math.min(width, height) / 1.9, spacing = .09; var resp_time = 61; var rh = parseint(resp_time/3600), rm = parseint((resp_time- rh*3600)/60), rs = parseint((resp_time- rh*3600 - rm*60)%60); var color = d3.scale.linear() .range(["hsl(-180,50%,50%)", "hsl(180,50%,50%)"]) .interpolate(interpolatehsl); var t; var arc = d3.svg.arc() .startangle(0) .endangle(function(d) { return d.value * 2 * math.pi; }) .innerradius(function(d) { return d.index * radius; }) .outerradius(function(d) { return (d.index + spacing) * radius; }); var svg = d3.select("body").append("svg

geolocation - GPS: How do I get correct angle to display arrow facing to target -

im working javascript , geolocation module in html5. works fine, come point don't know how handle it. might easy don't point. display arrow thats shows me direction target location. got information geolocation module , found fine , correct bearing calculation here: arrow pointing gps position not pointing in right direction in javascript my concrete problem described in example: lets facing north while target straight in south, behind me. walk north, while bearing tells me: 180 degrees (to target in south), correct & fine… bearing arrow on cellar phone points through me, target location, fine. turn 180 degrees, facing target location , approaching it. bearing, of course, still says 180 degrees, correct. move towards target location, arrow on cellar phone should turn 180 point target location. of course can't because bearing still says: 180 degrees. assume somehow have combine heading angle bearing angle, arrow points correct target location. has idea? hint appre

javascript - Parse.com Error Code 111 on save -

i'm experiencing intermittent error app i'm writing. i'm using javascript parse.com back-end. i have array of objects. example: [ { "skillbase": 96, "skillname": "first aid" }, { "skillbase": 96, "skillname": "communication" } ] i have 3 rows in parse.com of model called "character". 1 of columns character of type array named "baseskills". i generate array of objects , save back-end using first of 3 characters, no problem. however, cannot save similar arrays second , third characters. keep getting error: https://api.parse.com/1/classes/character/zoi6qd14m6 400 (bad request) parse.js:1551 parse._ajax parse.js:1649 parse._request parse.js:5590 (anonymous function) parse.js:4055 (anonymous function) parse.js:3895 wrappedresolvedcallback parse.js:3957 (anonymous function) parse.js:3940 runlater parse.js:3956 _.extend.then parse.js:4054 _.exte

swing - Closing java popup frame without exiting program -

public buttongrid(int width, int length){ //constructor frame.settitle("mpc"); frame.setlayout(new gridlayout(width,length)); //set layout grid=new jbutton[width-1][length]; //allocate size of grid for(int y=0; y<length; y++){ for(int x=0; x<width-1; x++){ grid[x][y]=new jbutton("("+x+","+y+")"); //creates new button frame.add(grid[x][y]); //adds button grid grid[x][y].addactionlistener(this); grid[x][y].addkeylistener(this); //grid[x][y].setmnemonic(keyevent.vk_0); grid[x][y].setpreferredsize(new dimension(75,75)); } } for(int =0; i<boxlist.length; i++) box.additem(boxlist[i]); box.addactionlistener(this); frame.

python - Sharing Memory in Gunicorn? -

i have large read-only data structure (a graph loaded in networkx, though shouldn't important) use in web service. webservice built in flask , served through gunicorn. turns out every gunicorn worker spin up, worked holds own copy of data-structure. thus, ~700mb data structure manageable 1 worker turns pretty big memory hog when have 8 of them running. there way can share data structure between gunicorn processes don't have waste memory? it looks easiest way tell gunicorn preload application using preload_app option. assumes can load data structure module-level variable: from flask import flask your.application import customdatastructure custom_data_structure = customdatastructure('/data/lives/here') # @app.routes, etc. alternatively, use memory-mapped file (if can wrap shared memory custom data structure), gevent gunicorn ensure you're using 1 process , or the multi-processing module spin own data-structure server connect using ipc.

jquery - email encodeURIComponent no longer works after android update -

after recent update web app no longer fills in body of emails. email client comes proper subject body empty. web app worked in prior recent (awful) android update. think called lollipop. following jquery code. $(document).on("click", "#sendemail",function(){ $(location).attr('href', 'mailto:?subject=' + encodeuricomponent(emailsubject) + "&body=" + encodeuricomponent(emailbody) ); }); i suspect has gmail update. start looking? did else experience these problems? for benefit of else may looking answer. seems gmail bug. recommend switching maildroid or email client.

python - numpy all() evaluating incorrectly -

my code should stop when values of array greater 100. using np.all() evaluate condition. looks condition met, np.all() seems incorrectly evaluating. missing? python 2.7.8 on os 10.8.5. (pdb) ratio_j_a array([ 250.44244741, 186.92848637, 202.67726408, 143.01112845, 132.95878384, 176.49130164, 178.9892571 , 118.07516559, 205.59639112, 183.64142204]) (pdb) np.all(ratio_j_a) > 100. false (pdb) np.all(ratio_j_a) < 100. true numpy.all tests whether array elements along given axis evaluate true. >>> import numpy np >>> ratio_j_a = np.array([ ... 250.44244741, 186.92848637, 202.67726408, 143.01112845, ... 132.95878384, 176.49130164, 178.9892571 , 118.07516559, ... 205.59639112, 183.64142204 ... ]) >>> np.all(ratio_j_a > 100) true >>> np.all(ratio_j_a < 100) false why got wrong result: np.all(ratio_j_a) evaluated true because non-zero numbers treated truth value. , true equal 1. 1

c - How to tune Vertica ODBC driver performance? -

i using vertica odbc driver (the newest 7.1.1 version), , want test performance. after referring materials, configure following options in odbc.ini: transactionisolation = read committed autocommit = 0 the application spawns 20 thread, , every thread 1000 insert operations. every thread, commit once 20 insert operations. code like: ...... #define loop_count (1000) #define commit_count (20) (i = 0; < loop_count / commit_count; i++) { ret = sqlallochandle(sql_handle_stmt, conn_handle, &stmt_handle); if (!sql_succeeded(ret)) { printf("allocate statement handle failed\n"); goto test_thread_end; } snprintf(sql, sizeof(sql), "insert test(name, city) values('nan', 'nanjing')"); (j = 0; j < commit_count; j++) { ret = sqlexecdirect(stmt_handle, (sqlchar*)sql, sql_nts); if (!sql_succeeded(ret)) { printf("execute statement failed\n");

javascript - AngularJS service to variable -

is there way store data variable? i tried: $scope.another = function(){ var new_data; userservice.getinfo().success(function(data){ new_data = data; }); return new_data; }; var data = $scope.another(); but returns 'undefined' in console log. thank you edit i empty array new_data . var new_data = []; $scope.another = function(callback){ userservice.getinfo().success(function(data){ paymentservice.getcashierparams({ "cardnumber": data.cardnumber}).success(function(data){ gameservice.getallgames({ "pid":data.getcashierparameters.pid, "limit": 6, "skinid": 1}).success(function(data) { callback(data.data.getflashgamesresult.data.flashgame); }); }); });

How to count rows in a csv file and ignore the rows not in use (using python) -

i have csv file contains height in feet , inches , weight of basketball players. however, of data has null or blank space feet , height. i have conclude how many players obese based on bmi, calculated height , weight. i found out there 11 players obese. however, need find percentage of obese players within set of data. having trouble figuring out how find total number of players (ignoring have null or none in row). here example of data have: firstname lastname position firstseason lastseason h_feet h_inches weight marquis daniels g 2003 2009 6 6 200 predrag danilovic g 1995 1996 6 5 200 adrian dantley f 1976 1990 6 5 208 mike dantoni g 1975 1975 null null null henry darcey c 1952 1952 6 7 217 jimmy darden g 1949 1949 6 1 170 oliver darden f 1967 1969 6 6.5 235 yinka dare

Android - Facebook SDK installed but can't use Facebook button -

i have installed facebook sdk , have login set up, using basic button made when use button use, one: <com.facebook.widget.loginbutton android:id="@+id/facebook_button" android:layout_width="wrap_content" android:layout_height="wrap_content"/> i runtime error? 3650-3677/com.spencerfontein.ueat e/androidruntime﹕ fatal exception: asynctask #3 java.lang.runtimeexception: error occured while executing doinbackground() @ android.os.asynctask$3.done(asynctask.java:299) not sure why happening. there i'm missing? thanks in advance? i missing in android manifest.xml <activity android:name="com.facebook.loginactivity" android:label="@string/app_name" />

javascript - Automatically calculate sum of the dynamic textbox values -

i making php , mysql website billing... want sum of values in text box.. rows can added according user requirement... .. tried of things.. not getting right.... how sum of textbox values in last column rate... mean without user input such button click..... me code..... thanks in advance.. code made adding rows table.. function addrow(tableid) { var table = document.getelementbyid(tableid); var rowcount = table.rows.length; var row = table.insertrow(rowcount); var cell1 = row.insertcell(0); var element1 = document.createelement("input"); element1.type = "text"; element1.name="s_no[]"; element1.size="25"; element1.value = rowcount; cell1.appendchild(element1); var cell2 = row.insertcell(1); var element2 = document.createelement("input"); element2.type = "text"; element2.name="p_id[]";

Java: Count occurrences of characters in text file -

this part of program count occurrences of each letter within text file. want print a:4 b:23 c:32 , instead prints a:0b:0c:0a:0b:0c:0a:0b:0c:0 not find of occurrences of each letter. doing wrong here? help!! char ch = line.charat(0); int acounter=0; int bcounter=0; int ccounter=0; switch (ch) { case 'a': acounter++; break; case 'b': bcounter++; break; case 'c': ccounter++; break; } bw.write ("a:" + acounter); bw.write ("b:" + bcounter); bw.write ("c:" + ccounter); char ch[] = s.tochararray(); map map = new hashmap(); (int = 0; < ch.length; i++) { i

angularjs - I am not able to get response from web service using Angular javascript -

var msg = document.getelementbyid('inputxml').innerhtml;how pass input xml parameter web service , displaying response web service using angular javascript in html. here code, please help, m not able reponse web service. <div ng-app="customerapp" ng-controller="customerscontroller"> <ul> hi<br><br><li ng-repeat="x in names">{{x}}</li> </ul> </div> <script> var app = angular.module('customerapp'); app.factory( "setasxmlpost", function() { //prepare request data form post. function transformrequest(data, getheaders) { var headers = getheaders(); headers[ "content-type" ] = "text/xml; charset=utf-8"; // using parsexml xml return(jquery.parsexml(data)); } return(transformrequest); } );

objective c - How to synchronize two asynchronous delegate methods callbacks in iOS? -

i'm writing simple weather app try solidify understanding of protocols , delegates. i'm in following situation: i have 2 data sources weather data (just nsobjects @ time) , view controller want update once have received data both sources. the 2 data sources have protocols adhere in view controller. delegate methods called once have received data own web service. mean data source 1 gets data before data source 2, vice-versa, or @ same time (don't know 100% if possible) i want update view once have received data both sources. what best way this? thinking of nesting delegate methods, data source 1 notify data source 2 when has data (through protocols), have data source 2 notify view controller update view when has data. don't think correct/best way things. any ideas? thanks this sounds fit gcd dispatch groups. first, create dispatch group dispatch_group_create . use dispatch_group_enter before start request each service. call dispatch_group_lea

sql server - Join 2 tables and Count the number of occurrence specific field in SQL -

i have 2 tables , "t_common_country" , "t_hei_studentdata." using left join joined these tables this query select [t_common_country].[country_id], [t_common_country].[country], [t_hei_studentdata].[student_id] ([t_common_country] left join [t_hei_studentdata] on [t_common_country].[country] = [t_hei_studentdata].[stdcountry]) now i' getting view | country id | county | student id | | 1 | usa | 12 | | 1 | usa | 5 | | 2 | uk | 11 | | 2 | uk | 2 | i want count number of students (student_ids) relate country , i want view below | country id | county | students | | 1 | usa | 2 | | 2 | uk | 2 | use count function generate countrywise student count try this: select c.[country_id], c.[cou

html - How to keep <div> align center in this complicated case for floating ad -

i know there lots of people asking div align center problem. tried solution , seems won't work in case. sorry have ask here. created floating ad @ site http://tacfeed.com using following css, /* default stylesheet */ #close { margin-left: auto; margin-right: auto; float:left; display:inline-block; padding:2px 5px; color:black; background: #fff; } #responsive-adsense { display: none; } #responsive-adsense{ display: none; } /* general media query small screen sizes - covers common mobile devices, phones/tablets... */ @media screen , (max-width: 1023px) { .adcontainer { display: none; } #responsive-adsense{ display: none; } } @media screen , (max-width: 899px) { .adcontainer { width: 100%; height: auto; position: fixed; bottom: 0px; display: block; background: #fff; color: #fff; margin: 0 auto; padding: 0px; } #responsive-adsense { margin-left: auto; margin-right: auto; padding: 0px !important; width: 728px !i

Indirect accessing of data frame variable in R -

i have r data.frame object called x. r console when str(x), following get. str (x) 'data.frame': 2776 obs. of 4 variables: $ date : factor w/ 4018 levels "2003-01-01","2003-01-02",..: 1 6 11 16 21 26 31 36 41 46 ... $ sulfate: num na na na na na na na na na na ... $ nitrate: num na na na na na na na na na na ... $ id : int 1 1 1 1 1 1 1 1 1 1 ... i want access values related particular variable . in process when x.$nitrate values corresponding variable (ie nitrate) when following > frame_variable <- "nitrate" and then do > x$frame_variable null this limitation prohibiting me use feature in function i'm trying create . here. thanks. this way access columns variable: x[, frame_variable]

How to calculate the remaining days left for a persons next birthday from the date pickers selected date in android? -

Image
i have written program calculate age of person according date selected date picker , , working fine. added method display days remaining , day on persons birthday falls on next birthday private void calculatenextbirthday() { // todo auto-generated method stub date dt = new date(); simpledateformat sdf = new simpledateformat( "yyyy/mm/dd"); final string strbday = sdf.format(dt); try { dt = sdf.parse(strbday); } catch (final java.text.parseexception e) { // todo auto-generated catch block e.printstacktrace(); } final calendar c = calendar.getinstance(); c.settime(dt); // c.add(calendar.date, value); final calendar today = calendar.getinstance(); // take dob month , compare current // month final int bmonth = c.get(calendar.month); final int cmonth = today.get(calendar.month); c.set(calendar.year, today.get(calendar.year)); c.set(calendar.day_of_week,

json - Yelp Business API 2.0 Reviews with PHP not display -

i using yelp business api v2.0 documented @ https://github.com/yelp/yelp-api/blob/master/v2/php/sample.php my goal list reviews of specific business, using php make api call , retrieve json. seem able fetch nothing, however, api. have script prepared loop , display reviews returned. how can call api retrieve review? give me solution possible. output link: http://www.sejixclients.com/mover/sample.php

javascript - Change text when link clicked with jQuery -

i'd change button read close when clicked , act close too. fiddle demo how achieve current code? jquery: $(document).ready(function() { // expand panel $("#open").click(function(){ $("div#panel").slidedown("slow"); }); // switch visiblility of "close panel" button $("#close").click(function () { $("div#panel").slideup("slow"); }); }); you can use .is(':visible') check whether div visible , set text appropriately. code $("#open").click(function () { $("div#panel").slidetoggle("slow", function () { if ($("div#panel").is(':visible')) { $("#open").text('close'); } else { $("#open").text('quick quote'); } }); }); demo

jsp - What does "status" in <s:iterator> do? -

i using following command display values 'userlist' <s:iterator value="userlist" status="rowstatus"> <tr class="even"> <td><s:property value="tweet_id" /></td> <td><s:property value="message" /></td> <td><s:property value="created" /></td> </tr> </s:iterator> what use of status="rowstatus" in command? in case, none. when iterating, current object pushed on top of value stack. means can access using name (along the many other ways ). you can use value wish value attribute. but if (in case different your, encounter soon) need put value in form field that submitted an(other) action , targeting list<yourobject> attribute, need use iteratorstatus mount correct name attribute. example: sourceaction private list<user> sourceuserlist; targetaction private list<user> upda

Python: Conditionals for optional function arguments -

let's have function accepts 3 optional arguments: def function(arg1=0, arg2=0, arg3=0) what cleanest way handle conditionals within function depending on argument passed? right have is: def function(arg1=0, arg2=0, arg3=0) if arg1 !=0 , arg2 !=0 , arg3 != 0: # stuff 3 args elif arg1 !=0 , arg2 != 0: # stuff arg1 , arg2, etc... to expand upon this, if function can take 5 arguments? doing conditionals possible combinations seems drag. can not else check arguments have been passed function? update: based on feedback guess i'll explain in real terms i'm doing. need estimate someone's age based on when graduated school (high school, college, graduate program, etc). may have multiple years go on, , in fact may have multiple years each of high school, college, etc. so, example might be: def approx_age(highschool=0, college=0): this_year = date.today().year if (highschool != 0) , (college != 0): hs_age = (this_year - h

Managing system-wide parameters in C -

i'm developing system of many processes have aware of many configurations, options , data of system. doing that, implement shared object use pointer shared memory block of parameters , data. data of parameters types, values, default values, functions get/set , etc. data in kind of look-up table. shared object has functions get/set these parameters, processes in system can get/set these many parameters. have many defines parameters codes , many possibilities each parameter, example, 1 code can float value, , array of ints. can imagine complexity of code switch , cases.. my questions are: does practice correct handling system-wide parameters , configurations? speed , efficiency don't want use db file, have keep data close in ram. thought moving look-up table in-memory db processing time critical , don't want waste time on building sql statements , compiling them. ideas of best way it? your program design sounds fine, given parameters encapsulated in separate

scala - accessing list.head, deconstruction vs method call -

i trying learn bit of scala , got stuck on small oddity when far can can write same in 2 supposedly equivalent ways, 1 runs , other not. val test_array = array(1,2,3,4,5,6,7,8,9,10,3,4) val = test_array.sliding(2).tolist def iter(lst: list[array[int]]): list[boolean] = lst match { case h :: nil => list(false) case h :: tail => tail.map(x => x.sameelements(lst.head)) ++ iter(tail) } if(iter(it).contains(true)) ... and val test_array = array(1,2,3,4,5,6,7,8,9,10,3,4) val = test_array.sliding(2).tolist def iter(lst: list[array[int]]): list[boolean] = lst match { case h :: nil => list(false) case h :: tail => tail.map(x => x.sameelements(h)) ++ iter(tail) } if(iter(it).contains(true)) ... the first example runs, second throws nosuchmethoderror: scala.collection.immutable.$colon$colon.hd$1() the difference how access head. in 1 case use deconstruction way , other use list.head. why 1 run , other not?

asp.net mvc - AttributeRouting - Correct way of Getting the Action Name from RouteData -

i have started using attribute routing action methods , struggling in getting action name (and/or id) routedata. below example of how use attrubues so: [route( "edit/{id:int}" )] public actionresult edit( int id ) { ... } previously used following method extension of routedata retrieve value public static string getactionname( routedata routedata ) { return routedata.values[ "action" ] string; } this used return action name (in example "edit"). alway returns null. inspection of routedata dictionary shows these values seem no longer placed in root of array rather in item keyed "[0] = "ms_directroutematches". i able access value in following manner due limited understanding of how these values populated concerned that, e.g. routes there more 1 match, code fall on in cases. public static string getactionname( routedata routedata ) { if( routedata.values.containskey( "ms_directroutematches" ) ) route

php - refresh a SQL query to display changes -

i have following query: if (!isset($profile_id) || !is_numeric($profile_id)) return false; if ( isset(self::$newmessagecountcache[$profile_id]) ) { return self::$newmessagecountcache[$profile_id]; $filter_cond = sk_config::section('mailbox')->section('spam_filter')->mailbox_message_filter ? " , `m`.`status`='a'" : ''; $query = "select count(distinct `c`.`conversation_id`) `".tbl_mailbox_conversation."` `c` left join `".tbl_mailbox_message."` `m` on (`c`.`conversation_id` = `m`.`conversation_id`) (`initiator_id`=$profile_id or `interlocutor_id`=$profile_id) , (`bm_deleted` in(0,".self::interlocutor_flag.") , `initiator_id`=$profile_id or `bm_deleted` in(0,".self::initiator_flag.") , `interlocutor_id`=$profile_id) , (`bm_read` in(0,".self::interlocutor_flag.") , `initiator_id`=$profile_id or `bm_

php - File returns no errors, but doesn't work as expected -

i tried convert php file mysql mysqli because wanted use same server in future php version, doesnt work anymore. changed should functions don't work anymore. returns no error?. here file, big. how can see whats wrong file when there no errors or syntax highligting shows whats wrong? ob_start(); class database { var $connection = null; function connect($host, $user, $pass, $name) { $error = false; $this->connection = ($globals["___mysqli_ston"] = mysqli_connect($host, $user, $pass)) or $error = true; ((bool)mysqli_query( $this->connection, "use $name")) or $error = true; return !$error; } function executequery($query) { return mysqli_query($globals["___mysqli_ston"], $query); } function executefetch($result) { return mysqli_fetch_assoc($result); } function executefetchquery($query) { $result = mysqli_query($globals["___mys

javascript - AS3 - physical size of the desktop screen -

i want show ruler in web page has exact size ruler in real world (with cm, inches, etc). i'm tried determine real dpi or physical size of screen in web browser, impossible. is there way as3 or different way in browser? if available, screen dpi available, using as3, in : flash.system.capabilities.screendpi it should available of time.

android - Generated signed Apk successfully but when I try to Run my project, I get an error -

Image
to release application, generated signed apk ( im using android studio). signed apk generated successfully. key store path, created folder in c>user>folder>name.keystore . added alias , password , generated signed apk. however, when try run application on emulator, following error: app-release-unsigned.apk not signed. please configure signing information selected flavor using project structure dialog. is there step missed? did google search , found developers edit gradle file too. however,i not perform step because unclear. here build.gradle looks like: apply plugin: 'com.android.application' android { compilesdkversion 20 buildtoolsversion "20.0.0" defaultconfig { applicationid "com.app.shreyabisht.aethorr" minsdkversion 15 targetsdkversion 20 versioncode 1 versionname "1.0" } buildtypes { release { runproguard false proguardfiles getdefaultproguardfile('proguard-android.txt'), &#

sorting two dimensional arrays in C++ -

suppose have 2-d array a[4][2] this: 1 4 2 3 3 2 4 1 i sort arrays in array in increasing order of second numbers, i.e. after sorting, array this: 4 1 3 2 2 3 1 4 i thought of making map stores indices of numbers in second columns, , making array of numbers in second column , sorting array, reconstructing array new order of second column , map. problem, however, 2 numbers in second column might not distinct, if number appears twice, map[i] store last index. also, manually checking positions of first numbers corresponding second numbers take o(n^2) time. want in o(n log n). have suggestions? there built in method (c++ 4.3.2 / 4.8.1)? thanks in advance. you can std::sort . you'll need supply custom comparator thats not problem. its easier if use std::array define 2 dimensional array though follows: std::array< std::array< int, 2 >, 4 > twodarray; you can sort follows: std::sort( twodarray.begin(), twodarray.end(), []( const std::array<

php - 2nd function not working whan activate the plugin -

hello creating plugin when activate plugin create attribute size , colors in first code creating global $wpdb; // attributes parameters $wpm_attributes = array( array('label' => 'size', 'name' => 'size','type' => 'select',), array('label' => 'color', 'name' => 'color','type' => 'select',) ); //create default attributes foreach ( $wpm_attributes $attr ) { $attribute = array( 'attribute_label' => $attr['label'], 'attribute_name' => $attr['name'], 'attribute_type' => $attr['type'], 'attribute_orderby' => 'menu_order' ); if( !term_exists( $attribute ) ){ $wpdb->insert( $wpdb->prefix . 'woocommerce_attribute_taxonomies', $attribute ); delete_transient( 'wc_attribute_taxonomies' ); } } it working

asp.net mvc - Model is NULL in Ajax POST to controller action -

i have simple model , view. though, modelbinder seems fail when trying bind model because receive null controller action. doing wrong? razor code: @model bikesharing.views.shared.widgets.popups.logininputmodel @using (ajax.beginform("login",null, new ajaxoptions { updatetargetid = "login-partial-update", httpmethod = "post" }, new { id = "js-form-login" })) { @html.textboxfor(x => x.email, new {placeholder = "email address"}) <div class="errormessage"> @html.validationmessagefor(x=>x.email) </div> @html.passwordfor(x => x.password, new {placeholder = "password"}) <div class="errormessage"> @html.validationmessagefor(x => x.password) </div> } controller action: [httppost] public actionresult login(logininputmodel lmod) { if (modelstate.isvalid) { // code never reached because lmod null } return