Posts

Showing posts from February, 2014

android - Web View running on other than UI thread -

i trying show flurry interstitial getting following message in debug screen , not receiving interstitial on screen. 07-14 15:55:31.390: w/webview(10588): java.lang.throwable: warning: webview method called on thread 'flurryagent'. webview methods must called on ui thread. future versions of webview may not support use on other threads. i have followed tutorial : android integration at present working on andengine. error replying put code in ui thread result same. here code displaying ads : protected void oncreate(bundle psavedinstancestate) { super.oncreate(psavedinstancestate); // configure flurry flurryagent.setlogenabled(false); // init flurry flurryagent.init(maingameactivity.this, my_flurry_apikey); mflurryadinterstitial = new flurryadinterstitial(maingameactivity.this, my_adspace_name); flurryadtargeting adtargeting = new flurryadtargeting(); // enable test mode interstitial ad unit adtargeting.se

php - Looking for some kind of "lookahead iteration" for grouping record sets -

as use be, if need display list of on site have use looping construct iterate on data. in case it's foreach() on <tr> of table foreach($candidates $candidate) and after getting values: $candidate->id problem 1 specific value, , enforcement. in db have data in table below, example candidates_id = 600 there enforcemement 1 , 0 id | candidates_id | enforcement ------------------------------------- 1 | 598 | 2 2 | 599 | 4 3 | 600 | 1 4 | 600 | 0 until okey, values db , echo on site. problem values 0 or 1 have no meaning end user. write if / else condition if($candidate->enfor == 0) echo "text1"; elseif($candidate->enfor == 1) echo "text2"; else echo "some default text"; in sample data there 2 records candidates_id=600 , different values enforcement. right script produces 2 separate <tr> elements. 1 containing <td>text1<

Issue when attempting to create black and white image from previously processed image using file I/O in Java -

i making application takes image , applies grayscale filter using file i/o. user asked threshold , save location take processed image , make pure black , white. issue having when 2nd image created , try open it, windows reports file damaged though file size same processed image seems working correctly. here code application. continue using file io create this, understand java has built in function creating binary image. import java.io.*; import javax.swing.*; public class bitmapper { public static void main(string[] args) { string threshold; int thresholdint; jfilechooser chooser1 = new jfilechooser(); jfilechooser chooser2 = new jfilechooser(); jfilechooser chooser3 = new jfilechooser(); int status1 = chooser1.showopendialog(null); int status2 = chooser2.showsavedialog(null); if(status1 == jfilechooser.approve_option && status2 == jfilechooser.approve_option) { try {

java - User input from editText to a String -

i looks simple question, can't manage work. i'm trying make weather app, , im using yahoo api, , app works: service.refreshweather("dallas, tx"); i wanted make user input city, made this: mbutton = (button)findviewbyid(r.id.mdugme); medit = (edittext)findviewbyid(r.id.unesigrad); string userinput11; mbutton.setonclicklistener( new view.onclicklistener() { public void onclick(view view) { userinput11 = medit.gettext().tostring(); } }); service.refreshweather(userinput11); why isn't working? take code mbutton.setonclicklistener( new view.onclicklistener() { public void onclick(view view) { userinput11 = medit.gettext().tostring(); } }); service.refreshweather(userinput11); and reorder this mbutt

VBA Excel get values of updated cells -

Image
ok, have been struggling problem time. new vba bear me. what need program grab cell values in workbook updated , push data email. let's range want watch a4:a100. user puts in sales order number a10 , a11. need program take values cells , insert them email when workbook saved. have code @ end of question emails list of people when workbook saved. have email contain id's (column a) of records entered. thank help. private sub workbook_beforesave(byval saveasui boolean, _ cancel boolean) dim answer string answer = msgbox("would save , email notification?", vbyesno, "save , email") if answer = vbno cancel = true if answer = vbyes 'open outlook type stuff set outlookapp = createobject("outlook.application") set olobjects = outlookapp.getnamespace("mapi") set newmsg = outlookapp.createitem(olmailitem) 'add recipients newmsg.recipients.add ("will.smead@cablevey.com") newmsg.recipients.add ("will.smead@cableve

c# - AdoNetAppender writes to wrong Azure database -

i'm using log4net log sql database in azure. i've got config file setup , working properly. log data getting written. application imports, translates , loads unique set of data each of our customers. in azure create new database each customer. in logging utility have following method should set logging connection string proper client database: private static void setdbconnection(string connectionstring) { var appender = ((adonetappender)(log.logger.repository.getappenders()[0])); appender.connectionstring = connectionstring; appender.activateoptions(); } this seems working, however, consitently getting logs client in database client b, , client c , client d , , forth , around. one thing application multi-threaded, , noticing instance, of client b's data in thread 20, of client c's data in thread 8 etc. looks consistent across databases. my main question is, how can ensure client a's logs client a's database? i inherited application, , i

c# - Not to execute any further code until the async method is completed its execution -

not execute further code until async method completed execution. please let me know how achieve it. following sample code : // parent form code private void btnopenform1_click(object sender, eventargs e) { form1 form1 = new form1(); var result = form1.showdialog(); if (result == system.windows.forms.dialogresult.ok) { // } } // child form code private void form1_formclosing(object sender, formclosingeventargs e) { dialogresult result = messagebox.show(string.format("do want save changes?", "confirmation", messageboxbuttons.yesnocancel, messageboxicon.question); if (result == system.windows.forms.dialogresult.cancel) { e.cancel = true; } else { if (result == dialogresult.yes) { e.cancel = true; this.dialogresult = system.windows.forms.dialogresult.ok; // here need wait compulsarily till operation completed, no next statement should executed (ne

angularjs - loading icon on bootstrap modal with interceptors -

i trying implement loading icon every rest api call in angularjs application. solution in thread worked great me except in 1 scenario. implementing loading spinner using httpinterceptor , angularjs 1.1.5 the scenario have bring bootstrap modal parent page. have loading icon appear on modal when processing request. instead loading icon appears on parent page in background of modal. please advise how icon load on modal (perhaps disabling 1 loading on parent page) incase modal opened parent. edit: trying use 2 spinner divs achieve this.one @ parent level. other 1 @ modal html. #parentdiv, #modaldiv { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 1100; background-color: white; opacity: .6; } .ajax-loader { position: absolute; left: 50%; top: 50%; margin-left: -32px; /* -1 * image width / 2 */ margin-top: -32px; /* -1 * image height / 2 */ dis

Tomcat + MySQL docker container outputting utf8 text with wrong encoding -

experiencing incorrect encoding on utf8 text output tomcat:8.0 container retrieved mysql:5.6 container. connecting mysql container directly , querying on shell proves text stored in database correctly. also utf8 content within templates output tomcat container fine. the jdbc connector string reads: nfc.jdbc.mysql.url=jdbc:mysql://mysql:3306/mydatabase?autoreconnect=yes&useunicode=yes&characterencoding=utf-8 here's tomcat dockerfile i'm using: from tomcat:8.0 run apt-get update && \ apt-get -y install libmysql-java run echo 'classpath=/usr/share/java/mysql.jar' >> /usr/local/tomcat/bin/setenv.sh and mysql dockerfile: from mysql:5.6 run { \ echo '[mysqld]'; \ echo 'character-set-server = utf8'; \ echo 'collation-server = utf8_unicode_ci'; \ echo '[client]'; \ echo 'default-character-set=utf8'; \ echo '[mysql]'; \ echo 'default-character-set=utf8

android - how can i hold the activity till the animation gets executed -

animfadein = animationutils.loadanimation(getapplicationcontext(), r.drawable.fade_in); // set animation listener //animblink.setanimationlistener(this); opt1.setonclicklistener(new onclicklistener() { @override public void onclick(view arg0) { l1.startanimation(animfadein); startactivity(new intent(mainactivity.this,secondquestion.class)); } }); <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:fillafter="true" > <alpha android:duration="10000" android:fromalpha="0.0" android:interpolator="@android:anim/accelerate_interpolator" android:toalpha="1.0" /> i want animation execute next activity should called how can achieve this. before 10000 sec been on next

python - Print dictionary of list values -

i have list of dictionary values, given below: {'id 2': [{'game': 586, 'start': 1436882375, 'process': 13140}, {'game': 585, 'start': 1436882375, 'process': 13116}], 'id 1': [{'game': 582, 'start': 1436882375, 'process': 13094}, {'game': 583, 'start': 1436882375, 'process': 12934}, {'game': 584, 'start': 1436882375, 'process': 12805}]} it barely readable. want format way: 'id 2' : {'game': 586, 'start': 1436882375, 'process': 13140}, 'id 2' : {'game': 585, 'start': 1436882375, 'process': 13116}, 'id 1' : {'game': 582, 'start': 1436882375, 'process': 13094}, 'id 1' : {'game': 582, 'start': 1436882375, 'process': 13094}, my code printing given below: key in queue_dict.items(): values in key.values():

android - error at closing database in customadapter? -

i trying implement listview adapter, in adapter wrote code try { dbhelper = new dbhelper(context); database=dbhelper.getreadabledatabase(); string id = deviceid.tostring().trim(); string query = ("select pond, maxvalue ,minvalue,maxphvalue,minphvalue ponddata pond ='" + id + "'"); cursor1 = database.rawquery(query, null); if(cursor1 != null){ if(cursor1.movetolast()){ string maxvalue =cursor1.getstring(cursor1.getcolumnindex("maxvalue")); string minvalue =cursor1.getstring(cursor1.getcolumnindex("minvalue")); string maxphval = cursor1.getstring(cursor1.getcolumnindex("maxphvalue")); string minphval = cursor1.getstring(cursor1.getcolumnindex("minphvalue")); float min = float.parsefloat(minvalue); float max = float.parsefloat(maxvalu

xcode - Delphi XE8 iOS Application not running on iPhone 6 but works on other models -

my application developed on delphi firemonkey xe8 (update 1) failes run on iphone 6 works on iphone 4 , ipad4 (all ios 8.4). xcode 6.4 , ios 6.4 sdk's imported. any on how figure out why on 1 device , not other given ios versions same? strangely enough, specific project not want run on ios simulator. when running delphi debugger hangs in begin process dlym_sim. running app stand alone ios simulator crash report: crash report loaded here

javascript - How to change Header Parameters while using angular-file-upload for uploading multiple files -

i have requirement add file name in header while uploading each file. using single uploader selecting multiple files. tried doing $scope.uploader.onafteraddingfile = function (fileitem) { $scope.uploader.headers.filename = fileitem.name; }; but not changing. can please help? try this: $scope.uploader.queue[$scope.uploader.queue.length - 1].file.name = "prefix-" + fileitem.file.name;

android - What is the right way of checking conditions in content providers? -

i have sqlite database , content provider wraps it. there table of dictionaries , table of words. eeach word belongs 1 of dictionaries. each dictionariy has constant capacity. content provider should allow insert limited amount of words in each dictionary. "scheme" dictionaries |-id (read-only) |-capacity words |-id (read-only) |-dictionaryid (write-once) i have few options: 1) each new dictionary can create trigger raise() error if amount of words gather capacity. make query each insertion redurant in situations. 2) can check condition in provider's insert(). (same problem above) 3) can pass check users of provider. example check condition in activity adds new words dictionary. optimized method because don't need make query each time add new word. can query amount of words in dictionary @ start of activity , increment , aware of relevant value without queries. here have problem: if forget check condition or make mistake , condition won't work.

c# - simple calculation not working for some reason -

alright, i'm trying calculate percentage of 2 values. should simple weird reason it's not working. i'm tired/dumb figure out. here's code, keeps returning 0, checked values while debugging , filescompleted being 295 , totalfilescount being 25002 returnvalue var 0, should 1 already. private int calculatepercentcomplete(int filescompleted, int totalfilescount) { int returnvalue = (filescompleted / totalfilescount) * 100; if (returnvalue > 100 || returnvalue < 1) return 1; else return returnvalue; } i checked values while debugging , filescompleted being 295 , totalfilescount being 25002 returnvalue var 0, should 1 already. no, because arithmetic being done integers. first expression evaluated: (filescompleted / totalfilescount) that's 295 / 25002. result of integer arithmetic 0... , when multiply 100, you've still got 0. simplest fix multiplication first: int returnvalue = (fil

python - Trying to wrap requests but getting AttributeError: type object 'http_req' has no attribute 'get' -

any suggestions getting wrong? i'm trying wrap python requests.get, request.post, requests.delete etc (venv3.4)ubuntu@mail:~$ cat sav.py import requests class http_req(): # wrap requests can print warnings on exceptions instead of crashing out def __init__(self, *args, **kwargs): self.args = args self.kwargs = kwargs self.http_methods = ['get', 'post', 'put', 'patch', 'delete', 'options'] def __getattr__(self, name): if name in self.http_methods: request_method_to_call = getattr(requests, name) return request_method_to_call(*self.args, **self.kwargs) raise attributeerror() print('test 1: showing first 10 characters of response') print(requests.get('http://www.google.com').text[:10]) print('test 2: showing first 10 characters of response') t = requests.get('http://www.google.com') print(t.text[:10]) print('test 3

sql - SELECT using a case statement -

good afternoon i new sql server strugling build select. looking advice dont know turn. so have table need update if columns exist in other tables. other table have defualt value of 999, mean value. try , write sudo code. select row master table between dates , cust in ( custtable cust matches or cust custtable = 999) , branch in ( branchtable branch matches or branch branchtable = 999) , product in ( producttable product matches or product producttable = 999) only if 3 equate being found should have row. please let me know you require more information may not have made sense thanks in advance. go easy on me sa learning update so have following select @si_id = sic_idsupportedinitiative, @si_suppid = sic_idsupplier, @sd = sic_startdate, @ed = sic_enddate, @si_amt = sic_claimamount sic_supportedinitiative sic_idsupportedinitiative = 1 select sc.id, sc.[actual posting date],sc.[customer account], sc.[accounting branch],sc.[product code],sc.[salesq uantity],sc.sic_

sql - Return 1 result on multiple line join -

Image
i have orders , order lines table , want able select few of records order table temp table. easy, hard part want select temp table when specific product used in "order". query wrote, can't use returns multiple results each order depending on how many order lines exist. can 1 help? want see whether order included specific or number of specific produts: declare @begin_date datetime; set @begin_date = '2015-04-01' declare @end_date datetime; set @end_date = '2015-06-30' select o.location_code, o.order_number, o.order_date, o.orderidealfoodcost o.orderfinalprice, case when ol.productcode in ('172352','172353','172355','172357','172360','172422','172429','172343','172344','172346','172348','172351','172427','172428') 1 else 0 end promo #ordercostprice order_lines ol (nolock) inner join ord

javascript - How can I keep a text of a div inside it and if bigger, then the div expands down? -

Image
i'd know if there's way keep text inside div if text exceeds width ´div´'s height stretched until text fitted. update: thank y'all helping +1, should use ´inherit´ or ´min-height´? a plain div : then added word-wrap: break-word; , , i've got this: the ideal: the div 's height should increased in order fit whole text thanks in advance. div { width: 50px; height: 50px; border: 1px solid red; display: inline-block; word-wrap: break-word; } <!doctype html> <html> <head> <title>div</title> </head> <body> <div>asjdkljaddddsadsssssssdfsdfsdfsf</div> </body> </html> change height min-height in css: the min-height property used set minimum height of element. this prevents value of height property becoming smaller min-height . div { width: 50px; min-height: 50px; border: 1px solid red;

ios - AVAudioPlayer play multiple times same sound without interrupting -

i have scrollview. , want play sound everytime reach 1/7 of it. when user scrolls works because sound finished before other 1 gets fired. but if fast : have 2 options : ignore following sound should fire stop previous 1 , play following but want have first 1 finishing playing if second (or 3rd, 4th etc.) has started playing. can 1 avaudioplayer ? var alertsound = nsbundle.mainbundle().urlforresource("transit", withextension: "aif") avaudiosession.sharedinstance().setcategory(avaudiosessioncategoryambient, error: nil) avaudiosession.sharedinstance().setactive(true, error: nil) var error:nserror? audioplayer = avaudioplayer(contentsofurl: alertsound, error: &error) audioplayer.preparetoplay() to achieve want you'll need multiple avaudioplayers , 1 player won't job. audiotoolbox framework cater requirements. you create system sound id sound , fire off whenever want. once it's fired sound play out, down side no control on vo

Android Horizontal Scroll View for showing youtube vidoes -

am creating android application displays youtube videos on horizontal(landscape) list view similar application in screen-shot. , when click on 1 of video should play, happening, able load youtube videos along there thumbnails in simple list view(vertical) in android, couldn't found out way far, using can show videos in youtube playlist in manner shown in following screen shot layout view. if 1 knows how show video list in horizontal(landscape) layout depicted in attached screen-shot, great me. please visit link see screenshot: https://sc-cdn.scaleengine.net/i/954e89ab4d5fef83bb19009107d71c60.png thank you. here sample code sorry logs, running on device. mainactivity package in.wptrafficanalyzer.viewpagerdemo; import android.os.bundle; import android.support.v4.app.fragmentactivity; import android.support.v4.app.fragmentmanager; import android.support.v4.view.viewpager; import android.view.menu; public class mainactivity extends fragmentactivity { @overri

windows phone 8.1 - Can we add google admob in WP8.1 WinRT App -

i trying add google ad mob in wp8.1 winrt app facing issues can me such why unable use google admob in wp8.1 wnrt app. , how implement it. for convenience (and money) microsoft wants use pubcenter . can see more data on how use advertising sdk made them use of pubcenter here

ios - Dynamically (generic) inherit from <T> in swift -

i didn't find solution , there's chance it's not possible i'll give try (if it's not possible i'd happy small explanation why). i'm trying create class in swift, let's call foo, , want foochild inherit foo. far, no problems. thing is, want foo dynamically inherit "any class", maybe generic type. something like class foo<t> : <t>{ } class foochild : foo<nsobject> { } class foochild2 : foo<uiview> { } i want both foochild , foochild2 inherit foo, want foo inherit once nsobject, , once uiview (used random classes example). is possible? in objective-c code i'll bridge somehow. swift 1.2 no, not possible. what can like: protocol foo { } class foochild1: nsobject, foo { } class foochild2: uiview, foo { } swift 2 yes, possible. non-generic classes may inherit generic classes. (15520519) see: xcode 7 beta release notes , chapter "new in swift 2.0 , objective-c", secti

angularjs - reapply filter when scope changes -

i have applied custom filter check checkboxes belonging group have been checked. the filter hides groups of checkboxes none of them have been checked. what need is, reapply filter when box checked or unchecked. .so when checkboxes belonging group unchecked, rest of groups show up.how go it? <ul ng-repeat="(key,value) in filtered=(properties | filter:filterbycategory| groupby: 'name') "> <li>group name: <strong>{{ key }}</strong></li> <div ng-repeat="prop in value"> <label> <input type="checkbox" ng-model="filter[key][$index]" ng-change="changed"/> <span>{{prop.property}}</span> </label> </div> </ul> i guess need this: mentioned here ng-change . plunkr: code here try: i tried changing this: <input type="checkbox" ng-mod

hadoop - How can I wrap the output by double quotes in insert overwrite statements in hive -

this insert overwrite statement: insert overwrite directory /myworkspace/output/f_name/20150714 select concat_ws('|', coalesce(a,''), coalesce(b,''), coalesce(c,''), coalesce(d,'') ) table_a; i getting output as: a|b|c|d but want output as: "a"|"b"|"c"|"d" i not able figure out. ideally table definition should define format want data output in. insulate doing lot of concat. in case define table use column delimiter "|" & fields terminated '"' refer following link : create table hive

java - Error with xpath on automation selenium -

i have html code on ui <a href="javascript: void edit('edit_total_amt')" title="override total tax amount" onmouseover="status='override total tax amount'; return true">0.00</a> and have select webelement identified tag option text auto. try solution like: public void clickonitemtax () { tag = by.xpath("//a[contains(@title,'override total tax percent')]"); //by tag = by.xpath("//a[contains(@title,'total tax')]"); //by tag = by.name("totaltaxpercent"); this.sleep(3); if (this.waitforexistence(tag, 60)) { webelement domlink = linkget(tag); domlink.click(); } else { jlog.fail("attempting click on item tax not found :" + tag ); } } error getting : fail: attempting click on item tax not found :by.xpath: //a[contains(@title,'override total tax percent')] kindly adv

How to format series labels of a BIRT chart by script -

Image
i have chart report displaying indicator values on time. indicator report parameter , can represent either percent (%) or currency ($) value. here example percent type: now need change format number of datapoint labels depending on type of selected indicator. in birt designer defined percent format default: the indicator type extracted dataset , stored in persistent global var, can accessed in chart scripts. in data field of crosstab format changed in "oncreate" event like: this.getstyle().numberformat="$ #,###"; but in chart scripts can't find out way change format number dynamically. suggestion appreciated! this question has been answered in opentext forums here . can format datapoint labels in chart event "beforedrawdatapointlabel". in example below, expected number format (for instance "$ #,###") stored in global variable "numberformat": importpackage(packages.java.text); nf = new decimalformat(ge

uitableview - how to change view's background color in viewForHeaderInSection when view gets tapped in swift -

i using expandable table view. used below logic. if tapped section, unable change view's ground color. have change respective view's ground color when gets tapped. code, red color blinking. dont know why? kindly guide me. for ex, having 5 sections means, displays 5 views. unable add tag each , every view. dont know how that. kindly guide me. my coding: func tableview(tableview: uitableview, viewforheaderinsection section: int) -> uiview? { var headerview = uiview(frame: cgrectmake(0, 0, sidetableview.frame.size.width, 49)) var layerline = calayer() layerline.frame = cgrect(x: 0, y: headerview.frame.size.height, width: headerview.frame.size.width, height: 1) layerline.backgroundcolor = uicolor(red: 220/255, green: 220/255, blue: 220/255, alpha: 1.0).cgcolor headerview.backgroundcolor = uicolor(red: 242/255, green: 242/255, blue: 242/255, alpha: 1.0) headerview.tag = section headervie

apache - ZendGuardLoader.so: cannot open shared object file: No such file or directory php -

my web page not running on system, when checked on apache error log shows below error, # tail -f /usr/local/apache/logs/error_log [tue jul 14 05:36:19.899752 2015] [:error] [pid 27660:tid 140637045212928] [client 50.28.66.241:50935] failed loading /usr/local/zend/lib/guard-5.5.0/php-5.3.x/zendguardloader.so: /usr/local/zend/lib/guard-5.5.0/php-5.3.x/zendguardloader.so: cannot open shared object file: no such file or directory how solved this? i can see zendguardloader not installed on server php, please check php version , try install it. can install php extension on cpanel server following command. /scripts/phpextensionmgr install zendopt you can install following modules on server above command. [root ~ ]# /scripts/phpextensionmgr list available extensions: eaccelerator ioncubeloader zendopt xcache sourceguardian phpsuhosin

Node.js for some reason cannot connect to postgresql -

the code crashes @ query object creation. var constring = "postgres://mydbusr:thepassword@localhost/mydb"; var client = new pg.client(constring); client.connect(function(err) { if (err) { return console.error('could not connect postgres', err); } var query = client.query('select id people'); //the problem here query.on('row', function(row) { //do }); client.end(); }); and errror don't understand: events.js:72 throw er; // unhandled 'error' event ^ error: connection terminated @ null.<anonymous> (/liveupdates/node_modules/pg/lib/client.js:184:29) @ g (events.js:180:16) @ eventemitter.emit (events.js:92:17) @ socket.<anonymous> (/liveupdates/node_modules/pg/lib/connection.js:66:10) @ socket.eventemitter.emit (events.js:95:17) @ tcp.close (net.js:466:12) you forgot, pretty calls database asynchronous. in code closed conne

xml - Find and Replace in PowerShell produces a corrupt/not valid file -

i'm using powershell edit xml file. i'm doing searching string , replacing string within xml. command looks like: (get-content "c:\my_vm\virtual machines\xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.xml") | foreach-object {$_ -replace "my_vmname", "my_vmname_0"} | set-content "c:\my_vm\virtual machines\xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.xml" where xml file in case virtual machine image imported hyper-v the find/replace works fine, , can rename .vhdx file import no problem also. using: rename-item "c:\my_vm\virtual hard disks\my_vmname.vhdx" my_vmname_0.vhdx but when try use import-vm using following cmdlet: import-vm -path "c:\my_vm\virtual machines\xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.xml" -copy -generatenewid i error: "import-vm : virtual machine configuration not read. data might corrupt or not valid." does know why is? i've come workaround(using different technologies) it's still

jquery - Javascript function overwriting itself -

sorry title isn't clear, i'm not sure problem is. i'll happily rename if has better idea. i have bunch of boxes classes 'something-box' called clicking various things have given classes of 'something-button'. boxes have class of 'modal-box' , contained within partially transparent div comes cover rest of screen ('modal-blackout'). rather write same code out each 1 (which doing) decided make function attach relevant click handlers each button (and various other things accompany it). have following js code: function modal(selector) { button = $(selector+'-button'); box = $(selector+'-box'); button.click(function(e) { e.stoppropagation(); $('.modal-box').hide(); $(document).off('.hidedoc'); $('.modal-blackout').show(); box.show(); $(document).on('click.hidedoc', function(e) {

how to replace values in list in C#? -

i have list: list<string> strlist=new list<string>(); strlist.add("uk"); strlist.add("us"); strlist.add("india"); strlist.add("australia"); i want change index of elements in list: the current index of "us" 1, want replace 3 , "australia" should 1. if know indices already, can use 'swap' them: var temp = strlist[1]; strlist[1] = strlist[3]; strlist[3] = temp;

ios - Is there a way possible to make iPad sleep / wake at specific time intervals using Apple configurator? -

i need control ipad's sleep/wake @ specific time intervals. i know using apple configurator helps disabling hardware buttons , touch events too... motive make ipad wake 7am , sleep 10pm. i know apps mokitouch , kioskpro helps, has limitations. there way achieve via apple configurator ?

android - How to invoke an activity from background services when arrives a notification? -

i want check notifications background receivers or services. notification shown, should invoke activity. mainacticityclass here have created alarm class call broadcast manager @ specific interval public class mainactivity extends appcompatactivity { private context context; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); this.context = this; intent alarm = new intent(this.context, alarmreceiver.class); boolean alarmrunning = (pendingintent.getbroadcast(this.context, 0, alarm, pendingintent.flag_no_create) != null); if(alarmrunning == false) { pendingintent pendingintent = pendingintent.getbroadcast(this.context, 0, alarm, 0); alarmmanager alarmmanager = (alarmmanager) getsystemservice(context.alarm_service); alarmmanager.setrepeating(alarmmanager.elapsed_realtime_wakeup, systemclock.elapsedrealtime(), 60000, pendingintent);

ios - AVPlayerLayer isn't showing AVPlayer video? -

what's trick getting avplayer video content show in one's view? we using following avplayer code nothing appearing on screen. know video there because able show using mpmovieplayercontroller. here code using: avasset *asset = [avasset assetwithurl:videotempurl]; avplayeritem *item = [[avplayeritem alloc] initwithasset:asset]; avplayer *player = [[avplayer alloc] initwithplayeritem:item]; player.actionatitemend = avplayeractionatitemendnone; avplayerlayer *layer = [avplayerlayer playerlayerwithplayer:player]; // layer.frame = self.view.frame; [self.view.layer addsublayer:layer]; layer.backgroundcolor = [uicolor clearcolor].cgcolor; //layer.backgroundcolor = [uicolor greencolor].cgcolor; [layer setvideogravity:avlayervideogravityresizeaspectfill]; [player play]; are setting layer improperly current view? you need set layer's frame property. e.g.: self.playerlayer.frame = cgrectmake(0, 0, 100, 100) if tried , didn't work in view controller's v

google chrome - How install custom pepper plugin in Chromium browser source code? -

i need build in pepper plugin in chromium source code building browser installed plugin. there possibility that? a handful of plugins built in. since these plugins, built independently chrome , loaded dynamically rather directly linked chromium executable. function causes them loaded chromium: https://code.google.com/p/chromium/codesearch#chromium/src/chrome/common/chrome_content_client.cc&rcl=1436599777&l=118 the nacl plugin special, since runs "in process", means loaded renderer process. eventually, support kind of plugin eliminated, best follow pattern of "out of process" plugins, run in own process, such pdf.

mysql - PHP script reports wrong credentials -

ok, code authentication. now, have 1 table , 5 php working scripts except one. after successful login, user should redirected home page, problem is, php echoes "cannot login" error message regardless of login details. heres script: session_start(); include_once'dbconnect.php'; if (isset($_session['user']) != "") { header ("location: home.php"); } if (isset($_post['login'])) { $email = mysql_real_escape_string($_post['email']); $pass = mysql_real_escape_string($_post['pass']); $sql = mysql_query("select * users email='".$email."'"); $num = mysql_fetch_assoc($sql); if ($num['password'] == $pass)) { $_session['user'] = $num['user_id']; header ("location: home.php"); } else { echo "cannot login";

scala - How to pickle in Client and Unpickle in Server? -

i have client scala code below import java.net._ import java.io._ import scala.io._ import scala.pickling._ import scala.pickling.json._ val sk = new socket(inetaddress.getbyname("localhost"), 13373) val output = new printstream(sk.getoutputstream()) val textrdd = sc.textfile("some file"); output.println( #pickle textrdd , pass server) output.flush() sk.close() and python server.py below, import socketserver import json import pickle class mytcpserver(socketserver.threadingtcpserver): allow_reuse_address = true class mytcpserverhandler(socketserver.baserequesthandler): def handle(self): try: data = self.request.recv(1024) #unpickle data received here , print it. print data except exception, e: print "exception wile receiving message: ", e server = mytcpserver(('127.0.0.1', 13373), mytcpserverhandler) server.serve_forever() how pickle textrdd file in scala client , pass python server

objective c - import AWS iOS SDK cause architecture error -

Image
i've downloaded latest aws ios sdk , added several frameworks (without copy) manually project. without further ado got errors simple build: here's architecture settings: since understand none of errors... advice appreciated. you should follow set sdk ios section of aws mobile sdk ios developer guide. not linking libsqlite3.dylib , libz.dylib , , systemconfiguration.framework .

javascript - AngularJS filter with jQuery event not working -

i have list of items $scope , , bind jquery event them, , use input field filter list. works expected. when type in input field, items filtered out still bound jquery event; however, if delete text input field, re-appearing items seem out of scope. you can check this plunker . when click on button in list, alert pop up, if type b in input box, , delete it, clicking button text a not show pop up. how can fix this? thanks in advance. update: thanks answers, i'm sorry mislead using such simple example :/ actual situation quite different. anyway, using jquery .on not idea here, should pass $event object function within scope, , handle dom element inside function. the problem angular filter, should clear functionality filter not hide element dom remove element dom @ first time events gets attached element when search through input field no events remain on same element. here solution <!doctype html> <html> <head> <link rel=&qu

C++11 Chrono - How to cast 'unsigned int' to a time_point<system_clock>? -

i have function has signature: void checktime (const std::chrono::time_point<std::chrono::system_clock> &time) { //do stuff... } i need call above function this: void wait_some_time (unsigned int ms) { //do stuff... checktime(ms); //error: how can cast unsigned int time_point<system_clock> now() + milliseconds? //do more stuff... } i want use this: wait_some_time(200); //wait + 200ms question: how can cast 'unsigned int' const std::chrono::time_point has milliseconds value ? thanks! how can cast 'unsigned int' const std::chrono::time_point has milliseconds value ? a time_point point in time, represented offset epoch (the "zero" value time_point). system_clock epoch 00:00:00 jan 1 1970. your unsigned int offset, can't converted directly time_point because has no epoch information associated it. so answer question "how convert unsigned int time_point ?" need know unsigned i

c# - Erroneous code, when overriding async method. Can this behavior be turned off? -

let's consider class: public class { public virtual async task fooasync() { await task.delay(3000); } } if you'll try override fooasync typing "override" + selecting fooasync list, vs 2013 code editor generate code: public override async task fooasync() { return base.fooasync(); } which, obviously, won't compile, until you'll change return await . i know, async implementation detail, , changed in derived type, isn't cause generated code, doesn't compile initially. can behavior turned off (e.g., using vs settings)? i don't believe there's way change behaviour. code added comes snippet, found (on machine) under c:\program files (x86)\microsoft visual studio 12.0\vc#\snippets\1033\refactoring\methodoverridestub.snippet . snippet is: <?xml version="1.0" encoding="utf-8"?> <codesnippets xmlns="http://schemas.microsoft.com/visualstudio/2005/code

mysql - Unable to get the hive remote metastore table information over thrift -

i can metastore table information on local mysql metastore setup hive using below program. import java.sql.connection; import java.sql.drivermanager; import java.sql.resultset; import java.sql.statement; import org.apache.hadoop.fs.path; import org.apache.hadoop.hive.conf.hiveconf; import org.apache.hadoop.hive.conf.hiveconf.confvars; public class metastoretest { public static void main(string[] args) throws exception { connection conn = null; try { hiveconf conf = new hiveconf(); conf.addresource(new path("/home/hadoop/hive-0.12.0/conf/hive-site.xml")); class.forname(conf.getvar(confvars.metastore_connection_driver)); conn = drivermanager.getconnection( conf.getvar(confvars.metastoreconnecturlkey), conf.getvar(confvars.metastore_connection_user_name), conf.getvar(confvars.metastorepwd)); statement st = conn.createstatement();

ios - Volume Slider in swift -

i trying to create slider controls volume of 4 audio files . here code audio: var buttonaudiourl = nsurl(fileurlwithpath: nsbundle.mainbundle().pathforresource("audio1", oftype: "mp3")!) var firstplayer = avaudioplayer() var buttonaudiourl2 = nsurl(fileurlwithpath: nsbundle.mainbundle().pathforresource("audio2", oftype: "mp3")!) var secondplayer = avaudioplayer() var buttonaudiourl3 = nsurl(fileurlwithpath: nsbundle.mainbundle().pathforresource("audio3", oftype: "mp3")!) var thirdplayer = avaudioplayer() var buttonaudiourl4 = nsurl(fileurlwithpath: nsbundle.mainbundle().pathforresource("audio4", oftype: "mp3")!) var forthplayer = avaudioplayer() override func viewdidload() { super.viewdidload() // additional setup after loading view, typically nib. firstplayer = avaudioplayer(contentsofurl: buttonaudiourl, error: nil) secondplayer = avaudioplayer(c

java - NetBeans WebApplication -

i'm working on netbeans webapplication using hibernate. after changing 2 lines of code i've got next error: ant -f c:\users\user\assignments\assignmentzaposleni -dnb.internal.action.name=debug -ddirectory.deployment.supported=true -dforceredeploy=false -dnb.wait.for.caches=true -dbrowser.context=c:\users\user\assignments\assignmentzaposleni debug c:\users\user\assignments\assignmentzaposleni\nbproject\build-impl.xml:797: libs.copylibs.classpath property not set up. property must point org-netbeans-modules-java-j2seproject-copylibstask.jar file part of netbeans ide installation , located @ <netbeans_installation>/java<version>/ant/extra folder. either open project in ide , make sure copylibs library exists or setup property manually. example this: ant -dlibs.copylibs.classpath=a/path/to/org-netbeans-modules-java-j2seproject-copylibstask.jar build failed (total time: 0 seconds) before changing code compiling ok without mistake. change in code are: the cod