Posts

Showing posts from March, 2013

java - LibGDX autoscale text in Label -

in libgdx project have label displays number wich bigger. when number gets big, bigger label. how can size of text gets smaller when text bigger label, isn't big more? i never tried it, if label documentation , there setfontscale method . did try ? the width of label given yourlabel.getprefwidth() , width of text inside label given yourlabel.getglyphlayout.width . compare both, , scale down font if width of text bigger thant width of label. i guess use in render() : if(yourlabel.getglyphlayout.width > yourlabel.getprefwidth()){ yourlabel.setfontscale(yourlabel.getprefwidth()/yourlabel.getglyphlayout.width); }

iOS Phonegap Upload and Download error (cordova js version: 3.8.0) -

i working on project need 2 things: download media files upload picture taken camera in android both works awesome either jelly beans, kitkat or lollipop. in ios both didn't worked. download media files: in android had used download option of file-transfer plugin... , in path had given: var fileurl = '/sdcard/'+dynamic_file_name; so after download completes can view downloaded file going sdcard in android. but in ios tried lot like: var fileurl = cordova.file.documentsdirectory+dynamic_file_name; var fileurl = filesystem.root.tourl() + "/"+dynamic_file_name; var fileurl = cordova.file.datadirectory+dynamic_file_name; var fileurl = cordova.file.synceddatadirectory+dynamic_file_name; while using above download complete message when go videos or audio files in device don't see file downloaded (fyi, when try code in simulator, going path downloaded in app, can see file downloaded in device ios don't have such device manager see downlo

SQL Server 2008 R2: Get table_name from view from other database -

i have 2 database namely db1 , db2 . presently working on database db1 . have view stored in database db2 name view_1 . want table names present on view database db1 . my try: i using database db1 . try 1 : select table_name information_schema.view_table_usage view_name = 'db2..view_1'; try 2 : select table_name information_schema.view_table_usage view_name = db2..'view_1'; but not getting table_name's other database view. like this select table_name db2.information_schema.view_table_usage view_name = 'view_1';

java - Decipher this regex -

i came project working on several months ago, , 1 problem figured out when need extract part of string. string used both paranthesis , quotationmarks, couldn't split normal text. example of how string might look: word_object("id"): preword:subword now wanted grab what's after ("id"):, 'preword:subword' i found regex helped me out, , took quite time find example applicable wanted. had settle example, because tried find sources on how learn incredibly complex system failed hard @ that. regex solved looks this: "word_object(\\(\"" + "id" + "\")\\): " i content seemed work, when got project , tried it, trying extract word used underscore _ and underscore following word(s) left out. example, splitting text word_object("id"): preword:subword_underscoreword using regex (using complete line now) idsplit = subtemp.split("word_object(\\(\"" + "id" + "\&quo

hierarchy information while using grouped category plugin in highchart -

Image
while using grouped category plugin, $('.highcharts-axis-labels text, .highcharts-axis-labels span').click(function () { console.log(this.textcontent || this.innertext); }); the above code snippet give info clicked xaxis label, there way ascertain parent of same? i parent "forecast" when click "footwear" in above chart you can use custom-events extenstion , add click event on xaxis labels. name of parent can extracted textstr value. labels: { events: { click: function () { alert(this.parent.label.textstr); } } }, example: http://jsfiddle.net/taq9v/9/

angularjs - how to import different methods from different files to another javascript file for page objects E2E testing using protractor -

how import different methods different files javascript file page objects e2e testing using protractor. dividing page-objects per each individual page , writing possible actions on page methods. so, how import methods multiple pages(files) test file. you use require import page objects specs: var mypage = require("./po/mypage.po.js"); see examples at: using page objects overcome protractor's shortcomings using page objects organize tests

Groovy ifs - how to do it better (rewritting code from Java to Groovy) -

let's assume have such code in java: if(a) { return x } if(b) { return y } return z how rewrite in groovy? we can't write because isn't working. can write this: if(a) { return x } else { if(b) return y else return z } but isn't quite elegant. ideas? it can done ternary operator: def x = 1 def y = 2 def z = 3 def = null def b = 1 assert 2 == ? x : b ? y : z = 1 b = null assert 1 == ? x : b ? y : z = null b = null assert 3 == ? x : b ? y : z

sql server - Adding a lowercase constraint to a column in sql -

i've searched web found how update columns lowercase. there way put constraint in column accepts lowercase , gets error when try insert in uppercase. the table following: create table student ( id int, name varchar(50), email varchar(50) ); you can use check constraint binary_checksum function this: alter table student add check (binary_checksum(email) = binary_checksum(lower(email))); you can use multiple conditions in check , check email-address contains @ character , on, although processing demand increase: check (binary_checksum(email) = binary_checksum(lower(email)) , charindex('@', email) > 0); it better check input in client side application insert it, or use trigger or stored procedure handle inserts , force data lower case. to quote sql server manual : checksum , binary_checksum return different values string data types, locale can cause strings different representation compare equal. string data types char, varchar

javascript - Centered image on video tag -

allright project need have centered image (a play button) rendered @ runtime on top off video depending on useragent. if useragent isn't firefox want display image since firefox has it's own playevent , button on top of video @ start. previous attempts have failed. i tried: tag in video tag , put z-index 10 while putting video z-index 1 putting div background image around video tag are there other ways this, , please don't reply use poster since allready have poster need use. -edit- code: <tr> <td runat="server" width="680px" height="383px" id="vcontainer"> <video id="player" style="z-index: 1" width="100%" height="100%" title="" controls runat="server"> <source runat="server" id="ffvideo" type="video/ogg" /> <source runat="server" id="mp4video"

xcode - iOS 9 : SecItemCopyMatching returns successful status code but key is nil -

i trying import private key keychain using secitemadd method returns osstatus 0 when try retrieve key key chain using secitemcopymatch , returns nil data osstatus 0 means success please refer apple developer forum link the bug occurs due malformed public key refer https://forums.developer.apple.com/thread/15129 if use basic encoding rules library here's solution. to fix public key need insert nil byte before modulus data. https://github.com/stcredzero/scz-basicencodingrules-ios/issues/6#issuecomment-136601437 p.s. me fix simple as: const char fixbyte = 0; nsmutabledata * fixedmodule = [nsmutabledata datawithbytes:&fixbyte length:1]; [fixedmodule appenddata:modulusdata];

xslt 2.0 - XSLT2.0 | Saxon HE | passing separator as param -

having function below: <xsl:function name="fn:get-hierachy"> <xsl:param name="hierarchy" required="yes" as="node()"/> <xsl:param name="separator0" required="no" as="xs:string"/> <xsl:value-of select="$hierarchy/*" separator="$separator0"/> </xsl:function> i'm getting 'separator0' delimiter output eg. <xsl:value-of select="fn:get-hierarchy($place, ' > ')"/> result in: earth$separator0africa$separator0egypt i'm passing custom delimiter second function argument = ' > ' it's being ignored , variable name used instead. desired output: earth > africa > egypt is possible pass separator argument value parameter? for separator attribute, need use attribute value template <xsl:value-of select="$hierarchy/*" separator="{$separator0}"/> .

c++ - Finding Earth Coordinates (latitude,longitude), Distance (meters) and Bearing (angle) -

i need deal earth coordinates in various ways. there no function in c/c++ straight away. referred below questions: python: lat/long given current point, distance , bearing c: given point of (latitude,longitude), distance , bearing, how new latitude , longitude from 1st 1 , movable type scripts website , found below formulas: find bearing(angle) between 2 coordinates x = cos(lat1rad)*sin(lat2rad) - sin(lat1rad)*cos(lat2rad)*cos(lon2rad-lon1rad); y = sin(lon2rad-lon1rad) * cos(lat2rad); bearing = atan2(y, x); // in radians; // convert degrees , -ve add 360 find distance(meters) between 2 coordinates pi = 3.14159265358979323846, earthdiametermeters = 2*6371*1000; x = sin((lat2rad-lat1rad) / 2); y = sin((lon2rad-lon1rad) / 2); meters = earthdiametermeters * asin(sqrt(x*x + y*y*cos(lat1rad)*cos(lat2rad))); find coordinate coordinate+distance+angle meters *= 2 / earthdiametermeters; lat2rad = asin(sin(lat1rad)*cos(meters) + cos(lat1rad)*sin(meters)*cos(bearing)); l

java - JSF Environment Setup -

Image
i reading tutorials point on how setup environment jsf. the maven works. the apache works. i followed steps , configured environment variables required. next step, open command prompt , typed following command. and receives these errors. i suppose following tutorial @ http://www.tutorialspoint.com/jsf/jsf_first_application.htm . shows maven command: c:\jsf>mvn archetype:create -dgroupid=com.tutorialspoint.test -dartifactid=helloworld -darchetypeartifactid=maven-archetype-webapp it confusing. have write in 1 line: c:\jsf>mvn archetype:create -dgroupid=com.tutorialspoint.test -dartifactid=helloworld -darchetypeartifactid=maven-archetype-webapp or use caret( ^ ) symbol: c:\jsf>mvn archetype:create ^ -dgroupid=com.tutorialspoint.test ^ -dartifactid=helloworld ^ -darchetypeartifactid=maven-archetype-webapp

telecommunication - Data roaming indicator AVP in the diameter request -

please 1 tell me how identify roaming/non-roaming subscribers diameter ccr initial request. for gx reference point, have 2 ways: using mcc mnc avp name: <3gpp-sgsn-mcc-mnc> avp code: <18> anything not home (or national roaming mnc), international roaming using sgsn ip adress avp name <3gpp-sgsn-address> avp code: <6> if don't recognize ip adress of home sgsn roaming. i have tested both on e/// equipment.

arrays - How to Format JavaScript String based on value -

i have string variable object value in format: [" traffic landing hits: 0, rewards hits: 0 engagement facebook posts: 0, twitter tweets: 0, twitter autofollows: 0, instagram photos: 0, instagram likes: 0, instagram votes: 0, pinterest pins: 0, form submissions: 0 conversion submissions: 0, engagement: 0, views: 0, prints: 0 "] i want convert into: ["traffic", "landing hits: 0", "rewards hits: 0"], ["engagement", "facebook likes: 0", "facebook posts: 0", "facebook share: 0", "form submissions: 0", "instagram likes: 0", "instagram photos: 0", "instagram votes: 0", "pinterest pins: 0", "twitter autofollows: 0", "twitter tweets: 0"], ["conversion", "conversion rate: 0", "offers emailed: 0", "prints: 0", "submissions: 0"

android - Why height of RelativeLayout change when I add a view to RelativeLayout. -

i'm drawing lines in relative layout.to this, add line views add relative layout. when add drawed lines relative layouts relative layout's height changes. why ? in advance ! :) layout.xml <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="fill_parent" tools:context="com.mobisoft.kelimebul.local.oyun" android:backgroundtint="#ffffcd8d" android:backgroundtintmode="multiply" android:background="#ffff9f63" android:padding="7dp" android:id="@+id/s" android:orientation="vertical"> <relativelayout android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/relative" android:touchscreenblocksfocus="tr

visual studio - Object browser not working for c++ in VS 2015 community -

Image
for reason can't object browser pick function/class documentation in visual studio 2015 community. i have tried described here xml documentation (visual c++) . the functions appear in object browser, none of documentation. example, /// <summary>executes tsql-statement on current db connection.</summary> /// <param name="query">the tsql-statement execute.</param> void executesqlstmt(const std::string& query); this shows in object browser as am missing configuration? have set generate documentation setting "no", because not interested in generating .xml files, view function documentation in ide intellisense help. thank you.

push notification - How to open Appmanifest.xml file in windows phone 8.1 runtime app(not silverlight)? -

i doing push notifications in windows phone 8.1. trying 10 days, not getting anything.i googled failed. 1 me out. https://social.msdn.microsoft.com/forums/en-us/b9cd3081-3d89-42e5-b7f6-3de70d991502/device-not-receiving-c-windows-push-notifications-because-channel-url-incompatible?forum=winappswithcsharp in link set app's identity values manually open app's appmanifest.xml file in text editor , set these attributes of element using values shown here. have information. said need put code in manifest file. in project enivironment manifest file not xml file. (it entering values in text fields) how can add lines in manifest file. please 1 me. please save me. just right click on package.appxmanifest file , click view code. see xml file can manually edited.

python - Make Matplotlib map plots line up with each other -

Image
i'm trying produce figure in python display (among other things): a) basemap transformed mercator projection image b) labelled gridlines i figure in transverse mercator (or other spherical) projection. i have tried both matplotlib basemap , cartopy. cartopy can (a), , basemap can (b), cartopy can label gridlines on platecarree plots, , basemap not support transformation of images using imshow() . unless can suggest alternative, think simplest way around overlay gridlines , labels basemap plot on reprojected image. cannot 2 plots line each other. have far: import numpy np import matplotlib.pyplot plt mpl_toolkits.basemap import basemap import cartopy.crs ccrs #setup figure fig = plt.figure(figsize=(20, 20)) #set figure limits (lat long) xlimits = [25, 42] ylimits = [25, 40] #where projection centred centre = [33, 33] #image limits in mercator eastings , northings imxlimits = [25, 42] imylimits = [25, 40] #transform image limits imextent = tuple(ccrs.mercator().tra

java - Object, reference and class. Need help understanding some code -

i kind of understand that: a class kind of blueprint objects can created from. a object actual instance or object gets created. a reference address points said object. what happens when below code called twice? car batmobile = new car(); will 2 objects created? if so, happens first object? in detail, happens in terms of class, object , reference? part 2: is infinite loop? objects keep getting created since constructor makes object , calls on constructor again? how class, object, reference relation work here? public class alphabet { alphabet abc; public alphabet() { abc = new alphabet(); } } car batmobile = new car(); 2 objects created? if it's called twice yes. because line creates new instance of object. doing twice result in 2 new instances. note, however, if try execute same exact line twice in row compiler error because you'd trying re-declare same variable in same scope. but otherwise, no, there's 1 object being c

javascript - calculate and display difference between 2 dates before submitting form -

i find find way calculate difference between 2 dates, , display result before submit form. similar check in - check out drop downs in yellow/ orange box in http://www.booking.com/ on selecting dates number of nights displayed. html version of code displayed in js fiddle: http://jsfiddle.net/chri_chri/xy2gpa02/2/ code used generate drop down date selectors <?php // displays days leading 0s $options = array(); ($i=1; $i<32; $i++) { $theday = date('d', mktime(0,0,0,0,$i,2000)); $sel = ($i == date('d') ? 'selected="selected"' : ''); $options[] = "<option value= \"{$theday}\" {$sel}>{$theday} </option>"; } $options_list = join("\r\n", $options); echo "<div class='select' id='date'><select class=\"short-input\" name=\"day_from\">{$options_list}</select></div>"; ?> <?php $opti

Chef PowerShell Logging/Write-Host -

is there way log console chef when using powershell_script block. an oversimplified example: powershell_script "something cool" ignore_failure true code <<-eoh write-host "hello world" eoh end you want mixin powershell_out, reads output powershell in same way shell_out reads other shells. according chef changelog of client 12.4.0 powershell_out lives in core chef https://github.com/chef/chef/blob/master/changelog.md edit: got work in environment. bare in mind, i'm locked omnibus version 12.3.0 experience may differ. in order expose powershell_out need couple things. metadata.rb ... depends 'windows' <recipe using powershell_out>.rb ... ::chef::recipe.send(:include, chef::mixin::powershellout) #example usage should_exist = powershell_out('$true').stdout #=> ['true'] not full tutorial many bothans died bring information , hope it's useful jumping off point. oh, , doing method throws war

html - Javascript - checking if frame is empty -

i tried check if frame "content1" , "content3" empty or not , resizing them. but size changes every loop window.setinterval(function () { check(); }, 50); function check() { var content1 = document.getelementsbyname("content")[0].contentdocument.body; var content3 = document.getelementsbyname("content3")[0].contentdocument.body; if (isempty(content3)) { if (isempty(content1)) setproperties("0px, *, 0px"); else setproperties("35%, *, 0px"); } else setproperties("25%, 40%, 35%"); window.localstorage.clear(); } function isempty(e) { return (e.offsetwidth != 0); } function setproperties(value) { document.getelementsbytagname("frameset")[1].cols = value; } https://jsfiddle.net/ecytve7w/8/ well, error means says: e null , e.offsetwidth throw exception. check e also: return !!(e && (e.offsetwidth != 0 || e.innerhtml != "\n"

Javascript best practice to handle string array base 1 -

i need print string of array, receive integer back-end, can 1, 2, 3 or 4. which best way print correct string array? i've thought 2 possible solutions. var risklevelmap = [ "", "low", "mediumlow", "medium", "high" ]; console.log(risklevelmap[ integervalue ]); or var risklevelmap = [ "low", "mediumlow", "medium", "high" ]; console.log(risklevelmap[ integervalue-1 ]); for sake of clarity, go second option. as awkward may seem, additional empty string can troublesome. [ "", "low", "mediumlow", "medium", "high" ]; technically takes (marginally) more space. so, memory optimization standpoint, technically less desirable. isn't convention have used elements start @ 1. confuse when writing code down rode. granted, [ "low", "mediumlow", "medium", "high" ]; has disadvantages. additi

c# - Issues with viewing Oracle tables on local host and IIS -

i receiving 2 errors, depend on references using, think both relatively similar issues. the first error reference: using system.data.oracleclient; which causes error of: attempt load oracle client libraries threw badimageformatexception. problem occur when running in 64 bit mode 32 bit oracle client components installed. i understand reference depreciated, used oracle reference: using oracle.dataaccess.client; but give me error of: the type initializer 'oracle.dataaccess.client.oracleconnection' threw exception both of these references work oracle stored procedure on local host, throw these errors when run page in iis. on server have oracle 64-bit client installed, on actual computer have 32-bit client installed. my major question is: why oracle database connect server on local host, , execute stored procedure though have 32-bit client installed on machine , 64-bit client on server? i have enabled 32-bit applications on application pool in iis, , did

python - how can I check database connection to mysql in django -

how can it? i thought, can read database, looks much, there like?: settings.databases['default'].check_connection() all need start application , if not connected fail. other way can try on shell try following - from django.db import connections django.db.utils import operationalerror db_conn = connections['default'] try: c = db_conn.cursor() except operationalerror: connected = false else: connected = true

Show All Records For Given Field Filter In Access 2010 Table -

hopefully make sense...i have table in access 2010 contains list of suppliers , point of contacts @ supplier , work. pocs vary in number, anywhere 1-4 point. table set each poc on separate line. the supplier have 1 contact work have 3 different contacts , vice versa. what want happen when select value combobox on form, related pocs need shown instead of cycling through them 1 one. for example, supplier1 has 2 pocs @ facility , have 3 @ our facility. have combobox find supplier1 in table , show contacts supplier (their facility , ours) in textbox. the user able edit contact information and, if not difficult, able add/delete contact. i'm sure question similar 1 has been asked before, have been unable word correctly find solution through google searches/this website. i'm comfortable enough vba use if required no means expert. unfamiliar sql , avoid going direction if @ possible. i have careful data provide can if need see data or that. supplier code part

c# - replace variable name in formula with Regex.Replace -

in c#, want use regular expression replace each variable @a number withouth replacing other similar variables @ab string input = "3*@a+3*@ab/@a"; string value = "5"; string pattern = "@a"; //<- doesn't work string result = regex.replace(input, pattern, value); // espected result = "3*5+3*@ab/5" any idea? use word boundary \b : string pattern = @"@a\b"; see regex demo ( context tab) note @ before string literal: using verbatim string literal declare regex pattern not have escape \ . otherwise, string pattern = "@a\\b"; .

sql server - t-sql select all values based on top 5 query -

i've been hunting through documentation , examples , playing try , make work having no luck i'm hoping might point me in right direction. i have top 5 items table called maintenance via query based month, giving me top 5 nodes highest calls month. ex. top 5 select select top 5 maint.node_id ,maint.sc_tot server.dbo.maintenance maint maint.province_name='provname , maint.system_code='syscode' , maint.city_name='cityname' , ( year(maint.startdate)=2015 , month(maint.startdate)=07 ) group maint.node_id ,maint.sc_tot order sum(isnull(maint.je_tot,0)+isnull(maint.sc_tot,0)+isnull(maint.tt_tot,0)) desc output is node_id sc_tot node1 30 node2 28 node3 27 node4 23 node5 23 what need select sum of calls month each of nodes without time frame. giving me history , trend each node, same maintenance table. ex. quick summary(not exact details) node startdate sc_tot node1 jan 10 node1 feb 1

ios9 - iPhone unavailable when trying to run watch app from Xcode 7 beta -

i'm running watch os 2 (beta 2) , ios 9 (beta 3) , can't run watch app because xcode tells me iphone unavailable. i'm guessing might problem watch os 2, if not has got ideas how fix problem? i'm running app xcode 7. deploys fine when running iphone section on it's own not when want run watch app. thanks why don't upgrade ios/watchos/xcode versions beta 5? think it's first step have do.

function - VB.net choose multiple random items from arraylist only once -

so i'm trying make function can input arraylist , function randomly picks x amount of items arraylist , outputs result new arraylist. i've got working, problem i'm having after 1 of items picked randomize, it's still there means can picked again. here code got far dim randomgeneratormulti new arraylist() dim resultmulti new arraylist() randomgeneratormulti.add("happy") randomgeneratormulti.add("sad") randomgeneratormulti.add("smart") randomgeneratormulti.add("intelegt") randomgeneratormulti.add("stupid") randomgeneratormulti.add("ugly") choosemulti("5", randomgeneratormulti) traitslistbox.items.addrange(resultmulti.toarray) here function function choosemulti(byval numbers integer, byval alist arraylist) arraylist dim rnd = new random() integer = 1 numbers resultmulti.add(alist.item(rnd.next

loops - Print text multiple times in Brainfuck -

i tried out hello world program in brainfuck. how can print text multiple number of times? here's code: +++++++[>++++++++++ <- ] >++.>++++++[>++++++++++ <- ] >+++++++++.>+++++++[>++++++++++ <- ] >++++++..>+++++++[>++++++++++ <- ] >+++++++++.>+++[>++++++++++ <-]>++. >++++++++[>++++++++++<-]>+++++++.>+++++++[>++++++++++<-] >+++++++++.>++++++++[>++++++++++ <-]>++.>+++++++[>++++++++++ <- ] >++++++.>++++++[>++++++++++ <-]>++++++++.>+++[>++++++++++<-]>++.>+++[>++++++++++<-]>+++.>+++[>++++++++++<-]>+++. let's think of 5 character long word "hello". so if want print 5 characters 3 times have code this: ,>,>,>,>,>+++[<<<<<.>.>.>.>.>-] let me explain code: the first part of code input part: ,>,>,>,>, then initialize variable containing informati

c - Dealing with structure double pointers in swig -

i have function in c takes in double pointer typedef struct argument. example void func (my_struct ** example){...}; when using swig generate corresponding code in java, generating swigtype_p_p_my_struct class. wanted know how access elements of struct using class, , instantiate object of class. also, need include in interface file. currently using below line @ end of interface file - %pointer_functions(my_struct, my_struct_p);

sql - Access query returns no results when criterion added -

i running following query in access 2010 select [table1].[field4], table2.id, table2.["fielld1"], table2.["field3"], table2.["field2"] table2 inner join [table1] on table2.id = [table1].[field4] table2.["field3"]="xx" it runs without clause, returns no results when clause added. know records exist. ideas?

javascript - jquery Pageinit called multiple times -

i new jquery development. creating single page application. calling pageinit method when navigate 1 page page. when navigate , between 2 screens see page init called multiple times. $(document).on("pageinit", '#docpage', function(event) { home.doc.init(); }); and while navigating calling unbind event also. $('#backbutton').on('tap', function(event) { event.preventdefault(); $.mobile.changepage("homepage.html", { transition: "fade", reverse: false, changehash: false }); teardown(); }); }; teardown(){ home.doc.unbindevents(); } can 1 guide me best practice of navigating in single page application. in advance. this due pag

javascript - html input file - how to save selected file when selecting new file? -

Image
i'm trying create upload panel facebook, i've got trouble <input type="file" /> . here facebook upload image panel: my trouble is: if click add more (like image above), means <input type="file" /> clicked again. so, value overridden. after that, if click submit button, 1 image can uploaded. my jquery code upload looks this: function upload(evt, id) { var file = document.getelementbyid("file"); var formdata = new formdata(); (i = 0; < file.files.length; i++) { formdata.append(file.files[i].name, file.files[i]); } formdata.append("id", id); $.ajax({ url: "/home/upload", type: "post", datatype: "json", data: formdata, contenttype: false, processdata: false, success: function (data) { alert('upload successful...'); }, error: function () { alert(

php - NodeJS Get Two Rows With Different Data -

im using nodejs , need mysql rows different data counted (only numbers row): numbers name 12345 | hello 12345 | hello 54151 | okay i need these lines: 12345 | hello , 54151 | okay should get: 2, because 2 different lines. what function this? im using: mysqlconnection.query('select count(distinct numbers) users distinctcount', function (err, row, fields) { if (err) { throw err; } else { console.log(row[0].distinctcount); } }); but logs: undefined. you should use: select count(distinct number) distinctcount users;

php - JQuery 5 star rating system -

i'm creating 5 star rating system html php , jquery dont know how stop stars rating when user has clicked on rating. in code when user click on 4 stars alert box shows 4 stars when user move mouse stars stars shows 0 rating. here code, i'm not posting css here html : <div class="rating"> <div class="ratings_stars" data-rating="1"></div> <div class="ratings_stars" data-rating="2"></div> <div class="ratings_stars" data-rating="3"></div> <div class="ratings_stars" data-rating="4"></div> <div class="ratings_stars" data-rating="5"></div> </div> jquery : $('.ratings_stars').hover( // handles mouseover function() { $(this).prevall().andself().addclass('ratings_over'); $(this).nextall().removeclass('ratings_vote'); },

angularjs - Multiple ng-repeats on same element -

is possible have more 1 ng-repeat on same element (i.e. not nested)? like so: <section ng-repeat="clustera in foo.bara.clusters" ng-repeat="clusterb in foo.barb.clusters"> i want use ng-if display clustera , clusterb in same row if have same name. conceptually this fiddle . you ng-repeat on clustera , use $index check same record in clusterb. something like: <section ng-repeat="clustera in foo.bara.clusters"> <span class="col-md-6">clustera</span> <span ng-if="clustera == foo.barb.clusters[$index]" class="col-md-6">foo.barb.clusters[$index]</span> </section>

jquery - How can I implement Elastislide (content-box) in a Bootstrap 3.3.5 (border-box) project? -

i have trouble implementing elastislide image gallery bootstrap 3. the elastislide html, css , jquery code i'm using here: http://bit.ly/1o01x3x . i'm working bootstrap tutorials , examples w3schools: http://bit.ly/1sjzys4 . i have understood searching other similar issues on stackoverflow problem has box-sizing. bootstrap use box-sizing: border-box elastislide use box-sizing: content-box. i have tried use suggestions one: http://bit.ly/1eceinm no success question is: how/where should apply code make elastislide work bootstrap 3? gallery.php: <!doctype html> <html lang="en"> <head> <title>test</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> <meta http-equiv="x-ua-compatible" content="ie=edge;chrome=1"> <link rel="stylesheet" href="http://maxcdn.

cookies - How to save in local storage of Safari Private Mode -

i have app saves user name in local storage. works fine every browser except safari in private mode . is there way save variable in safari private mode? tried using cookies it's doesn't work... any work around? i implemented localstoragehandler checks if browser supports local storage, if doesn't support use cookie. this function checks if supports local storage: localstoresupport: function () { var testkey = 'test', storage = window.sessionstorage; try { storage.setitem(testkey, '1'); storage.removeitem(testkey); return true; } catch (error) { return false; } } and how dealt false: if (this.localstoresupport()) { localstorage.setitem(name, value); } else { document.cookie = name + "=" + encodeuricomponent(value) + expires + "; path=/"; } i hope helps you.

java - Syncing two android projects -

Image
i using 2 different android projects downloaded internet, , assembled them make them 1 single project. they both online apps, , using jsonparser , urls connect , sort of in different way, will required compile jsonparser files of both projects compile 1 or , can keep them separate in same project. let me tell u, 1 project of login,register system...... , second of account management they in process sync function dependent on kind of each other all mean ask can 1 android project have 2 or more jsonparser.java classes in different packages or not? can 1 android project have 2 or more jsonparser.java classes in different packages or not? yes, possible.

javascript - jquery parseXML: 'text/dom' is not a valid enum value of type SupportedType -

after changes in project (the changes not related xml parsing part) jquery.parsexml stopped working in firefox , chrome (i haven't tried other browsers). i tested simple xml strings as $.parsexml('<a>a</a>'); with following result: "error: invalid xml: <a>a</a>" the internal message (catched jquery) following: "failed execute 'parsefromstring' on 'domparser': provided value 'text/dom' not valid enum value of type supportedtype." this triggered following jquery code lines: tmp = new domparser(); xml = tmp.parsefromstring( data, "text/dom" ); i don't know how possible, since changes had nothing todo xml parsing. its working if parse without jquery , type "application/xml", why did domparser accept "text/dom" type before ? edit somehow jquery version installed through bower (version 2.1.4) differs official version: my version: xml = tmp.parsefro