Posts

Showing posts from August, 2011

html - PHP Auto update selectbox based on 1st selectbox -

i have 2 selectboxes <h3>results</h3> <select id="register_form" name="sport" /> <option value="rugby">rugby</option> <option value="cricket">cricket</option> <option value="football">football</option> </select> <?php echo'<select name="match">'; echo'<option value="'.$row['event_id'].'">'.$row['team1'].' vs '.$row['team2'].'</option>'; echo'</select>'; ?> <input id="register_form" type="submit" value="display" name="submit" /> user searches result by: selecting sport type in 1st selectbox , in 2nd selectbox option values populated based on sport type. is possible in php without user having first press submit $_post value of sport type? what best option

postgresql - Postgres Compress data on server side and decompress on client side -

is there mechanism in postgres allows compress data on server side before sending client , decompress on client side save time needed send large amount of data through slow connection? libpq documentation states there parameter sslcompression when enabled allow data stream compressed. requires compatible openssl libraries used , of course ssl enabled. depending on how you're connecting server might option. there no compression in actual protocol itself. have use separate compressing tunneling achieve that.

c - How to implement structure of linked list or binary tree in MPI? -

in c define structure linked list or binary tree that: struct list{ int val; list *next; }; or struct tree_node{ int val; tree_node *left, *right; }; we can assign pointer of next memory location in serial programming. question how handle pointer in mpi multiple processor has local memory? how keep track it? how implement linked list/binary tree in mpi? know mpi_graph. not useful in scenario. i appreciate answer. in advance. i'll discuss linked list, of applies binary tree little work. implementing linked list in classical sense isn't possible in mpi because, said, each process has own local memory won't consistent on other processes. limits using simple point point messaging unless want lot of work wouldn't make sense. however, possible using 1 sided communication, or rma. in fact, there's example code here . basic idea of rma each rank exposes region of memory other processes. then, appropriate accessors , synchronization calls,

video.js - videojs-youtube updated source not updating duration -

i've managed hook videojs youtube using https://github.com/exon/videojs-youtube . problem have is, after update source different youtube video, doesn't update duration of player, duration bar doesn't work properly. any ideas how can duration of updated youtube video , update duration on player? thanks

osx - Apple Crontab alternative plist to cd a folder and then execute yii script -

i want recreate crontab new apple plist file describe , execute background scheduled job. the reason want recreate because crontab has depreciate in osx , had few background process working until made , update 10.10.3 */1 * * * * cd /library/webserver/documents/testdrive/protected/ && ./yiic smssender crontab navigating protected folder , executing ./yiic smssender. <?xml version="1.0" encoding="utf-8"?> <!doctype plist public "-//apple//dtd plist 1.0//en" "http://www.apple.com/dtds/propertylist-1.0.dtd"> <plist version="1.0"> <dict> <key>label</key> <string>com.chapskev.crontabtest</string> <key>programarguments</key> <array> <string>/users/al/bin/crontab-test.sh</string> </array> <key>nice</key> <integer>1</integer> <ke

java - What is the Oracle term for an sql catalog? -

i using java's interface databasemetadata jdbc driver oracle database. the interface uses term catalog 1 of coordinates database subsets. example, in querying procedures ( getprocedures method ). i'm not sure term catalog stand for, considering oracle database. after brief playing interface, see can pass package names catalog argument yield members. does mean in oracle catalog == package ? interface define getcatalogterm method, in case returns empty string.

range - TypeError: Cannot call method "getRange" of null. (line 3, file "Code") -

for reason can't range in code read script have written. have setup if statement return "yes" in given range, if question on form answer c, way have setup returning error saying can't read range. please advise! function onformsubmit() { var sheet = spreadsheetapp.getactivespreadsheet().getsheetbyname("original submissions"); var lastrownumber = sheet.getdatarange().getnumrows(); var cellvalue = sheet.getrange(lastrownumber, 28).getvalue(); if (cellvalue == "yes") { mailapp.sendemail("gmail@gmail.com","special graduation requirement","visit " + sheet.geturl() + "to process request."); } }

c# - Crystal Report to PDF in .NET -

i put poc console app. generate pdf crystal report (using crystaldecisions libraries) it works fine on dev. box, encounters exception when executed elsewhere: could not load file or assembly 'crystaldecisions.reportappserver.commlay er, version=13.0.2000.0, culture=neutral, publickeytoken=692fbea5521e1304' or on e of dependencies. system cannot find file specified. unhandled exception: system.typeinitializationexception: type initializer 'crystaldecisions.crystalreports.engine.reportdocument' threw exception. -- -> system.io.filenotfoundexception: not load file or assembly 'crystaldeci sions.reportappserver.commlayer, version=13.0.2000.0, culture=neutral, publickey token=692fbea5521e1304' or 1 of dependencies. system cannot find f ile specified. @ crystaldecisions.crystalreports.engine.reportdocument..cctor() i believe caused absence of crystal reports runtime (which not explicitly installed).

arrays - How to access json_decode parameters in PHP -

so, i'm trying access input fields in form with $data = json_encode($app->request->getbody()); it returns after echo $data: "groupname=group13&description=description" but can't figure out how access parameters, i've tried with $data[0] $data['groupname'] $data->groupname how can access array elements? [update] tried of solutions, none of them worked me :( i've solved using since have 2 fields $groupname = $app->request->post('groupname'); $description = $app->request->post('description'); that not json, it's url encoded text... use parse_str() instead.

php - Addition of two matrix using loop -

these 2 matrices in 4 arrays: array ( [0] => array ( [0] => 1 [1] => 2 ) [1] => array ( [0] => 4 [1] => 5 ) ) array ( [0] => array ( [0] => 1 [1] => 2 ) [1] => array ( [0] => 4 [1] => 5 ) ) how can add these matrices using loop? try this:- <?php $a1 = array('0' => array('0' => 1,'1' => 2),'1' => array('0' => 4,'1' => 5)); $a2 = array('0' => array('0' => 1,'1' => 2),'1' => array('0' => 4,'1' => 5)); $sumarray = array(); $result = array(); for($i=0; $i<=1; $i++) { for($j=0; $j<=1; $j++) { $result[$i][$j] = $a1[$i][$j] + $a2[$i][$j]; } } echo "<pre/>";print_r($result); ?> output:

javascript - Jquery tablesorter pagination is not separating pages correctly on initial load -

so using pagination plugin tablesorter (tablesorter.com) , changed values in pagesize drop down box not correctly adjust pages unless click combo box again after page loads. if leave default values in (10,20,30) working correctly. load page , show 10 rows , allow me go next page rest of rows etc. need limit pages 100 results instead of 10. testing sake trying change limit 5 rows not adjusting correctly until click 5 in drop down after page loads. current code. html <div id="pager" class="pager"> <form> <img src="images/first.png" class="first"/> <img src="images/prev.png" class="prev"/> <input type="text" class="pagedisplay"/> <img src="images/next.png" class="next"/> <img src="images/last.png" class="last"/> <select class="pagesize"> <option value="5"&

how to get windows phone 8 app version from windows app store -

i want find windows phone app version market place. possible find current app version market? if ,then me find this. for windows phone 8.1 if swipe "details" panel on app's page, should app version @ top under "information". includes current version last time app updated. for windows phone 8 on main panel app, underneath information, there should "report concern microsoft" link. beneath link information on publisher, last update , current version. let me know if helps!

php - update my JOIN table -

i have built system can create category , document. categories live in cat_list table , documents live in doc_list table. there column in doc_list table called cat_no takes array or categories belong doc. newfile.php <?php require_once '../../db_con.php'; try{ // selecting entire row cat_list table $results = $dbh->query("select * cat_list"); }catch(exception $e) { echo $e->getmessage(); die(); } $cat = $results->fetchall(pdo::fetch_assoc); ?> <form action="actions/newdocadd.php" method="post" id="rtf" name=""> <input type="text" name="doc_title" id="doc_title" required="required" placeholder="document title"/><br /> <?php foreach($cat $cat){ echo '<input type="checkbox" value="" name=""> ' .$cat["cat_title"]. '</a><br>&

crash - My website is crashing due to this error Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111) -

i facing error continuously once in week. "can't connect local mysql server through socket '/var/run/mysqld/mysqld.sock' (111)" how can fixed problem? please me. my server on digitalocean host , webapp in php. when run command root@sharebulk:/var/log/mysql# tail -n 50 error.log it showing: 150515 11:54:24 [error] /usr/sbin/mysqld: table './photo_editor/fbpage_status_like' marked crashed , should repaired 150515 11:54:24 [warning] checking table: './photo_editor/fbpage_status_like' 150515 11:54:24 [error] /usr/sbin/mysqld: table './photo_editor/fbpages' marked crashed , should repaired 150515 11:54:24 [warning] checking table: './photo_editor/fbpages' 150515 11:54:24 [error] /usr/sbin/mysqld: table './photo_editor/social_fbstatus_foto' marked crashed , should repaired 150515 11:54:24 [warning] che

php - Two associations for the same table resulting in a collision -

i have videos , artists , video belongsto artist , artist hasmany videos. i did , working, when find videos , set [contain => ['artists'] got result videos entity related artist. this first relationship artist "owner" of video, need relationship because video have n others artists "featuring" video. heres better overview: tables: videos: id (pk), artist_id (fk) artists_videos: video_id (pk), artist_id (pk) artists: id (pk) - heres code: //videostable $this->belongsto('artists'); $this->belongstomany('artists'); //artiststable $this->hasmany('videos'); $this->belongstomany('videos'); the issue is, when set second relationship first relationship stops work, think happening kind of collision. you need call these associations different names: $this->belongsto('comments', [ 'classname' => 'comments', ... ]);

Elasticsearch: inner_hits does not work for nested queries (nested twice) -

i'm using es v1.5.2 (so inner_hits present , work correctly filters ) , have nested documents in elasticsearch nested paths : members members.members this means in mapping ( https://gist.github.com/frickm/834a4ff8f952cb86ec02 ) these 2 fields declared nested . have working query (which doubly nested filter on un-analyzed strings) shown below , work fine (my actual use-case has deeper nesting). i have 2 inner_hits clauses in query: outer work works the problem "inner" inner_hits not work: first inner_hits clause obtain "real" inner-hits members field; second inner_hits clause following result members.members field, wrong (the hits cannot empty, since entire document wouldn't hit): "members.members": { "hits": { "total": 0, "max_score": null, "hits": [] } } query: post nia/condition/_search { "query": { &quo

javascript - JS Clear text for next output -

the code below jumbles phrase , asks user rearrange right logical order, when correct phrase entered code outputs 'right answer' , outputs second question, output, 'right answer' still showing. how can clear next question? thx pav var currentquestion = 0; var words = [ ['how', 'are', 'you', 'today?'], ['what', 'would', 'you', 'like', 'for', 'breakfast?'], ['what', 'would', 'you', 'like', 'for', 'tea?'] ]; var correctinput = [ ['how today?'], ['what breakfast?'], ['what tea?'] ]; function showquestion(i) { if(i < words.length) { document.myform.textinput.value = ''; newwords = words[i].slice(0); shuffle(newwords); var el = document.getelementbyid('phrase'); el.textcontent = newwords.join(&#

xml - Count number of nodes with substring of attribute equivalent to some value -

example: trying count number of b nodes images. xml: <a> <b mediatype='image/jpeg'> <c>hello.jpg</c> </b> </a> xpath: count(//b[substring(@mediatype, 0, 5) = 'image']) using xpath tester: http://codebeautify.org/xpath-tester evaluates 0.0 thanks answers, have chosen best answer based on information given improved xpath using starts-with. in xpath positions (for lists , strings) start 1. if try substring(//b/@mediatype, 0, 5) imag . so need count(//b[substring(@mediatype, 1, 5) = 'image']) however in specific case suggest starts-with() : count(//b[starts-with(@mediatype, 'image/')])

html5 - Audio will not play on Android using phonegap, but works fine on iOS -

it works fine on ios. i have looked many answers including these 2: play sound on phonegap app android html5 audio not playing in phonegap app (possible use media?) i have tried of solutions: changing path /android_asset/www/ android using .ogg files pre load audio play() / pause(). using media plugin provided cordova/phonegap here current code: if(device.platform === "android") //different path android { url = "/android_asset/www/sound.ogg"; }else{ url = "sound.mp3"; } alert(url); sound = new media(url); sound.play(); anyone have ideas?? feels have been going round in circles i had similar , solution worked me complete path of application using window.location.pathname , way dont need worry device type, give complete path including index.html , using below function strip off index.html string , append media file. function getphonegappath() { var path = window.location.pathname; path = path.substr( path, pa

ios - CALayer in awakeFromNib vs drawRect -

i'm confused, why following code work if add awakefromnib or initwithframe: , doesn't work if add drawrect: or call directly? self.layer.cornerradius = cgrectgetwidth(self.bounds) / 2.0f; self.layer.shadowcolor = [uicolor blackcolor].cgcolor; self.layer.shadowradius = 3; self.layer.shadowoffset = cgsizemake(0.0f, 0.0f); self.layer.shadowopacity = 0.75f; for programatically created buttons, should add method to? button might created init , size changed later via constraints. specification : working, mean button rounded (circle if aspect ratio 1:1) drop shadow. not working, mean it'll remain square. check out detailed description in the apple docs , it's because you're setting layer configurations (cornerradius, shadow, etc.) in middle of draw cycle when should have completed before draw cycle began. from drawrect: documentation: by time method called, uikit has configured drawing environment appropriately view , can call whatever drawin

entity framework - Access value generated by trigger after save changes -

var school = new models.school(); schoolcommandtoschool.map(school, model); _schoolrepository.add(school); _unitofwork.savechanges(); school.code // null after insert generate school code inside trigger , store in code column. after save changes null. entity didn't know fetch data column if wrote data inside insert trigger? can explain what's happening? you can use changetracker, track changes in object. this: inside dbcontext class (not tested code): public override int savechanges() { //detect changes this.changetracker.detectchanges(); //get schools object, if exists //you can check if object being insert or updated // => i.state == entitystate.modified or entitystate.added var entries = this.changetracker.entries().where(i => i.entity.gettype() == typeof(school); if (entries.any()) { foreach (var entry in entries) { //do trigger job in entry object;

asp.net - MVC Package load (NuGet) -

after installing package nuget console (called bootstrap-table ), in packages.config can see package added cannot use it, nor htmlhelpers coming it. i tried reinstalling package, restarting vs2013 doesn't seem help. when run sample project simonray can see htmlhelpers, project doesn't use package precompilled dll. here screenshot nuget package manager, , mine projects: http://prntscr.com/75gjar any advice? in web.config in views folder, need add namespace. equivalent adding using statement in c#, add last line: <system.web.webpages.razor> <pages pagebasetype="system.web.mvc.webviewpage"> <namespaces> ... <add namespace="bootstraptable.web" /> note example project linked has line included here .

Do I really need web.xml for a Servlet based Java web application? -

i haven't been working on real world web projects. @ university used both servlets , spring java web development. in both projects given web.xml files configured , doing minor changes in them. need build web app scratch. created new servlet class in eclipse , didn't automatically create web.xml. googled, , read several resources web.xml not needed, reasoning put in couple of sentences, not sure if using annotations instead of web.xml no problem. glad if there no need configure web.xml, because haven't configured 1 myself , want focus more on business logic. thank in advance! you don't need web.xml file if have container supports latest j2ee specs. here link simple servlet example use annotation , here can find same spring mvc; post example here convenience public class mywebapplicationinitializer implements webapplicationinitializer { @override public void onstartup(servletcontext container) { servletregistration.dynamic registration

Android DatePicker shows unavailable months when using min/max limits -

Image
i've found 1 other instance of issue on stackoverflow unanswered (last year), figured i'd give shot. ( android datepicker/dialog displaying incorrect month/s using min/max date , actual image) when setting mindate , maxdate of android datepicker, it'll show months unavailable within range of min , max date. i'll demonstrate issue following images: when i'm @ mindate: when i'm in between date limits: when i'm @ maxdate: the unavailable months (in case april , june) act min , max values in situation, going april, datepicker shoot 15th of may, or trying slide june move datepicker 22th of may. is possible keep (unavailable) months hidden view, in testcase, selectable part date? keeping in mind that, interval between instance 29th of may , 5th of june, june has appear in list. option 1. use android-times-square and give in custom date range fades out unavailable dates, gives more visual representation too calendar nextyear = ca

asp.net - FormsAuthentication encrypt / decrypt -

i have 2 applications, 1 called www.domain.dk , m.domain.dk both of them has login function (identical), if login on m.domain.dk , goes www.domain.dk needs remember have logged in. and here comes problem.. www throws , error saying can't validate data cookie set m site, started debugging code , found out when www encrypting formsauthenticationticket, encrypted string 64 characters longer when m site it. the following part web.config identical both projects <machinekey validationkey="cf3d..." decryptionkey="a56..." validation="sha1" decryption="aes" /> <authentication mode="forms"> <forms name=".aspxauth" domain=".domain.dk" timeout="20" enablecrossappredirects="true" path="/" protection="all" cookieless="usecookies" /> </authentication> the following code login function var ticket = new formsauthenticationticket(1, user

What happened to Android 4.4.2 (API 19) Google APIs? -

Image
i opening older android project on new machine. attempting download android 4.4.2 (api 19) google apis, not listed. have regular sdk platform installed. see google api system images emulator, not actual google api itself. i see google apis in android 5.1.1 (api 22), apis older 4.4.2 (api 19). am missing something? if removed reason, should application targeting? i require google apis becuase app using google maps. edit: enabled obsolete listings, see if google apis obsolete reason, didn't show then, either. they there. available in 2 different flavors: google apis (x86 system image) , google apis (arm system image)

html - What are valid HTML5 custom tags? -

recently i've been reading how can make custom tags valid in html5 putting dash in name, i've been wondering actual rules / guidelines custom tags. custom-tag √ custom x -custom ? custom- ? what want know if last 2 valid. also, bonus, i'm kind of curious how custom attributes work.. far know: <div my-attribute="demo"> x <div data-my-attribute="demo"> √ <custom-tag my-attribute="demo"> √ <custom-tag data-my-attribute="demo"> √ but happens if i'm trying use existing global attributes, such title or class ? does css.. custom-tag.banana { color: yellow; } target html? <custom-tag class="banana"> test! </custom-tag> also, css should target above html whether or not global attributes work custom tags, correct? custom-tag[class=banana] { color: yellow; } finally, there rule/guideline stating should have " - " in name of cus

java - How to determine if a JRE is 32/64bit from folder structure/files -

i have jre folder on windows system. there way determine if jre 32-bit or 64-bit looking @ files within? to clarify, have multiple jre folders , want investigate each. this not duplicate of suggested duplicate. wish know arch jre designed for, not arch of machine installed on you can examine release file in java root directory, , @ os_arch. these contents on windows 8 machine; 64-bit 'amd64' while 32-bit 'i586'. 64 bit: java_version="1.8.0_31" os_name="windows" os_version="5.2" os_arch="amd64" source=" .:fde671d8b253 corba:f89b454638d8 deploy:6bb9afd737b2 hotspot:4206e725d584 hotspot/make/closed:3961887b77fc hotspot/src/closed:5b436b7ac70c hotspot/test/closed:63646d4ea987 install:b2307098361c jaxp:1dd828fd98f1 jaxws:9d0c737694ec jdk:1fbdd5d80d06 jdk/make/closed:ebe49cb8785a jdk/src/closed:ef076fdb2717 jdk/test/closed:ab9c14025197 langtools:7a34ec7bb1c8 nashorn:ec36fa3b35eb pubs:532faa86dd91 sponsors:477c

Append "@gmail.com" in EditText after pressing any key from user in android -

i thinking logic given below edittextusername.addtextchangedlistener(new textwatcher() { @override public void beforetextchanged(charsequence s, int start, int count, int after) { } @override public void ontextchanged(charsequence s, int start, int before, int count) { } @override public void aftertextchanged(editable s) { appendemail(edittextusername.gettext().tostring()); } }); void appendemail(string email){ if( email.length()>=1){ edittextusername.settext("@gmail.com"); } } this example code not actual code. throwing stackoverflow exception. can resolve isssue you need check if substring "@gmail.com" exists there no need settext again. because when set text edittext calls aftertextchange again, , call appendemail , sets text again etc. void appendemail(string email){ if(!textutils.isempty(email) && email.contains("@gm

Sending Array From Android To Server Side via Post Request -

good day.im sending post request php server side this httpclient client = new defaulthttpclient(); httppost post = new httppost("my server name"); multipartentity reqentity = new multipartentity( httpmultipartmode.browser_compatible); /*stringtokenizer tokens = new stringtokenizer(from.gettext().tostring(), "-"); string shortstring = tokens.nexttoken(); string longstring = tokens.nexttoken(); stringtokenizer tokens2 = new stringtokenizer(to.gettext().tostring(), "-"); string shortstringto = tokens2.nexttoken(); string longstringto = tokens2.nexttoken();*/ try { reqentity.addpart("type", new stringbody("3")); server side receives this array ( [type] => 3 ) all seems afar wants me send him array.i send this arraylist<string> array = new arraylist(); aray.add("hello"); reqentity.

javascript - Get custom HTML attribute value from controller -

i have added custom attribute ( cust-property ) html input control, <input name="myinputname" type="text" ng-model="mymodel" cust-property="my value"> now i'm trying value of custom defined attribute validation error object list for (var in $scope.form.$error.required) { var elementname = $scope.form.$error.required[i].$name; //var custompropertyvalue = $scope.form.$error.required[i].cust-property; } how can custom html attribute value controller? try this: var id = $scope.form.$error.required[i].attributes['cust-property'].value; but should try on directive.

javascript - Open Firefox web console be default when it start? -

i need use firefox web console lot , want every time open firefox, web console panel display automatically. have press ctrl + shift + k open it. is there way config firefox browser make work want? prefer native way (ie. changing configuration) rather having install plugins. need webconsole, don't need whole toolbox firebug or that. thank you!

jquery - Bootstrap 3 Selectbox - Clickable only on Arrow -

i using bootstrap selectbox. reason, have use selectpicker inside anchor tag , restrict clicking on entire button , should clickable on arrow? on clicking on dropdown arrow, list visible. other places have ignore click event. please check fiddle <a href="#"> <select class="selectpicker" data-live-search="true"> <option>mustard</option> <option>ketchup</option> <option>relish</option> <option>plain</option> <option>steamed</option> <option>toasted</option> </select> </a> $('.selectpicker').selectpicker(); you can try adding workaround!! demo here $('button.dropdown-toggle').on('click',function(e){ if($(e.target).attr('class')!="caret") { e.stoppropagation(); } });

"could not find class com.google.android.gms.maps.Supportmapfragment" google map api android in Eclipse -

Image
hi want add google map api on app. there a could not find class com.google.android.gms.maps.supportmapfragment error , cant find solution. skimed other questions stackoverflow. not correct solution problem. here codes: map.java import com.google.android.gms.maps.googlemap; import com.google.android.gms.maps.supportmapfragment; import com.google.android.gms.maps.model.latlng; import com.google.android.gms.maps.model.markeroptions; public class map extends fragmentactivity { private googlemap googleharita; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.map); if (googleharita == null) { googleharita = ((supportmapfragment) getsupportfragmentmanager().findfragmentbyid(r.id.haritafragment)) .getmap(); if (googleharita != null) { //İstanbul, kız kulesi olsun. latlng istanbulkoordinat = new latlng(41.021161,29.004

C, free function acts weirdly. why? -

i wrote code generic lists. among functions, has freelist, createlist , copylist. while freeing list created createlist function works fine, when trying free list created copylist function program crashes, checked values when debugging , still see no reason happen. i've got: void listdestroy(list list) { if(list==null) return; listclear(list); free(list); //<-crashes here when freeing copied lists. list=null; return; } int main() { list list = listcreate(copystring,freestring); list copied = listcopy(list); listdestroy(list); listdestroy(copied); printf("success"); return 0; } list listcreate(copylistelement copyelement, freelistelement freeelement) { if(!copyelement || !freeelement) return null; list newlist=malloc(sizeof(*newlist)); if(newlist==null) return null; newlist->copy = copyelement; newlist->free= freeelement; newlist->nodes=null; newlist->iterator=null; return n

How to retrieve and view data from a SQL Server using sqljdbc library in Android? -

i having troubles in "how to's" of connecting prepoppulated database being used our asp.net application. so, problem have used sqljdbc4.jar library try connect database , during exceptions , cant seem find solution it. appreciate if correct code or give me regarding it. cant seem find solution anywhere. below code calling in oncreate block in mainactivity in getting os.networkonmainthreadexception public void testdb() { textview tv = (textview) this.findviewbyid(r.id.text_view); // create variable connection string. string connectionurl = "jdbc:sqlserver://localhost:1433;" + "databasename=cafeapp;user=sunny;password="; string result = "database connection success\n"; // declare jdbc objects. connection con = null; statement stmt = null; resultset rs = null; resultsetmetadata rsmd; try { // establish connection. class.forname("com.microsoft.sqlserver.jdbc.sqlserverdriver"); con = driverm

swift - bannerViewDidLoadAd is not called -

iad delegate never calls, although set in viewwillappear. in appdelegate var uiiad: adbannerview = adbannerview() in viewcontroller var uiiad: adbannerview = adbannerview() func appdelegate() -> appdelegate { return uiapplication.sharedapplication().delegate as! appdelegate } override func viewwillappear(animated: bool) { var sh = uiscreen.mainscreen().bounds.height uiiad.delegate = self uiiad = self.appdelegate().uiiad uiiad.frame = cgrectmake(0, sh - 50, 0, 0) self.view.addsubview(uiiad) } func bannerviewdidloadad(banner: adbannerview!) { uiview.beginanimations(nil, context: nil) uiview.setanimationduration(10) uiiad.alpha = 0.5 println("hello") uiview.commitanimations() } the funny think adbanner show test advertising. udp: did understand wrong. display iad, need set self.candisplaybannerads = true , thats it. don't have access delegates of banned created. it appears instantiate uiiad propert

assembly - Faulty compilation of string constant in ASM -

i'm writing program hashes of function-names in asm. the function fetch string constants following: get_strings: call get_curr_addr pop esi add esi, 9 jmp str_return db "loadlibrarya" db 0x00 this produces following string constant in bytecode (xxd output): ... 00000040: 2424 61c3 e8bc ffff ff5e 83c6 09eb 7d4c $$a......^....}l 00000050: 6f61 644c 6962 7261 7279 4100 .... .... oadlibrarya. ollydbg interprets as: ascii "dlibrarya",0 when change code following: get_strings: call get_curr_addr pop esi add esi, 9 jmp str_return db "jibberish" db 0x00 db "loadlibrarya" db 0x00 the compilation done "right" (the way expect be). xxd output: ... 00000050: 0000 4a69 6262 6572 6973 6800 4c6f 6164 ..jibberish.load 00000060: 4c69 6272 6172 7941 00.. .... .... .... librarya. and there's no 7d byte anymore in front of loadlibrarya string lit

java - JSOUP extract an absolute URL in Android -

i've been looking everywhere. tried lot of "solutions" none of 'em helped. need extract url address of sub-website html code. code contains lot of url's need shorten result list somehow leaves links need. details: <li class="container results-list-item clear-me "> <div class="job-offer-content container h-card"> <div class="position-head container"> <div class="container "> <h2 class="p-job-title"> <a href="/praca/android-developer-junior-senior/wroclaw/11636002" rel="nofollow" title="praca android developer (junior/senior) dolnośląskie" class="job-offer "> <strong class="keyword">android</strong> <strong class="keyword">developer</strong>

android - How do I access Google Fit user goals in Google Play Services? -

i'm showing daily user step data , activity time in android app using play services. got api setup ok , working fine, i'd read user's goals (the one's set in google fit profile) daily steps , activity time can show achieved percentage. how achieve this? cannot find of apis in com.google.android.gms.fitness.* offering this. thanks, michael the latest changes in android play-services (9.8.0) supposed make possible. 1.add fitness.goals_api googleapiclient googleapiclient = new googleapiclient.builder(crossoverwatchfaceservice.this) .addconnectioncallbacks([...]) .addapi(fitness.history_api) .addapi(fitness.goals_api) .usedefaultaccount() .build(); googleapiclient.connect(); 2.retrieve goal(s) pendingresult<goalsresult> pendingresult = fitness.goalsapi.readcurrentgoals( googleapiclient, new goalsreadrequest.builder()

javascript - How to select injected HTML's li and keep it hidden -

how can keep li iconsrc="/_layouts/15/images/delitem.gif" image hidden div injected first party , third party trying hide it. $("<style> go here ???? { display: none; }</style>").appendto(document.documentelement); how can select list item iconsrc="/_layouts/15/images/delitem.gif" document. <div class="ms-core-menu-box ms-core-menu-hasicons ms-core-defaultfont ms-shadow" title="" dir="ltr" contenteditable="false" style="top: 0px; position: absolute; visibility: visible; left: -129px; width: 127px;" flipped="false"> <ul class="ms-core-menu-list"> <li type="option" text="delete" onmenuclick="spgridcontainer_wpq2_rowcontextmenu_onclick(0);" iconsrc="/_layouts/15/images/delitem.gif" iconalttext="delete" enabled="true" checked="undefined" id="mp43_0_0" class=&qu

sql server - Preventing SQL injection in a report generator with custom formulas -

for customers, building custom report generator, can create own reports. the concept this: in control table, fill in content of report columns. each column can either consist of data different data sources (=tables), or of formula. here reduced sample how looks: column | source | year | account | formula ---------------------------------------------- col1 | tab1 | 2015 | sales | (null) col2 | tab2 | 2014 | sales | (null) col3 | formula | (null) | (null) | ([col2]-[col1]) so col1 , col2 data tables tab1 , tab2, , col3 calculates difference. a stored procedure creates dynamic sql, , delivers report data. resulting sql query looks this: select (select sum(val) tab1 year=2015 , account='sales') col1, (select sum(val) tab2 year=2014 , account='sales') col2, ( (select sum(val) tab1 year=2015 , account='sales') - (select sum(val) tab2 year=2014 , account='sales') ) col3 ; in real

python - Pandas plotting: ValueError: ordinal should be >= 1 -

i have following series, called sr . in [1]: sr out[1]: 0 0 1 0 2 0 3 0 4 0 5 1 6 2 7 4 8 7 9 4 10 3 11 2 12 1 13 2 14 2 15 2 16 4 17 7 18 7 19 5 20 3 21 2 22 1 23 1 dtype: int64 i plot series, rolling mean. this, use following code: import matplotlib.pyplot plt import pandas pd rolling = pd.rolling_mean(sr, 3, center=true) ax_delays = sr.plot(style='--', color='b') rolling.plot(color='b', ax=ax_delays, legend=0) plt.title('title') plt.ylim(ymax=10) plt.show() but gives me following error: valueerror traceback (most recent call last) 1 rolling = pd.rolling_mean(sr, 3, center=true) ----> 2 ax_delays = sr.plot(style='--', col

java - SSL in Tomcat 8: server & client JKS + client public cer -

i've followed guide setup tomcat 8 instance ssl layer, producing client , server keystores , public client certificate autosigned. the issue is, guess, don't know how configure tomcat's connector... here current server.xml file (removed unnecessary comments): <?xml version='1.0' encoding='utf-8'?> <server port="8005" shutdown="shutdown"> <listener classname="org.apache.catalina.startup.versionloggerlistener"/> <listener sslengine="on" classname="org.apache.catalina.core.aprlifecyclelistener"/> <listener classname="org.apache.catalina.core.jrememoryleakpreventionlistener"/> <listener classname="org.apache.catalina.mbeans.globalresourceslifecyclelistener"/> <listener classname="org.apache.catalina.core.threadlocalleakpreventionlistener"/> <globalnamingresources> <resource auth="container"

javascript - Gmaps4rails Gem show 2 markers for same address -

Image
i trying implement gmaps4rails gem , geocoder gem , works fine. thing @ index.html.erb page, list boats , show map can not show more 1 marker if have more 1 same address. show like; here locations_controller ; def index if params[:search].present? @locations = location.near(params[:search], 5) #kac mile cevresinde aranıldıgının bilgisi bu km ile değişebilir else @locations = location.all end @hash = gmaps4rails.build_markers(@locations) |location, marker| marker.lat location.latitude marker.lng location.longitude marker.infowindow render_to_string(:partial => "/locations/my_template", :locals => { :object => location}) end end this index.html.erb ; <script src="//maps.google.com/maps/api/js?v=3.13&amp;sensor=false&amp;libraries=geometry" type="text/javascript"></script> <script src='//google-maps-utility-library-v3.googlecode.com/svn/tags/ma

rest - Not able to get csrf token with spring security 3.2.7 -

i using spring security 3.2.7 spring boot 1.2.3. building rest application , implementing spring security java config in csrf on default , know can disable in overridden configure method "http.csrf().disable()". suppose don't want disable it, need csrf token. when hit url localhost:8080/myproject/url with post request gives { "timestamp": 1431682924618, "status": 403, "error": "forbidden", "message": "expected csrf token not found. has session expired?", "path": "/myproject/user" } so how can hit same url successful result without disabling csrf. my securityconfig file is: @configuration @enablewebsecurity public class securityconfig extends websecurityconfigureradapter { @autowired private datasource datasource; @autowired private customuserdetailsservice customuserdetailsservice; @autowired public void configureglobal(authenticat

realm - Can't watch realmObjects in debug (Android Studio) -

i started using realm. problem have use dubug mode solve bugs. thing realmobjects appear have null fields in watch. on other hand, if log values, appear correct , not null. what going on here? check field not lazy. lazy objects loaded when retrieved.

android - Custom Listener on Button click in ListView Item -

i have created custom listener interface button click in adapter class, followed tutorial : http://www.c-sharpcorner.com/uploadfile/9e8439/create-custom-listener-on-button-in-listitem-listview-in-a/ adapter: holder.btnqtyincrease.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { if (customlistner != null) { customlistner.onbuttonclicklistner(position); } cart = cartarraylist.get(position); holder.textviewquantity.settag(cart); if(cart.getquantity() == 9) { toast.maketext(context, "already reached", toast.length_long).show(); return ; } else { cart.setquantity(cart.getquantity() + 1); holder.textviewquantity

r - Save gvis Object as png image -

i wanted save gvis object .png file gauge <- gvisgauge(citypopularity, options=list(min=0, max=800, greenfrom=500, greento=800, yellowfrom=300, yellowto=500, redfrom=0, redto=300, width=400, height=300)) plot(gauge) print(gauge, tag="chart", file="gauge.html") i can save them .html file - need them saved .png file. how can save charts produced googlevis image ( .png ). wanted inside r.

javascript - Resolves propagating up multiple calling async functions -

i've been trying reject s of asynchronous functions bubble callers, it's not working reason. here's tested example code: "use strict"; class test { constructor() { this.do1(); } async do1() { try { this.do2(); } catch(reason) { console.error(reason); } } async do2() { for(let = 0; < 10; i++) { await this.do3(); console.log(`completed ${i}`); } console.log("finished do1"); } async do3() { return new promise((resolve, reject) => { settimeout(() => { if(math.random() < 0.3) reject('###rejected'); else resolve("###success"); }, 1000); }); } } export default test; chrome gives me every time: unhandled promise rejection ###rejected . any idea why happening? i'd able handle thrown errors higher level do2() (the above example works fine if try/catch in do2() , wraps await this.do3(); ). t