Monday 15 September 2014

How do I get a list of all distributions in Mathematica -



How do I get a list of all distributions in Mathematica -

is there way parametric distributions in mathematica list without typing all?

{normaldistribution[x,y], uniformdistribution[{x,y}], exponentialdistribution[x]...}

thanks!

try

names["*distribution"]

and utilize list of symbol build need. might want refer help "toexpression", "stringjoin".

wolfram-mathematica distribution

php - Paypal IPN sandbox test -



php - Paypal IPN sandbox test -

in ipn script using variable called num_of_items. utilize loop loop thru each item create sure cost , cost paid correct.

the problem ipn works great when straight utilize method. however, when utilize post method , test via paypal's sandbox ipn simulator won't pass value script. so, script doesn't set database.

i know how can test ipn script via ipn simulator pass in variable?

php paypal paypal-ipn payment

ruby on rails - session[:previous_url] with endless scrolling -



ruby on rails - session[:previous_url] with endless scrolling -

when user logs in or signs in application redirected page on.

this code in application_controller.rb:

def after_sign_in_path_for(resource) session[:previous_url] || root_path end

the problem i'm using ajax , will_paginate implement endless scrolling. when user has scrolled past first page , login redirected url looks this:

www.example.com/path_=1412539956365&page=6

showing posts on page 6. how redirect to:

www.example.com/path

you utilize regex strip out query strings. here illustration using rails console:

?> session[:previous_url] => www.example.com/path_=1412539956365&page=6 ?> session[:previous_url][/[^\?_]+/] => "www.example.com/path"

you can alter function to:

def after_sign_in_path_for(resource) session[:previous_url][/[^\?_]+/] || root_path end

ruby-on-rails

java - Correct way to create a JFrame -



java - Correct way to create a JFrame -

this question has reply here:

extends jframe vs. creating within the program 6 answers

i reading 2 ways of creating jframe , don't undersand improve or differences:

import java.awt.*; import javax.swing.*; public class myframepanel { public static void main(string[] args) { jframe myframe = new jframe("myframepanel"); ....

and 1 find in books:

import java.awt.*; import javax.swing.*; public class buttonframe **extends jframe**{ public buttonframe() { super("button frame"); setdefaultcloseoperation(jframe.exit_on_close); ... setvisible(true); } public static void main(string[] args) { buttonframe bf = new buttonframe(); } }

i going utilize first 1 -i found in stackoverflow- wonder why of books reading java using "extends jframe" one.

thank much , sorry bothering if question stupid.

the first 1 choice. think composition on inheritance.

to favor composition on inheritance design principle gives design higher flexibility, giving business-domain classes , more stable business domain in long term.

if won't utilize myframepanel within jframe, instead in applet, it's easier switch , improve maintain in long term.

java swing jframe

mysqli - sometimes my sql connection keep saying "PHP Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result" -



mysqli - sometimes my sql connection keep saying "PHP Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result" -

actually, connected 3 databases in different server, got problem in mysqli_query.

sometimes worked fluently without error, showed "php warning: mysqli_fetch_array() expects parameter 1 mysqli_result".. don't know happen, ocurred sometimes.

here connection : connection.php

<?php $databasename1 = "db_name1"; $dbhostname1 = "host1"; $dbusername1 = "username"; $dbpassword1 = "password"; $databasename2q = "db_name2"; $dbhostname2 = "host2"; $dbusername2 = "username2"; $dbpassword2 = "password2"; $databasename3q = "db_name3"; $dbhostname3 = "host3"; $dbusername3 = "username3"; $dbpassword3 = "password3"; $mysqli1 = mysqli_connect("$dbhostname1", "$dbusername1", "$dbpassword1", "$databasename1"); $mysqli2 = mysqli_connect("$dbhostname2", "$dbusername2", "$dbpassword2", "$databasename2q"); $mysqli3 = mysqli_connect("$dbhostname3", "$dbusername3", "$dbpassword3", "$databasename3q"); $server[1] = $mysqli1; $server[2] = $mysqli2; $server[3] = $mysqli3; $count_db = 3; if(!$mysqli1){ echo "error connect server 1st"; die(); } if(!$mysqli2){ echo "error connect server 2nd"; die(); } if(!$mysqli3){ echo "error connect server 3rd"; die(); } if (mysqli_connect_errno()) { printf("connect failed: %s\n", mysqli_connect_error()); exit(); } ?>

task1.php

<?php include("connection.php") for($i=1;$i<=$count_db;$i++){ $conn = $server[$i]; $array = mysqli_fetch_array(mysqli_query($conn,"select * `table`")); $task = $array["field"]; } ?>

anyone guys can help?

do

for($i=1;$i<=$count_db;$i++){ $conn = $server[$i]; $resultset = mysqli_query($conn,"select * `table`") if(!$resultset){ //do continue; //if don't want break } $array = mysqli_fetch_array($resultset); $task = $array["field"]; }

php mysqli

jsf - Edit commandLink goes to Edit page but does not populate values into input fields -



jsf - Edit commandLink goes to Edit page but does not populate values into input fields -

my edit page not display bean values when it's called datalist populated jdbc search works fine if list not jdbc search.

the delete link works fine edit link returns edit page no populated values in fields.

my bean viewscoped bean.

the datalist display page:

<h:form rendered="#{not empty usersmanagedbean.userslist}" id="form"> <div class="table-responsive"> &nbsp; <h:datatable value="#{usersmanagedbean.usermodel}" var="showuser" styleclass="table table-striped table-bordered table-hover"> <h:column> <f:facet name="header"> username </f:facet> <h:outputtext value="#{showuser.username}"/> </h:column> <h:column> <f:facet name="header"> first name </f:facet> <h:outputtext value="#{showuser.firstname}"/> </h:column> <h:column> <f:facet name="header"> lastly name </f:facet> <h:outputtext value="#{showuser.lastname}"/> </h:column> <h:column> <f:facet name="header"> security level </f:facet> <h:outputtext value="#{showuser.groupname}"/> </h:column> <h:column rendered="false"> <f:facet name="header"> security level </f:facet> <h:outputtext value="#{showuser.id}"/> </h:column> <h:column> <h:commandlink value="edit" action="#{usersmanagedbean.updateuser()}"> </h:commandlink> || <h:commandlink value="delete" onclick="if (!confirm('are sure, want delete #{showuser.username}?')) { homecoming false; } ; homecoming true; " action="#{usersmanagedbean.deleteuser(showuser)}"> </h:commandlink> </h:column> </h:datatable> <h:link outcome="adduser.xhtml" value="add new user"/> </div>

the edit page:

<h:form> <div class="form-group"> <label>first name:</label> <h:inputtext id="firstname" styleclass="form-control" value="#{usersmanagedbean.user.firstname}"></h:inputtext> <label>last name:</label> <h:inputtext id="lastname" styleclass="form-control" value="#{usersmanagedbean.user.lastname}"></h:inputtext> <label>username:</label> <h:inputtext id="username" styleclass="form-control" value="#{usersmanagedbean.user.username}"></h:inputtext> <div class="form-group"> <label>security level:</label> <h:selectonemenu id="roleselect" value="#{usersmanagedbean.user.groupname}" styleclass="form-control"> <f:selectitem itemlabel="----" itemvalue="----"/> <f:selectitem itemlabel="administator" itemvalue="admin"/> <f:selectitem itemlabel="user" itemvalue="user"/> </h:selectonemenu> </div> <label>password:</label> <h:inputsecret id="password" styleclass="form-control" value="#{usersmanagedbean.user.password}" required="true" requiredmessage="enter password"/> <h:message for="password" style="color:red"/> <label>confirm password:</label> <h:inputsecret id="password2" styleclass="form-control" required="true" requiredmessage="re-enter password"/> <h:message for="password2" style="color:red" /> <o:validateequal components="password password2" message="passwords don't match" showmessagefor="password2"/> </div> <h:commandbutton value="update" type="submit" styleclass="btn btn-default" action="#{usersmanagedbean.saveuser()}"></h:commandbutton> || <h:commandbutton value="cancel" onclick="history.back(-1);return false" styleclass="btn btn-default"></h:commandbutton> </h:form>

the method calls edit page:

public string updateuser(){ user = usermodel.getrowdata(); homecoming "edituser.xhtml"; }

no exceptions thrown @ all.

if utilize @viewscoped bean, jsf create new instance of when navigate list page edit page. have 3 alternatives can think of:

use @sessionscoped. open edit page via ajax , popup panel. use @viewscoped, add together user id url view parameter (ie. edituser.xhtml?id=123), , load user info db in edit page instead of list page, on page load. in scenario, it's best have different managed beans list , edit pages.

jsf jsf-2

javascript - Passing two different arguments to function -



javascript - Passing two different arguments to function -

i have written jquery functions, , realized needed reuse code situation. refactored code take selector arguement, can utilize case 1, , case 2. however, when execute functions in document.ready weird results.

$( document ).ready(function() { imagecalc('.com-background > img'); setimagedims('.com-background > img', '#main-content'); imagecalc('.blog-entry-content iframe'); setimagedims('.blog-entry-content iframe', '#content'); });

it should noted, these selectors no show on same page. also, when run 1 instance of imagecalc() , setimagedims() these functions work fine. here functions in question..

function imagecalc(selector) { var obj=$(selector); $imgwidth = obj.width(); $imgheight = obj.height(); $imgaspectratio = $imgheight / $imgwidth; // $(selector).css('margin-left', function( calcmargin ) { homecoming parseint($('.main-content').css('padding')) * -1 + "px"; }); prepare ie obj.css('margin-left', '-10px' ); } function setimagedims(selector, content_area) { var container = $(content_area); $(selector).css('height', function() { homecoming $imgaspectratio * container.width(); }); $(selector).css('width', function() { homecoming container.width() + 20; }); }

in summary, code works fine, when have each function called 1 time in document.ready need utilize code 2 scenarios, how can this?

add var in front end of $imgwidth, $imgheight, , $imgaspectratio variables. without var, they're beingness declared @ global scope, , hence accidentally getting shared across both calls function.

update: noticed $imgaspectratio beingness used both functions. perhaps can create homecoming value first function, can passed sec function.

to elaborate... should theoretically work, although i'm not able test since don't have corresponding html:

function imagecalc(selector) { var obj=$(selector); var $imgwidth = obj.width(); var $imgheight = obj.height(); var $imgaspectratio = $imgheight / $imgwidth; // $(selector).css('margin-left', function( calcmargin ) { homecoming parseint($('.main-content').css('padding')) * -1 + "px"; }); prepare ie obj.css('margin-left', '-10px' ); homecoming $imgaspectratio; } function setimagedims(selector, content_area, $imgaspectratio) { var container = $(content_area); $(selector).css('height', function() { homecoming $imgaspectratio * container.width(); }); $(selector).css('width', function() { homecoming container.width() + 20; }); } $( document ).ready(function() { var ratio1 = imagecalc('.com-background > img'); setimagedims('.com-background > img', '#main-content', ratio1); var ratio2 = imagecalc('.blog-entry-content iframe'); setimagedims('.blog-entry-content iframe', '#content', ratio2); });

javascript jquery

Why do I keep getting `bash: local: command not found` -



Why do I keep getting `bash: local: command not found` -

keep getting error:

bash:   local: command not found bash:   local: command not found bash:   local: command not found bash:   local: command not found bash:   local: command not found bash:   local: command not found bash:   local: command not found bash:   local: command not found bash:   local: command not found bash:   local: command not found bash:   local: command not found bash:   local: command not found bash:   local: command not found bash:   local: command not found bash:   local: command not found bash:   local: command not found bash:   local: command not found bash:   export: command not found bash:   export: command not found bash: ~/.bash_profile: no such file or directory

here bash_profile:

when comment out prompt function, error goes away except lastly one!

alias ngrok=/users/mmahalwy/desktop/code/ngrok export clicolor=1 export lscolors=gxfxcxdxbxegedabagaced alias ls='ls -gfh' function prompt { local black="\[\033[0;30m\]" local blackbold="\[\033[1;30m\]" local red="\[\033[0;31m\]" local redbold="\[\033[1;31m\]" local green="\[\033[0;32m\]" local greenbold="\[\033[1;32m\]" local yellow="\[\033[0;33m\]" local yellowbold="\[\033[1;33m\]" local blue="\[\033[0;34m\]" local bluebold="\[\033[1;34m\]" local purple="\[\033[0;35m\]" local purplebold="\[\033[1;35m\]" local cyan="\[\033[0;36m\]" local cyanbold="\[\033[1;36m\]" local white="\[\033[0;37m\]" local whitebold="\[\033[1;37m\]" local resetcolor="\[\e[00m\]" export ps1="\n$red\u $purple@ $green\w $blue[\#] → $resetcolor" export ps2="| → $resetcolor" } # prompt export path=/usr/local/bin:$path source ~/.git-completion.bash

if local genuinely not available (for instance, disabled enable -n local), seeing:

bash: local: command not found

instead of:

bash: local: command not found

those spaces clue. closely @ file (with hex editor, if have to), , figure out bytes aren't either spaces or tabs are... , alter them genuine ascii space characters.

there several non-breaking space variants found in unicode; i'm guessing somehow got script. copy-and-pasting code web can dangerous. :)

bash

java - Why can't this class find this array? -



java - Why can't this class find this array? -

i have array works in first class (coloredwordsexperiment), while sec class, (buttonhandler), cannot find it.

the unusual thing if i, in buttonhandler class, substitute coloredwords.labels[i] or let's "coloredwords.labels[1]" coloredwords.labels1, while in first class declare jlabel labels1 = new jlabel; works.

that's had since have 12 labels decided utilize array instead. problem class buttonhandler cannot find variable "coloredwords.labels[i]".

this code (i left out unimportant stuff otherwise code quite long):

public class coloredwordsexperiment { buttonhandler buttonhandler; coloredwordsexperiment(){ jlabel[] labels = new jlabel[12]; (i = 0; < 12; i++) { labels[i] = new jlabel("press button"); labels[i].setpreferredsize(new dimension(90,40)); labels[i].setopaque(true); labels[i].setbackground(color.white); labels[i].sethorizontalalignment(swingconstants.center); labelcontainer.add(labels[i]); } button1 = new jbutton("matching"); buttonhandler = new buttonhandler(this); button1.addactionlistener(buttonhandler); } public static void main(string[] arg) { new coloredwordsexperiment(); } }

-

class buttonhandler implements actionlistener { coloredwordsexperiment coloredwords; public buttonhandler(coloredwordsexperiment coloredwords) { this.coloredwords = coloredwords; } @override public void actionperformed(actionevent e){ if (e.getactioncommand().equals("matching")) { (i = 0; < 12; i++) { coloredwords.labels[i].settext("text changed"); } } }

jlabel[] labels variable declared within constructor of coloredwordsexperiment class. move field in class , initialize in class constructor:

public class coloredwordsexperiment { buttonhandler buttonhandler; //it should declared here jlabel[] labels; coloredwordsexperiment() { //this variable within class constructor //jlabel[] labels = new jlabel[12]; //this line initializes labels field labels = new jlabel[12]; // rest of code... } }

also, should declare getter method obtain 1 of jlabels within labels variable instead of using direct access variable. create code cleaner.

java arrays

c# - WIN32API returns only current machine name -



c# - WIN32API returns only current machine name -

i want collect list of machines in local network, trying below code. homecoming me current machine name only. how can machines ip/name in local network?.

i have tried sv_101_types, among these returns empty list , remaining returns current machine name.

could guide me, wrong?

public class programme { static void main(string[] args) { arraylist machines = netapi32.getserverlist(netapi32.sv_101_types.sv_type_all); } } /// <summary> /// summary description class1. /// </summary> /// public class netapi32 { // constants public const uint error_success = 0; public const uint error_more_data = 234; public enum sv_101_types : uint { sv_type_workstation = 0x00000001, sv_type_server = 0x00000002, sv_type_sqlserver = 0x00000004, sv_type_domain_ctrl = 0x00000008, sv_type_domain_bakctrl = 0x00000010, sv_type_time_source = 0x00000020, sv_type_afp = 0x00000040, sv_type_novell = 0x00000080, sv_type_domain_member = 0x00000100, sv_type_printq_server = 0x00000200, sv_type_dialin_server = 0x00000400, sv_type_xenix_server = 0x00000800, sv_type_server_unix = 0x00000800, sv_type_nt = 0x00001000, sv_type_wfw = 0x00002000, sv_type_server_mfpn = 0x00004000, sv_type_server_nt = 0x00008000, sv_type_potential_browser = 0x00010000, sv_type_backup_browser = 0x00020000, sv_type_master_browser = 0x00040000, sv_type_domain_master = 0x00080000, sv_type_server_osf = 0x00100000, sv_type_server_vms = 0x00200000, sv_type_windows = 0x00400000, sv_type_dfs = 0x00800000, sv_type_cluster_nt = 0x01000000, sv_type_terminalserver = 0x02000000, sv_type_cluster_vs_nt = 0x04000000, sv_type_dce = 0x10000000, sv_type_alternate_xport = 0x20000000, sv_type_local_list_only = 0x40000000, sv_type_domain_enum = 0x80000000, sv_type_all = 0xffffffff }; [structlayout(layoutkind.sequential)] public struct server_info_101 { [marshalas(system.runtime.interopservices.unmanagedtype.u4)] public uint32 sv101_platform_id; [marshalas(system.runtime.interopservices.unmanagedtype.lpwstr)] public string sv101_name; [marshalas(system.runtime.interopservices.unmanagedtype.u4)] public uint32 sv101_version_major; [marshalas(system.runtime.interopservices.unmanagedtype.u4)] public uint32 sv101_version_minor; [marshalas(system.runtime.interopservices.unmanagedtype.u4)] public uint32 sv101_type; [marshalas(system.runtime.interopservices.unmanagedtype.lpwstr)] public string sv101_comment; }; public enum platform_id { platform_id_dos = 300, platform_id_os2 = 400, platform_id_nt = 500, platform_id_osf = 600, platform_id_vms = 700 } [dllimport("netapi32.dll", entrypoint = "netserverenum")] public static extern int netserverenum([marshalas(unmanagedtype.lpwstr)]string servername, int level, out intptr bufptr, int prefmaxlen, ref int entriesread, ref int totalentries, sv_101_types servertype, [marshalas(unmanagedtype.lpwstr)]string domain, intptr resume_handle); [dllimport("netapi32.dll", entrypoint = "netapibufferfree")] public static extern int netapibufferfree(intptr buffer); [dllimport("netapi32", charset = charset.unicode)] private static extern int netmessagebuffersend( string servername, string msgname, string fromname, string buf, int buflen); public static int netmessagesend(string servername, string messagename, string fromname, string strmsgbuffer, int imsgbufferlen) { homecoming netmessagebuffersend(servername, messagename, fromname, strmsgbuffer, imsgbufferlen * 2); } public static arraylist getserverlist(netapi32.sv_101_types servertype) { int entriesread = 0, totalentries = 0; arraylist alservers = new arraylist(); { // buffer store available servers // filled netserverenum function intptr buf = new intptr(); server_info_101 server; int ret = netserverenum(null, 101, out buf, -1, ref entriesread, ref totalentries, servertype, null, intptr.zero); // if function returned data, fill tree view if (ret == error_success || ret == error_more_data || entriesread > 0) { intptr ptr = buf; (int = 0; < entriesread; i++) { // cast pointer server_info_101 construction server = (server_info_101)marshal.ptrtostructure(ptr, typeof(server_info_101)); //cast pointer ulong add-on work on 32-bit or 64-bit systems. ptr = (intptr)((ulong)ptr + (ulong)marshal.sizeof(server)); // add together machine name , comment arraylist. //you homecoming entire construction here if desired alservers.add(server); } } // free buffer netapibufferfree(buf); } while ( entriesread < totalentries && entriesread != 0 ); homecoming alservers; } }

c# winapi

sql - Oracle - select records in which a subset does not repeat -



sql - Oracle - select records in which a subset does not repeat -

i have oracle info set next columns f1, f2, f3, f4 follows:

a, b, c, d a, b, c, e a, f, c, d a, g, c, d

i filter out duplicate fields in column f1 , f2 only. illustration above, see line 1 , 2 have identical values (a,b) in field (f1,f2), need either

a, b, c, d or a, b, c, e

but not both. final result expect be:

a, b, c, d a, f, c, d a, g, c, d

or

a, b, c, e a, f, c, d a, g, c, d

how issue oracle statement accomplish goal? have tried:

select * t (rowid,f1,f2) in (select distinct rowid, f1,f2 t)

but statement not help , still print out. please help.

below quick , dirty script create testing info set:

create table "t" ( "f1" varchar2(20 byte), "f2" varchar2(20 byte), "f3" varchar2(20 byte), "f4" varchar2(20 byte) ) insert t (f1,f2,f3,f4) values ('a','b','c','d'); insert t (f1,f2,f3,f4) values ('a','b','c','e'); insert t (f1,f2,f3,f4) values ('a','f','c','d'); insert t (f1,f2,f3,f4) values ('a','g','c','h');

is corresponding needs:

select t.* t bring together (select f1, f2, min(rowid) rid t grouping by(f1,f2)) o on t.rowid = o.rid

see http://sqlfiddle.com/#!4/dcf9c/4

the inner query remove duplicated on f1,f2 (deterministically keeping minimum rowid in case of duplicates). outer select simple bring together on rowid extract entire row.

if t view, cannot utilize rowid. have rely on instead:

select f1, f2, f3, min(f4) f4 t natural bring together (select f1, f2, min(f3) f3 t grouping by(f1,f2)) o grouping by(f1,f2,f3);

see http://sqlfiddle.com/#!4/dcf9c/8

the key thought here create 3-uple distinct f1,f2 , corresponding minimum f3 (inner query). extending 3-uple adding minimum f4 (outer query). can generalized n-uple nesting more queries.

sql oracle

java - Can't get Tomcat to start in Eclipse -



java - Can't get Tomcat to start in Eclipse -

trying help friend eclipse , tomcat configured getting error 'starting tomcat v7.0 server @ localhost' has encountered problem.

the error goes on "the apache tomcat installation @ directory version 6.0.37. tomcat installation expected.

not sure why because when first went in add together tomcat take download version 7.

thanks looking @ this.

java eclipse tomcat

c++ - imread from openCV makes the image darker -



c++ - imread from openCV makes the image darker -

i'm using opencv 2.4.9 , have problem images.

i have original imagem,

in c++ do,

cv::mat img = cv::imread(sourceimgpath, cv_load_image_unchanged); imshow("test", img); //or imwrite(path, img);

and imshow or imwrite next image,

so can see, it's darker , have no thought why happen. have tried flags imread same thing. can help?

thanks time. appreciate help.

wazhup

according imagemagick in srgb colourspace gamma of 0.4545. suspect not opencv expecting , gamma or colourspace correction maybe required. sorry, not post comment (rather answer) because big , formatting ridiculous. constructive , help lead solution you.

image: brdap.jpg format: jpeg (joint photographic experts grouping jfif format) mime type: image/jpeg class: directclass geometry: 600x400+0+0 units: undefined type: truecolor endianess: undefined colorspace: srgb depth: 8-bit channel depth: red: 8-bit green: 8-bit blue: 8-bit channel statistics: pixels: 240000 red: min: 0 (0) max: 255 (1) mean: 100.628 (0.39462) standard deviation: 52.5382 (0.206032) kurtosis: 0.337274 skewness: 0.482249 green: min: 0 (0) max: 255 (1) mean: 108.882 (0.426989) standard deviation: 55.0518 (0.215889) kurtosis: -0.330334 skewness: 0.193815 blue: min: 0 (0) max: 255 (1) mean: 128.997 (0.505872) standard deviation: 70.9162 (0.278103) kurtosis: -1.38343 skewness: -0.0647535 image statistics: overall: min: 0 (0) max: 255 (1) mean: 112.836 (0.442493) standard deviation: 60.0557 (0.235513) kurtosis: -0.536439 skewness: 0.289801 rendering intent: perceptual gamma: 0.454545 <--------------------- gamma chromaticity: reddish primary: (0.64,0.33) greenish primary: (0.3,0.6) bluish primary: (0.15,0.06) white point: (0.3127,0.329) background color: white border color: srgb(223,223,223) matte color: grey74 transparent color: black interlace: none intensity: undefined compose: on page geometry: 600x400+0+0 dispose: undefined iterations: 0 compression: jpeg quality: 99 orientation: undefined properties: date:create: 2014-10-14t22:03:59+01:00 date:modify: 2014-10-14t22:03:59+01:00 icc:copyright: copyright (c) eastman kodak company, 1999, rights reserved. icc:description: prophoto rgb icc:manufacturer: kodak icc:model: reference output medium metric(romm) jpeg:colorspace: 2 jpeg:sampling-factor: 1x1,1x1,1x1 signature: c436a68fe624fd471fcd3563b7dafa154ec4f17e784a448a2863a24856c70be6 profiles: profile-icc: 940 bytes artifacts: filename: brdap.jpg verbose: true tainted: false filesize: 210kb number pixels: 240k pixels per second: 24mb user time: 0.000u elapsed time: 0:01.009 version: imagemagick 6.8.9-7 q16 x86_64 2014-09-10 http://www.imagemagick.org

c++ image opencv

angularjs - Weird Angular Binding Issue -



angularjs - Weird Angular Binding Issue -

i'm having weird angularjs binding problem

<a class="navbar-brand" href="#">application (environment: {{ globalconfig.environment + ""}})</a>

that work, , render value "dev"

<a class="navbar-brand" href="#">application (environment: {{ globalconfig.environment }})</a>

this doesn't render anything.

<a class="navbar-brand" href="#">application (environment: <span ng-bind="globalconfig.environment"></span>)</a>

this lastly illustration works.

any ideas why sec illustration won't render out value "dev"?

the controller follows:

angular.module('uppapp').controller('globalcontroller', function ($scope) { $scope.globalconfig = { environment: 'dev' }; });

the html looks follows:

<!doctype html> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" ng-app="uppapp"> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content=""> <meta name="author" content=""> <link rel="icon" href="../../favicon.ico"> <title>pixel pimp web ui</title> <link href="assets/css/style.css" rel="stylesheet" /> <!-- html5 shim , respond.js ie8 back upwards of html5 elements , media queries --> <!--[if lt ie 9]> <script src="assets/thirdparty/ie8mediasupport.js"></script> <![endif]--> </head> <body ng-controller="globalcontroller"> <div class="navbar navbar-fixed-top" role="navigation"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse"> <span class="sr-only">toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="#">pixel pimp (environment: <span ng-bind="globalconfig.environment"></span>)</a> </div> <div class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <li class="active"><a href="#">dashboard</a></li> <li><a href="#about">pixel groups</a></li> </ul> </div><!--/.nav-collapse --> </div> </div> <div class="container"> <h1>dashboard</h1> <div id="myfirstchart" style="height: 250px;"></div> </div><!-- /.container --> <script src="assets/thirdparty/built.js"></script> <script src="assets/js/uppangular.js"></script> <script> $(function () { gengraph(); }); function gengraph() { new morris.line({ // id of element in draw chart. element: 'myfirstchart', // chart info records -- each entry in array corresponds point on // chart. data: [ { year: '2008', value: 20 }, { year: '2009', value: 10 }, { year: '2010', value: 5 }, { year: '2011', value: 5 }, { year: '2012', value: 20 } ], // name of info record attribute contains x-values. xkey: 'year', // list of names of info record attributes contain y-values. ykeys: ['value'], // labels ykeys -- displayed when hover on // chart. labels: ['value'] }); } </script> </body> </html> update

when wrap decorate interpolate service debugging this:

app.config(function($provide){ $provide.decorator("$interpolate", function($delegate){ var interpolatewrap = function(){ var interpolationfn = $delegate.apply(this, arguments); if(interpolationfn) { homecoming interpolationfnwrap(interpolationfn, arguments); } }; var interpolationfnwrap = function(interpolationfn, interpolationargs){ homecoming function(){ var result = interpolationfn.apply(this, arguments); var log = result ? console.log : console.warn; log.call(console, "interpolation of " + interpolationargs[0].trim(), ":", result.trim()); homecoming result; }; }; angular.extend(interpolatewrap, $delegate); homecoming interpolatewrap; }); });

the console log show:

interpolation of {{globalconfig.environment+""}} : dev

however binding of {{globalconfig.environment}} nil shows in console window.

ok figured out. i'm using grunt bake first time, , think grunt bake, stripping out {{globalconfig.environment}} code rendered file.

sorry. stupid mistake.

update

ultimately fixed modifying bake parse pattern utilize [{ }] instead of {{ }}

bake: { build: { options: { parsepattern: '/\[\{\s?([\.\-\w]*)\s?\}\]/g' }, files: { "app/index.html": "app/base.html" } } },

angularjs

for loop - PHP Find right value for x when x + 20% = 276 -



for loop - PHP Find right value for x when x + 20% = 276 -

i need able solve x value x + 20% = y script. y value known in script, x needs solved.

i've tried loop.

the echo $i should output 230, @ moment script doesn't homecoming (blank white screen)

$amount = 276; for($i = 1; $i<300; $i++) { if($i+20% == $amount) { echo $i; } }

basic maths: calculate 120% of value $i:

if (($i/100)*120 == $amount)

or improve still, calculate value $i if know value 120%:

$i = ($amount/120)*100;

which can simplified to:

$i = ($amount/12)*10; //same goes first snippet: if (($i/10)*12 == $amount)

php for-loop

c# - Converting byte[] to image Windows Phone -



c# - Converting byte[] to image Windows Phone -

i have little problem when want "create" image byte array image.source (xaml)... firs save byte array web

string pomocna = responses.getvalue("slika").tostring(); byte[] pomocnopolje = new byte[pomocna.length]; int brojac = 0; foreach (char in pomocna) { pomocnopolje[brojac] = byte.parse(a.tostring()); brojac++; } nova.slika = pomocnopolje;

and set image source

stranica.slika.source = converttobitmapimage(nova.slika)

the problem occur on converttobitmapimage method

public static bitmapimage converttobitmapimage(byte[] image) { var bitmapimage = new bitmapimage(); var memorystream = new memorystream(image); bitmapimage.setsource(memorystream); homecoming bitmapimage; }

on line

bitmapimage.setsource(memorystream);

does knows how prepare it? ahead

if byte[] image jpeg , want maintain memory stream this:

public static bitmapimage converttobitmapimage(byte[] image) { writeablebitmap wb = null; using (memorystream ms = new memorystream(image)) { seek { wb = microsoft.phone.picturedecoder.decodejpeg(ms); } grab (exception ex) { string error_message = ex.message; } } homecoming convertwbtobi(wb); } // converts writeablebitmap bitmapimage private bitmapimage convertwbtobi(writeablebitmap wb) { if(wb == null) homecoming null; bitmapimage bi; using (memorystream ms = new memorystream()) { wb.savejpeg(ms, wb.pixelwidth, wb.pixelheight, 0, 100); bi = new bitmapimage(); bi.setsource(ms); } homecoming bi; }

c# windows-phone-8

Query a Google Spreadsheet (use as an external database -



Query a Google Spreadsheet (use as an external database -

i have little local library , have entered our books google spreadsheet. allow users search book via basic search form on our website, , results spreadsheet. our simple site hosting not have mysql. in way possible? mark

i'd create simple web app using google apps script attached spreadsheet loaded of books local array , filtered them , sent output user using htmlservice. @ the google charts query language query, re-create in es5 filter function or @ arraylib gas library filtering.

database google-docs

android - How to pass bulk of json objects into Json array -



android - How to pass bulk of json objects into Json array -

hi can 1 help issue, not able pass arraylist of values in bellow json array.

please help me.

ex values:

arraylist<string> list_values = new arraylist<string>(); list_values.add(111); list_values.add(222); list_values.add(333); arraylist<string> list_labeltext = new arraylist<string>(); list_labeltext.add("mileage entry"); list_labeltext.add("tip amount"); list_labeltext.add("travel time"); arraylist<string> list_optionid = new arraylist<string>(); list_optionid.add("1"); list_optionid.add("2"); list_optionid.add("3");

i want pass above array list values in json array this:

clockoutemployeereponse":[{"response":[{"response":[{"value":"111"}],"labeltext":"mileage entry","clockoutoptionid":2},{"response":[{"value":"222"}],"labeltext":"tip amount","clockoutoptionid":4},{"response":[{"value":"333"}],"labeltext":"travel time","clockoutoptionid":3}]

my code follows:

jsonobject parentdata = new jsonobject(); jsonarray req_parameters = new jsonarray(); jsonobject req_clockout_obj = new jsonobject(); jsonarray req_arr = new jsonarray(); jsonobject value = new jsonobject(); req_clockout_obj.put("clockoutoptionid", 1); req_clockout_obj.put("labeltext", labeltext); (int = 0; < list_values.size; i++) { if (i == 0) { value.put("value", list_values.get(0)); req_arr.put(value); req_clockout_obj.put("response", req_arr); } else if (i == 1) { value.put("value", list_values.get(1)); req_arr.put(value); req_clockout_obj.put("response", req_arr); } else if (i == 2) { value.put("value", list_values.get(2)); req_arr.put(value); req_clockout_obj.put("response", req_arr); } } req_parameters.put(req_clockout_obj); parentdata.put("clockoutemployeereponse", req_parameters);

best way implement using model class , fetch info in instance of model(pojo) convert json string. need gson library. steps :       1. create pojo(model class) of according json format.       2. fetch info in object of pojo.       3. u can convert pojo's object json using

dataobject obj = new dataobject(); gson gson = new gson(); // convert java object json format, // , returned json formatted string string json = gson.tojson(obj);

please follow next link : http://www.mkyong.com/java/how-do-convert-java-object-to-from-json-format-gson-api/

please utilize this, if need help allow me know.

android json arraylist arrays

ios - ReactiveCocoa: how to keep signal until the server is connected? -



ios - ReactiveCocoa: how to keep signal until the server is connected? -

i have 2 signals (racsignal):

synchronizetoserversignal: signal containing info sent server. serverconnectionsignal: signal containing boolean value indicate connection state.

the synchronizetoserversignal triggered when content changed, , signal controlled serverconnectionsignal:

if latest value of serverconnectionsignal yes, synchronizetoserversignal maintain sending next value (data). if latest value of serverconnectionsignal no, synchronizetoserversignal maintain holding latest value , discarding old values. 1 time serverconnectionsignal sends yes, serverconnectionsignal maintain sending next value again.

how utilize reactivecocoa accomplish this?

replaylast give signal holds onto latest value sent , discards old values. if:then:else: allows switch between 2 signals based on value of 3rd boolean signal.

but switch between? since want ignore values, can utilize [racsignal empty] -- switching between signal useful value , signal no values:

[racsignal if:serverconnectionsignal then:[synchronizetoserversignal replaylast] else:[racsignal empty]] subscribenext:^(id x) { // sync here }];

the intent of code made lot more clear helper method in category, though:

@implementation racsignal (helpers) - (racsignal *)guard:(racsignal *)boolsignal { homecoming [racsignal if:boolsignal then:self else:[racsignal empty]]; } @end

then can write:

[[synchronizetoserversignal replaylast] guard:serverconnectionsignal]

much more clear!

ios reactive-cocoa

asp.net - send email from listview button -



asp.net - send email from listview button -

i have made listview fetching email id of client . there button send mail service selected column. don't know how please help me. code working now..

imports scheme imports system.data imports system.data.sqlclient imports system.configuration partial class dashboard inherits system.web.ui.page dim con new sqlconnection("data source=suraj;initial catalog=brandstik2; integrated security=true") dim comp_id, client_name string protected sub add_company_click(byval sender object, byval e system.eventargs) handles add_company.click add_client.visible = true headings.text = "add new companies" end sub protected sub page_load(byval sender object, byval e system.eventargs) handles me.load if not me.ispostback me.bindlistview() end if add_client.visible = false send_request_form.visible = false headings.text = "dashboard" 'dim str1 string = "select * brandstiktesti" 'dim cmd1 new sqlcommand(str1, con) 'con.open() 'dim rdr1 sqldatareader = cmd1.executereader 'while rdr1.read ' label1.text = rdr1(0) ' label2.text = rdr1(1) 'end while 'con.close() 'rdr1.close() 'cmd1.dispose() end sub protected sub send_request_click(byval sender object, byval e system.eventargs) handles send_request.click add_client.visible = false send_request_form.visible = true headings.text = "send feedback request" success.visible = false end sub protected sub submit_client_click(byval sender object, byval e system.eventargs) handles submit_client.click dim comp_id, client_name, email_id string form1.visible = true comp_id = textbox1.text client_name = textbox2.text email_id = textbox3.text textbox1.text = "" textbox2.text = "" textbox3.text = "" seek dim str1 string = "insert brandstiktesti(comp_id, client_name, email_id) values ('" + comp_id + "', '" + client_name + "', '" + email_id + "')" con.open() dim cmd new sqlcommand(str1, con) cmd.executenonquery() con.close() grab ex exception response.write("this id exist") end seek success.text = "client added succesfully" end sub private sub bindlistview() dim con new sqlconnection("data source=suraj;initial catalog=brandstik2; integrated security=true") using cmd new sqlcommand() cmd.commandtext = "select comp_id, client_name, email_id brandstiktesti" cmd.connection = con using sda new sqldataadapter(cmd) dim dt new datatable() sda.fill(dt) lvcustomers.datasource = dt lvcustomers.databind() end using end using end sub end class

how can select emaild id on button click of listview & send mail service on particular mail service id.

when asp.net element post server, beingness done using asp's premade javascript function __dopostback :

<script> function __dopostback( eventtarget, eventargument ) { document.form1.__eventtarget.value = eventtarget; document.form1.__eventargument.value = eventargument; document.form1.submit(); } </script>

if want pass html listview element code behind, can intercept button click , submit email_id in __eventargument argument thats beingness sent server.

for example, can run javascript function on asp.net button click, prior posting using onclientclick:

<asp:button id="bt_send" runat="server" text="send" onclick="bt_send_click" onclientclick="submit_stuff" /> function submit_stuff(){ //get email id here var _email_id = "blablabla1"; //manually cause postback email id argument __dopostback('<%=bt_send.clientid%>',_email_id ); homecoming false; }

and in code behind, either on page load or on bt_send_click function retrieve argument:

dim email_id string = request.form("__eventargument")

asp.net vb.net

PHP date timestamp timezone not converted properly -



PHP date timestamp timezone not converted properly -

so have code:

$timestamp = 1414708099; echo $timestamp; $date = date_make_date($timestamp, 'utc', 'datestamp'); date_timezone_set($date, timezone_open('america/new_york')); $timestamp = $date->format('u'); echo '<br>'; echo $timestamp;

which supposed convert timezone of initial timestamp utc new york.

but ends printing

1414708099<br>1414708099

hence timezone didnt change...

what did wrong?

btw uses drupal 6 date_api.module: http://drupalcontrib.org/api/drupal/contributions!date!date_api.module/function/date_make_date/6

as per comments

a timestamp always utc. can't apply time zone timestamp - consider timezone 0. whatever do, stays 0. asked date formatted u - manual states this:

u: seconds since unix epoch (january 1 1970 00:00:00 gmt).

you can't seconds unix epoch new york. number same location in world. now, had formatted date using, say, $date->format('y-m-d h:i:s') correctly formatted time timezone offset new york.

long story short - there no problem whatsoever here. works intended.

php date datetime timezone datetime-format

ios - UITableViewCell's implementation of -layoutSubviews needs to call super -



ios - UITableViewCell's implementation of -layoutSubviews needs to call super -

i add together view in uitableviewcell , , utilize mas_makeconstraints (masonry)

uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:kmascellreuseidentifier forindexpath:indexpath]; uiview * view =[[uiview alloc]init]; view.backgroundcolor=[uicolor redcolor]; [cell addsubview:view]; [view mas_makeconstraints:^(masconstraintmaker *make){ make.right.equalto(cell).offset(-20); make.centery.equalto(cell); make.width.height.equalto(@20); }];

but not work.

error message: terminating app due uncaught exception 'nsinternalinconsistencyexception', reason: 'auto layout still required after executing -layoutsubviews. uitableviewcell's implementation of -layoutsubviews needs phone call super.'

please help me ! @.@

better yet, why not create custom uitableviewcell , add together views need it, via ib.

ios objective-c iphone masonry-ios-osx

click - Elements Hiding When Clicked document jQuery -



click - Elements Hiding When Clicked document jQuery -

js fiddle

here hiding buttons if textarea empty , user clicks outside of textarea. when textarea empty , user clicks of buttons below buttons should not hide run respective functions . can help me ?

on blur event of textarea, added check if button's parent div (.tog) hovered, if yes, don't hide that.

updated javascript:

$('textarea').focus(function () { $('.tog').hide(); $(this).siblings('.tog').show(); }).blur(function () { // check if hover on buttons if ((!$(this).val().length > 0) && (!$(this).siblings('.tog').is(':hover'))) { $(this).siblings('.tog').hide(); } }); $('.upload').click(function () { alert('choose file upload'); }); $('.clear').click(function () { alert('cleared'); }); $('.save').click(function () { alert('saved'); });

fiddle

jquery click toggle

osx - NSTableview View Based Scrolling Performance -



osx - NSTableview View Based Scrolling Performance -

i new os x cocoa programming have decided give go new swift language.

i have nstableview 1500 rows (will more) , 7 columns. there 1 checkbox column , rest text fields, 1 date formate , 1 currency formatter. first set cell based. scrolling buttery smooth (i did test adding 1 1000000 rows, still smooth). under mavericks.

i upgraded yosemite, scrolling performance degraded. enabling core animation layer checkbox on table view improved still worse in mavericks.

during reading trying improve scroll performance in yosemite came across "view-based" nstableviews. documentation said cell based table views should not used , supported legacy projects.

i hence converted table view based table view. sample simple concept, nil complicated. scrolling performance absolutely terrible. if scroll slow smooth plenty start scroll faster hasn't buffered plenty , starts stuttering , jerking. when nstableview populated, focusing , defocusing window takes sec or more (i tried in mavericks 1 time again , not present, scrolling little better, still near cell based).

are view based nstableviews bad scrolling performance? if why apple recommend using them on cell based nstableviews.

also applications safari , reeder2 have buttery smooth scrolling in yosemite. how accomplish this?

am missing or performance of os x going hell each new thing? i.e

mavericks > yosemite

cell-based > view-based

old > new

any help much appreciated. thanks!

according apple, osx never enable quartzcore default (as ios, instead, do). so, need to:

link against quartzcore.framework project under build settings pane. enable coreanimation layer (under view effects inspector on ib) main window (if possible, otherwise sure enable on container view give poor performances).

quoting apple docs:

in ios apps, core animation enabled , every view backed layer. in os x, apps must explicitly enable core animation back upwards doing following:

link against quartzcore framework. (ios apps must link against framework if utilize core animation interfaces explicitly.) enable layer back upwards 1 or more of nsview objects doing 1 of following:

in nib files, utilize view effects inspector enable layer back upwards views. inspector displays checkboxes selected view , subviews. recommended enable layer back upwards in content view of window whenever possible. views create programmatically, phone call view’s setwantslayer: method , pass value of yes indicate view should utilize layers. enabling layer back upwards in 1 of preceding ways creates layer-backed view. layer-backed view, scheme takes responsibility creating underlying layer object , keeping layer updated. in os x, possible create layer-hosting view, whereby app creates , manages underlying layer object. (you cannot create layer-hosting views in ios.) more info on how create layer-hosting view, see “layer hosting lets alter layer object in os x.”

more on: https://developer.apple.com/library/ios/documentation/cocoa/conceptual/coreanimation_guide/settinguplayerobjects/settinguplayerobjects.html

osx cocoa swift scroll nstableview

mysql - php - add to array and loop variable -



mysql - php - add to array and loop variable -

i have script loops through set of data, , phone call function while doing so:

$d = $dbh->prepare(" select * xeon_users_rented since <= unix_timestamp(current_timestamp - interval 14 day) , clicks_last <= unix_timestamp(current_timestamp - interval 14 day) "); $d->execute(); $rows = $d->fetchall(pdo::fetch_assoc); $new_array = array(); foreach ($rows $data ) { $new_array[] = $data['id']; $usertorecyclefor = $data['user_by']; $outcome = $rentedrefs->_recyclemulti( 0, $usertorecyclefor, $new_array, 1 ); }

this function _recyclemulti();:

function _recyclemulti($ceny, $referer, $recycle_array, $free=false){ global $dbh; $this->ceny['rec'] = $ceny; $totalrecycle = count($recycle_array); $koszyk = $this->ceny['rec'] * count($recycle_array); $referer_sql = $dbh->prepare(" select * `users` `username` = :referer limit 1; "); $referer_sql->bindparam(':referer', $referer); seek { $referer_sql->execute(); } grab (pdoexception $e) { _op_error($e->getmessage(), __file__, __line__); } $referer_dane = $referer_sql->fetch(); $referer_dane_accont = $referer_dane['membership']; for( $i = 0; $i < count($recycle_array); $i++ ){ # expires $recycle_sql = $dbh->prepare(" select * `users_rented` `id` = :id limit 1; "); $recycle_sql->bindparam(':id', $recycle_array[$i]); $recycle_sql->execute(); $recycle = $recycle_sql->fetch(); echo "row count:"; echo $recycle_sql->rowcount(); if( $recycle_sql->rowcount() == 0 ){ homecoming false; } if( ! $recycle_sql || ( $recycle_sql->rowcount() == 0 ) || $recycle['user_by'] != $referer_dane['username'] ){ homecoming false; } homecoming true; }

now, problem is, runs function fine. although first time it's beingness run, works. have added this:

echo "row count:"; echo $recycle_sql->rowcount();

and result:

row count:1row count:0row count:0row count:0row count:0row count:0row count:0row count:0row count:0row count:0row count:0row count:0row count:0row count:0row count:0row count:0row count:0row count:0row count:0

as can see, it's first time it's beingness run, there valid row.

what doing wrong?

the explanation right in documentation of rowcount():

if lastly sql statement executed associated pdostatement select statement, databases may homecoming number of rows returned statement. however, behaviour not guaranteed databases , should not relied on portable applications.

in other words, rowcount() not provide info whether code works.

to check if query successful, check homecoming value of execute() or fetch(), both homecoming false on failure. in latter case, create sure compare using === match type. in addition, functions throw exceptions additional information, if query fails. check the examples fetch() on how handle these exceptions.

apart that, not using result in $recycle @ all.

php mysql sql pdo

html - Clear gap between span and table -



html - Clear gap between span and table -

jsfiddle

i added span right after first table, didn't work expected, there gap between table , span, , span width not conform first table's width

this css span:

.tieudecuoi { line-height:24px; background-color: #80a5ce; text-transform: uppercase; color: #fff; font-weight: bold; font-size: 12px; margin-top: 0; margin-bottom: 0; padding-top:0px; padding-bottom: 0; width:300px !important; }

jsfiddle

it works me, mentioned in comments, tested in chrome...

edit: changed aproach little bit, not sure if can in project, if do, give want result. please allow me know if doable you.

class="snippet-code-css lang-css prettyprint-override"> .tieudecuoi { background-color: #80a5ce; text-transform: uppercase; color: #fff; font-weight: bold; font-size: 12px; margin-top: 0; margin-bottom: 0; padding-top: 0px; padding-bottom: 0; } body { } table, th, td, tr { border-collapse: collapse; border: 1px solid; } .tb { width: 500px; } /*2 cell đầu tiên, xác định độ rộng*/ .tdkq { width: 70%; vertical-align: top; } .tddd { width: 30%; vertical-align: top; } /*bảng kết quả và đầu đuôi*/ .tbkq { width: 100%; word-wrap: break-word; table-layout: fixed; float: left; margin-bottom: 0; padding-bottom: 0; } .tbdd { width: 100%; } /*cột giải và kết quả của bảng kết quả*/ .trkq { width: 100%; } .thkqgiai { width: 20% !important; } .thkqso { width: 80% !important; } .tdkqgiai { text-align: center; } .tdkqso { text-align: center; word-wrap: break-word !important; } /*cột đầu và đuôi của bảng đầu đuôi*/ .thdddau { width: 30%; } .thddduoi { width: 70%; } /*tiêu đề cho bảng kq*/ .tieudemien { line-height: 24px; background-color: #80a5ce; text-transform: uppercase; color: #fff; font-weight: bold; font-size: 12px; width: 500px; margin-bottom: 0; padding-bottom: 0; } class="snippet-code-html lang-html prettyprint-override"><h2 class="tieudemien"> kết quả xổ số miền bắc ngày 02-11-2014</h2> <table class="tb"> <tbody> <tr> <td class="tdkq"> <table class="tbkq"> <tbody> <tr class="trkq"> <th class="thkqgiai">giải</th> <th class="thkqso">btb</th> </tr> <tr> <td class="tdkqgiai">Đặc biệt</td> <td class="tdkqso">23411</td> </tr> <tr> <td class="tdkqgiai">giải nhất</td> <td class="tdkqso">37428</td> </tr> <tr> <td class="tdkqgiai">giải nh&#236;</td> <td class="tdkqso">38460-75356</td> </tr> <tr> <td class="tdkqgiai">giải ba</td> <td class="tdkqso">02055-66542-36814-52154-66881-20546</td> </tr> <tr> <td class="tdkqgiai">giải bốn</td> <td class="tdkqso">6300-7736-6062-3408</td> </tr> <tr> <td class="tdkqgiai">giải năm</td> <td class="tdkqso">0235-2078-1344-6340-4550-6337</td> </tr> <tr> <td class="tdkqgiai">giải s&#225;u</td> <td class="tdkqso">046-421-944</td> </tr> <tr> <td class="tdkqgiai">giải bảy</td> <td class="tdkqso">88-98-24-21</td> </tr> <tr> <td colspan="2" class="tieudecuoi"> spadfj lkj lkj lkj lkj lkj lkj lkj lkj lkj lkj lkj lkj lkjn </td> </tr> </tbody> </table> </td> <td class="tddd"> <table class="tbdd"> <tbody> <tr class="trkq"> <th class="thdddau">Đầu</th> <th class="thddduoi">Đuôi</th> </tr> <tr> <td class="tdkqgiai">0</td> <td class="tdkqso">0,8</td> </tr> <tr> <td class="tdkqgiai">1</td> <td class="tdkqso">1,4</td> </tr> <tr> <td class="tdkqgiai">2</td> <td class="tdkqso">8,1,4,1</td> </tr> <tr> <td class="tdkqgiai">3</td> <td class="tdkqso">6,5,7</td> </tr> <tr> <td class="tdkqgiai">4</td> <td class="tdkqso">2,6,4,0,6,4</td> </tr> <tr> <td class="tdkqgiai">5</td> <td class="tdkqso">6,5,4,0</td> </tr> <tr> <td class="tdkqgiai">6</td> <td class="tdkqso">0,2</td> </tr> <tr> <td class="tdkqgiai">7</td> <td class="tdkqso">8</td> </tr> <tr> <td class="tdkqgiai">8</td> <td class="tdkqso">1,8</td> </tr> <tr> <td class="tdkqgiai">9</td> <td class="tdkqso">8</td> </tr> </tbody> </table> </td> </tr> </tbody> </table>

html css

javascript - I get this error on net::ERR_CACHE_MISS -



javascript - I get this error on net::ERR_CACHE_MISS -

i found prepare 1 else advice have problem when loading , unloading content , trying load new content div.

this code i'm using load content hidden div, loads content, fades , scrolls top of document if needed. heres code loading content:

$(".director").click(function(){ // .director class of links var href = $(this).attr('href'); $('#cont_nota').load(href); $('#cont_nota').fadeto( 500, 1).css('opacity','100'); $("html, body").animate({ scrolltop: 0 }, "normal"); homecoming false; });

now within loaded content utilize code close window , unload content:

$("#cont_nota").click(function(){ $('#cont_nota').fadeto( 500, 0, function(){ $("#cont_nota").empty(); }); });

it works couple of clicks after few clicks nil happens, code stops working , can see in javascript console rue next legend:

failed load resource: net::err_cache_miss

this seems error in chrome developer tools console (see post on so: bizarre error in chrome developer console - failed load resource: net::err_cache_miss)

i'v been going eve , i'm sure can give me hint.

javascript jquery google-chrome

xpages - Using External jar causing Error -



xpages - Using External jar causing Error -

i'm doing next steps:

create empty notes database (lotus notes 9.0.1 on domino 9 server) creating xpage 1 label inserting external jar file (code - jars)

i tested setting different jar files. in cases there no problems found 2 jar files produce error 500 in xpage without beingness referenced

starface-rpc-1.6.442.jar

log4j-1.2.17.jar

does has thought can problem?

those 2 .jar files depend other .jar files.

look @ project pages this log4j find out .jar files need add together application too.

update:

those .jar files remain in conflict existing java apis used domino server. that's why error without using them in xpage used domino server executing xpage.

look here explanation log4j issue

jar xpages

jquery - Javascript - [object Object] means? -



jquery - Javascript - [object Object] means? -

one of alert giving above result [object object] mean? alert of object of jquery type.

it means alerting instance of object. when alerting object, tostring() called on object, , default implementation returns [object object].

var obja = {}; var objb = new object; var objc = {}; objc.tostring = function () { homecoming "objc" }; alert(obja); // [object object] alert(objb); // [object object] alert(objc); // objc

if want inspect object, should either console.log it, json.stringify() it, or enumerate on it's properties , inspect them individually using for in.

javascript jquery

javascript - What's the good practice to wrap some useful js libraries to angular modules? -



javascript - What's the good practice to wrap some useful js libraries to angular modules? -

there useful libraries want utilize in angularjs, e.g. jquery, underscore, underscore.string.

it might not thought utilize them straight in angular code(say, controllers, directives), because it's hard mock , test. want wrap them angular modules:

angularunderscore.js

define(['angular', 'underscore'], function(ng, _) { homecoming ng.module('3rd-libraries') .service('underscoreservice', function() { homecoming _; }); });

my questions are:

is utilize .service() define service? or mill or constant better? is utilize underscoreservice, or underscore plenty , better?

i believe question of scope. although disagree, think loading _underscore dependency of every tests suite fine. reason rule of thumb saying "static" operation - - generic algorithm used not application logic or info sensitive, should tested separately (or not @ in case of _underscope frameworks). this makes tests simpler write, more readable , maintainable , putting rare cases aside, these tests fail anyway if _underscore have new bug on sorting array. moreover, can't see benefitting (other mocking, addressed before) di of these algorithm.

however, if algorithm more complex , involves info logic dependency, introduce mill (or service, both singletons) encapsulating logic , making testable itself. far service vs mill (vs provider), there tons of answers out there, liked: this

javascript angularjs

recursion - Recursive function using pthreads in C -



recursion - Recursive function using pthreads in C -

i have next piece of code

#include "stdio.h" #include "stdlib.h" #include <string.h> #define maxbins 8 void swap_long(unsigned long int **x, unsigned long int **y){ unsigned long int *tmp; tmp = x[0]; x[0] = y[0]; y[0] = tmp; } void swap(unsigned int **x, unsigned int **y){ unsigned int *tmp; tmp = x[0]; x[0] = y[0]; y[0] = tmp; } void truncated_radix_sort(unsigned long int *morton_codes, unsigned long int *sorted_morton_codes, unsigned int *permutation_vector, unsigned int *index, int *level_record, int n, int population_threshold, int sft, int lv){ int binsizes[maxbins] = {0}; unsigned int *tmp_ptr; unsigned long int *tmp_code; level_record[0] = lv; // record level of node if(n<=population_threshold || sft < 0) { // base of operations case. node leaf memcpy(permutation_vector, index, n*sizeof(unsigned int)); // re-create pernutation vector memcpy(sorted_morton_codes, morton_codes, n*sizeof(unsigned long int)); // re-create morton codes return; } else{ // find kid each point belongs int j = 0; for(j=0; j<n; j++){ unsigned int ii = (morton_codes[j]>>sft) & 0x07; binsizes[ii]++; } // scan prefix int offset = 0, = 0; for(i=0; i<maxbins; i++){ int ss = binsizes[i]; binsizes[i] = offset; offset += ss; } for(j=0; j<n; j++){ unsigned int ii = (morton_codes[j]>>sft) & 0x07; permutation_vector[binsizes[ii]] = index[j]; sorted_morton_codes[binsizes[ii]] = morton_codes[j]; binsizes[ii]++; } //swap index pointers swap(&index, &permutation_vector); //swap code pointers swap_long(&morton_codes, &sorted_morton_codes); /* phone call function recursively split lower levels */ offset = 0; for(i=0; i<maxbins; i++){ int size = binsizes[i] - offset; truncated_radix_sort(&morton_codes[offset], &sorted_morton_codes[offset], &permutation_vector[offset], &index[offset], &level_record[offset], size, population_threshold, sft-3, lv+1); offset += size; } } }

i tried create block

int j = 0; for(j=0; j<n; j++){ unsigned int ii = (morton_codes[j]>>sft) & 0x07; binsizes[ii]++; }

parallel substituting following

int rc,j; pthread_t *thread = (pthread_t *)malloc(nthreads*sizeof(pthread_t)); belong *belongs = (belong *)malloc(nthreads*sizeof(belong)); pthread_mutex_init(&bin_mtx, null); (j = 0; j < nthreads; j++){ belongs[j].n = nthreads; belongs[j].n = n; belongs[j].tid = j; belongs[j].sft = sft; belongs[j].binsizes = binsizes; belongs[j].mcodes = morton_codes; rc = pthread_create(&thread[j], null, belong_wrapper, (void *)&belongs[j]); } (j = 0; j < nthreads; j++){ rc = pthread_join(thread[j], null); }

and defining these outside recursive function

typedef struct{ int n, n, tid, sft; int *binsizes; unsigned long int *mcodes; }belong; pthread_mutex_t bin_mtx; void * belong_wrapper(void *arg){ int n, n, tid, sft, j; int *binsizes; unsigned int ii; unsigned long int *mcodes; n = ((belong *)arg)->n; n = ((belong *)arg)->n; tid = ((belong *)arg)->tid; sft = ((belong *)arg)->sft; binsizes = ((belong *)arg)->binsizes; mcodes = ((belong *)arg)->mcodes; (j = tid; j<n; j+=n){ ii = (mcodes[j] >> sft) & 0x07; pthread_mutex_lock(&bin_mtx); binsizes[ii]++; pthread_mutex_unlock(&bin_mtx); } }

however takes lot more time serial 1 execute... why happening? should change?

since you're using single mutex guard updates binsizes array, you're still doing updates array sequentially: 1 thread can phone call binsizes[ii]++ @ given time. you're still executing function in sequence incurring overhead of creating , destroying threads.

there several options can think of (there more):

do @chris suggests , create each thread update 1 portion of binsizes. might not viable depending on properties of calculation you're using compute ii.

create multiple mutexes representing different partitions of binsizes. example, if binsizes has 10 elements, create 1 mutex elements 0-4, , elements 5-9, utilize them in thread so:

if (ii < 5) { mtx_index = 0; } else { mtx_index = 1; } pthread_mutex_lock(&bin_mtx[mtx_index]); binsizes[ii]++; pthread_mutex_unlock(&bin_mtx[mtx_index]);

you generalize thought size of binsizes , range: potentially have different mutex each array element. of course of study you're opening overhead of creating each of these mutexes, , possibility of deadlock if tries lock several of them @ 1 time etc...

finally, abandon thought of parallelizing block altogether: other users have mentioned using threads way subject level of diminishing returns. unless binsizes array large, might not see huge benefit parallelization if "do right".

c recursion pthreads

html - putting a text and image side by side with aligning the text to the bottom -



html - putting a text and image side by side with aligning the text to the bottom -

im trying set text , image side side, text have aligned @ bottom nil working, im using twitter-bootstrap , code:

<td width="75%" style='padding-top: 50px' height="100%" > <img src="img/img.png" class="img-responsive " style="display:inline-block;margin-left: 10px;float:right;margin-bottom: 40px" width="60%" alt=""> <span style="vertical-align:bottom;float:right">test</span> </td>

http://jsfiddle.net/zh1o6tuc/

thanks.

edit: im trying accomplish http://postimg.org/image/ss7u8u6mh/

you'll need create few changes html , css:

move span before image in html remove float: right; span in css add display: inline-block; span in css

class="snippet-code-css lang-css prettyprint-override">img { display: inline-block; margin-bottom: 40px margin-left: 10px; } span { display: inline-block; vertical-align: bottom; } class="snippet-code-html lang-html prettyprint-override"><table> <tr> <td width="75%" style='padding-top: 50px' height="100%" > <span>test</span> <img src="data:image/jpeg;base64,/9j/4aaqskzjrgabaqaaaqabaad/2wceaakgbwwmdqwmda0mdawmdawmdawmda8mdacmfbewfhqrfbqyhcgggboljxquitehmskrli4ufx8zodmsnyg5ojcbcgokda0ndwwmdyszfbkrlcsrlcwrlcsrkysrldcskysrkys3lcsrkysrkysrkysrkysrkysrkysrkysrkysrk//aabeiaoea4qmbigaceqedeqh/xaaxaaebaqeaaaaaaaaaaaaaaaaaaqih/8qafhabaqeaaaaaaaaaaaaaaaaaaaer/8qafgebaqeaaaaaaaaaaaaaaaaaaaec/8qafrebaqaaaaaaaaaaaaaaaaaaabh/2gamaweaahedeqa/aoi1abuaaaaabauaaeuaeubaueuarrauaaaaadaalfqaaarqaabfaqaaabuafqabqaaaaaaaafakgackgkgoaicoakiaaaaaaaaacoaacikaabogcgaaaaaiaaaaaaagekaakaaqacikaioaaiqakaaacaaaaaaaaaigaoacgciakoacgaigcaaoacagqkluababaaaaaaaaaafafabbrbrqaruuaaaabkqaacacaaaaaaaaoaioaaaaaokiggalqqfaaruaaqaaabaaaaabqarqaabqvfarqevafabfaefqaaabeafabaaaaaaaaagcqaakaikaaaioccgikgaaaaaciaaaaakoaaoagakacaoaaaaikagqaaaaaaaacaaoaacgaackckaicgaaaaioockgcoaaaaaaaaaaoaaaaaaaaggacgiaacaqkaaagoccgiqacoaaaoaioaaaaaogcoooikggaaaioackaaaaccgaiaoaaqchqfqvqabfaabbkqakkakfazwacaaaalaakodiacgbvaeufaah/9k=" class="img-responsive " width="60%" alt=""> </td> </tr> </table>

html css twitter-bootstrap

c# - Adding a bool for each property -



c# - Adding a bool for each property -

i'm building c# class works 2 different info sources. load info source , take configuration set function. want several tasks on properties within object.

for example.

public string streetaddress { { homecoming _streetaddress; } set { if (value.length <= 64) _streetaddress = value; else _streetaddress = value.substring(0, 1024).trim(); } } public string city { { homecoming _city; } set { if (value.length <= 128) _city = value; else _city = value.substring(0, 128).trim(); } } public string state { { homecoming _state; } set { if (value.length <= 128) _state = value; else _state = value.substring(0, 128).trim(); } }

so holds info 1 side. hoping able store , set alter flag on each property. if take state example. if person moved texas illinois want set bool within property note alter able loop on changes before saving object db. don't see way assign state variable within property. best way write object on top of command or there more creative way store multiple strings within 1 property?

if you'd oop way of doing thing, can:

define interface , class holding property, such as:

interface ipropertyslot { bool isdirty { get; } void resetisdirty(); object untypedvalue { get; } } class propertyslot<t>:ipropertyslot { public t value { get; private set; } public bool setvalue(t value) { if (!equals(_value, value)) { value = value; isdirty = true; homecoming true; } homecoming false; } public bool isdirty { get; private set; } public void resetisdirty() { isdirty = false; } public object untypedvalue { { homecoming value; } } }

store properties within class in dictionary string (for name of property) ipropertyslot , get/set them through pair of methods:

void setproperty<t>(string name, t value) { ipropertyslot property; if (!_properties.trygetvalue(name, out property)) { property = new propertyslot<t>(); _properties[name] = property; } ((propertyslot<t>)property) .setvalue(value); } t getproperty<t>(string name) { ipropertyslot property; if (!_properties.trygetvalue(name, out property)) { property = new propertyslot<t>(); _properties[name] = property; } homecoming ((propertyslot<t>)property).value; }

finding changed properties later matter of going on _properties.values , finding of them isdirty.

this approach gives way add together more functionality properties in oo manner (such raising propertychanged/propertychanging events, mapping db fields, etc.).

c# .net properties

playframework - Keeping a Play framework app running in a Docker container without a pseudo-TTY -



playframework - Keeping a Play framework app running in a Docker container without a pseudo-TTY -

i have development setup need multiple containers running different services, , i'm trying utilize fig accomplish this. else works fine, 1 of these services play framework app, , not want remain running unless gets pseudo-tty. fine , good, since want coordinate these multiple containers, want fig up, , command not seem allocate pseudo-tty's, process dies after startup, , containers along it.

i've created a repository showcase of problem can clone , run, instructions in readme. if can shed lite on how create e.g. middleman script maintain app running, or other solution fig up linked container setup, that'd brilliant.

alternatively, if using other methods of coordinating multiple containers this, maybe nice shell script runner manages things, welcome insight.

edit: changed accepted reply because new 1 solves problem. workaround reply still has valuable info, though.

fig has been replaced docker compose, , in docker-compose.yml file can add together stdin_open: true setting, should prepare issue:

web: image: brikis98/ping-play ports: - "9000:9000" stdin_open: true

in illustration above, brikis98/ping-play image play app executes activator run default. if run docker-compose up on yaml file above, play app boots , keeps running instead of exiting immediately.

playframework docker fig

php - Optimistic lock in Doctrine2 doesn't work for many to many relation -



php - Optimistic lock in Doctrine2 doesn't work for many to many relation -

i have entity user has many many relation roles. i've tried implement optimistic lock, works fine, when changed roles, doesn't alter version (user entity version), proper behaviour?

class user { /** * user's roles. * * @orm\manytomany(targetentity="role") */ private $roles; ...

doctrine 2's locking mechanisms don't take associations account. protect against changes entities themselves. imho expected, because has no way know associations include , ignore. isn't you'd want happen blindly on associations.

theoretically doctrine 2 accomplish adding alternative association mappings, @ moment isn't supported.

so have 2 options:

try implement such feature, , submit pr :) implement own optimistic locking mechanism take specific association account.

php concurrency doctrine2 optimistic-locking optimistic-concurrency

ios - Recorded Audio file doesn't Move? -



ios - Recorded Audio file doesn't Move? -

i have recorded voice file store in temp directory .m4a format want move directory in document directory.

but can not move got error. "the operation couldn’t completed. (cocoa error 4.)" userinfo=0x7b660190 {nssourcefilepatherrorkey=file:///users/vinodjadhav/library/developer/coresimulator/devices/067a2eac-9987-4861-8746-97117dce72f2/data/containers/data/application/5744f8bc-4256-4010-8a14-60b228859f88/tmp/14-11-201410:32:45.m4a, nsuserstringvariant=( move ), nsfilepath=file:///users/vinodjadhav/library/developer/coresimulator/devices/067a2eac-9987-4861-8746-97117dce72f2/data/containers/data/application/5744f8bc-4256-4010-8a14-60b228859f88/tmp/14-11-201410:32:45.m4a, nsdestinationfilepath=/users/vinodjadhav/library/developer/coresimulator/devices/067a2eac-9987-4861-8746-97117dce72f2/data/containers/data/application/5744f8bc-4256-4010-8a14-60b228859f88/documents/xpensetag/xpenses/sagar/823564440/audio/audio.m4a, nsunderlyingerror=0x7b660250 "the operation couldn’t completed. no such file or directory"}

this dest url

dest url = /users/vinodjadhav/library/developer/coresimulator/devices/067a2eac-9987-4861-8746-97117dce72f2/data/containers/data/application/5744f8bc-4256-4010-8a14-60b228859f88/documents/xpensetag/xpenses/sagar/823564440/audio/audio.m4a

this source file url

source url = file:///users/vinodjadhav/library/developer/coresimulator/devices/067a2eac-9987-4861-8746-97117dce72f2/data/containers/data/application/5744f8bc-4256-4010-8a14-60b228859f88/tmp/14-11-201410:32:45.m4a

-(void)moveaudiofilefromesource:(nsstring *)sourceurl todest:(nsstring *)desturl { nslog(@"source url = %@", sourceurl); nserror *error; if (![[nsfilemanager defaultmanager] moveitematpath:sourceurl topath:desturl error:&error]) { nslog(@"could not remove old files. error:%@",error); } }

where wrong?

you can re-create file source path destination path . seek this

-(void)moveaudiofilefromesource:(nsstring *)sourceurl todest:(nsstring *)desturl { nslog(@"source url = %@", sourceurl); nserror *error; if (![[nsfilemanager defaultmanager] copyitematpath:sourceurl topath:desturl error:&error]) { nslog(@"could not remove old files. error:%@",error); } }

ios

How to pass a value from JavaScript in php? -



How to pass a value from JavaScript in php? -

translate translator google. did not swear if not clear. russia.

the question arose. how pass value of alert in javascript in variable $ value in php, , write in case file. , question: how hide alert? or utilize instead visually not visible, value passed?

//a lot of code { console.log(data); alert(data['value']); } });

so. there php script writes logs (current page , previous one) file. according principle here:

//a lot of code $home = $_server['http_host'] . $_server['request_uri']; $referer = $_server['http_referer']; $value = how value of java script convey here?; $lines = file($file); while(count($lines) > $sum) array_shift($lines); $lines[] = $home."|".$referer."|".$value."|\r\n"; file_put_contents($file, $lines);

it necessary value of js transferred php-script , write file. how it? prompt please. novice in of this.

php scripts run before javascript, means can pass php variables javascript, not other way around. however, can create ajax post request javascript php script, , grab post info in php through global $_post variable.

assuming utilize jquery, javascript like:

// assign info object: var info = { value: "test" }; // send php script via ajax post request: $.ajax({ type: "post", url: "http://your-site-url/script.php", data: info });

and php script like:

// if value received, assign it: if(isset($_post['value'])) $value = $_post['value']; else // else;

javascript php jquery json

python - List of ints to string -



python - List of ints to string -

i have list of ints:

(83, 105, 101, 109, 101, 110, 115)

which believe codes siemens.

how can convert list string in pythonic way?

i know can individual chars chr(x) , concatenate them doesn't seem best way.

using bytes (or str) , bytearray:

>>> bytes(bytearray((83, 105, 101, 109, 101, 110, 115))) 'siemens'

in python 3.x:

>>> bytes((83, 105, 101, 109, 101, 110, 115)).decode() 'siemens'

python string char int

silverlight - Check if file exists in folder in c# -



silverlight - Check if file exists in folder in c# -

i moving files source folder destination folder. before moving files, checking directory exists or not working fine. issue sec check want create sure folder not empty before moving files not giving me right result.

public void movefilesfromtemptosourcetbl() { //moving files temp folder orig folder. string sourcefolder = (twitterdo.path + "\\" + msgdate.year.tostring() + "\\" + msgdate.month.tostring() + "\\" + msgdate.day.tostring() + "_temp").replace("\\", @"\"); string destinationfolder = (twitterdo.path + "\\" + msgdate.year.tostring() + "\\" + msgdate.month.tostring() + "\\" + msgdate.day.tostring()).replace("\\", @"\"); string pattern = "*.txt"; if (directory.exists(sourcefolder)) { if (file.exists(pattern)) { foreach (var file in new directoryinfo(sourcefolder).getfiles(pattern)) { file.moveto(path.combine(destinationfolder, file.name)); } } if (directory.getfiles(sourcefolder).length == 0) //before deleting create sure temp folder empty. directory.delete(sourcefolder, true); // delete temp folder after moving contents. } }

i know making little error not sure is. next screenshot of result got in immediate window.

http://imgur.com/fzvo9cj

there's bit of redundancy in current code. starting if-checks, here's how approach this:

var sourcedirectory = new directoryinfo(sourcefolder); // remember this, reused if (sourcedirectory.exists) { // files in directory, if none found, empty array foreach (var file in sourcedirectory.getfiles(pattern)) { file.moveto(path.combine(destinationfolder, file.name)); } // re-check directory remaining files if (sourcedirectory.getfiles(pattern).length == 0) //before deleting create sure temp folder empty. sourcedirectory.delete(); // delete temp folder after moving contents. }

as little performance improvement, replace sourcedirectory.getfiles() sourcedirectory.enumeratefiles() in for-loop. allow start moving them method finds them, not after have been found.

c# silverlight

Nginx how to return 404 when access index.php directly -



Nginx how to return 404 when access index.php directly -

for security purpose, attempting hide fingerprint info of web application. of import thing hide php visitors. seek modify nginx's configuration file. configuration show follows.

location / { root /data/site/public; index index.html index.htm index.php; try_files $uri /index.php; location /index.php { fastcgi_pass unix:/var/run/php5-fpm.sock; include fastcgi.conf; } }

by way, hide index.php url. however, hackers straight access website using url such http://example.com/index.php, shows website written php. maybe dangerous. so, modify nginx's config sec time, longing 404 when access index.php directly, , looks like

location / { root /data/site/public; if ( $request_uri ~ /index\.php ) { homecoming 404; } index index.html index.htm index.php; try_files $uri /index.php; location /index.php { fastcgi_pass unix:/var/run/php5-fpm.sock; include fastcgi.conf; } }

however..., seems nginx acts nil different previous one.

could tell me reason ? or other solutions...

php nginx

mysql - php code to select max value and display count of max value in table -



mysql - php code to select max value and display count of max value in table -

table name voter fields name - partyname,state,direction,candidatename,district,votes date in table wise

bjp maharashtra nagpur-east nitin gadkari nagpur 3000 congress maharashtra nagpur-east lucky nagpur 2500 bjp maharashtra nagpur-south rakesh nagpur 12000 congress maharashtra nagpur-south shyam nagpur 15000

i selecting max votes table on status of state,direction , district wise. , display vote below.

now want inquire how above query result , display count of how much max value in table on each direction. plz suggest me...... need display count of max value direcion wise.

for ex--- direction votes party east 5000 bjp east 8000 aap there 1 max value in east direction display count 1.. plz tell me....

<table class="bordered"> <tr> <?php $sqlst = "select distinct state voter_count"; $resultst = mysql_query($sqlst); while($rowst = mysql_fetch_array($resultst,mysql_assoc)) { ?> <td> <table class="bordered"> <thead> <tr> <th colspan="3"><?php echo $rowst['state']; ?></th> </tr> <?php $state = $rowst["state"]; $sqlco = "select distinct district,direction voter_count state = '$state'"; $resultco = mysql_query($sqlco); while($rowco = mysql_fetch_array($resultco,mysql_assoc)) { ?> <tr> <?php $district = $rowco['district']; $direction = $rowco['direction']; $sqlvotes = "select max(votes) vote,direction voter_count state = '$state' , district = '$district' , direction = '$constituency'"; $resultvotes = mysql_query($sqlvotes); while($rowvotes = mysql_fetch_array($resultvotes,mysql_assoc)) { ?> <th><?php echo $rowvotes['vote']; ?></th> <th><?php echo $rowvotes['direction']; ?></th> </tr> <?php } } ?> </thead> </table> </td> <?php } ?> </tr> </table>

not 100% sure final table needs like, start (you don't need first query, can want 1 query):

select max(votes) vote,direction, state, district voter_count grouping direction, state, district

as 1 of comments mentioned refer link how utilize grouping by: http://www.w3schools.com/sql/sql_groupby.asp

php mysql