Posts

Showing posts from August, 2015

SQL Server: Is it possible to pin a query to the toolbar? -

i run query , wondering if it's possible pin query menu bar or toolbars of sql server easy access? or have alternate solution use? edit: using microsoft sql server 2012 create custom template , can access template explorer in ssms to create custom template in template explorer, navigate node store new template. right-click node, point new, , click template. type name new template , press enter. right-click new template, , click edit. in connect database engine dialog box, click connect open new template in query editor. create script in query editor. insert parameters in script in format . data type , value areas must present, can blank. on toolbar, click save save new template. https://technet.microsoft.com/en-us/library/ms179334(v=sql.105).aspx

javascript - Using jQuery input event to conditionally update a <td> innerHTML -

i'd @ least me complicated. i have in larger table: <table><tr> <td class="editc" id="comments:942" onchange="timeline();" onclick="empty('comments:942');" title="click edit..."> second test of new comment behavior </td></tr></table> here going on: 1) class="editc" = use editable edit , write db. 2) id="comments:942" = id value 3) onchange="timeline();" = timeline() function gets information db , puts second html table on screen. works.. no worries. 4) onclick="empty('comments:942')" = empty function empty field not update db. want clean input field enter new data in place of existing data. what i'd happen this. a) if typed empty field, good, save.php code save db. works great. b) if nothing typed empty field, want old value put in place without updating db. in head equivalent first having cut current value pasting ...

html - Outlook 2010 Anchor (url/address/link) -

i'm trying link specific pdf page msoutlook'10 or msword'10, #page=... anchor particularly useful , works fine elsewhere. unfortunately when click [ctr-k] in outlook or winword, links re-formatted assuming unc path. pdf file located on shared drive. using "file:" prefix links open pdf in adobe reader (outside of browser), , "http:" open inside browser. issue seem need open in browser "file:" prefix in order anchor work. know anchors work inside browser. outlook uses windows/explorer default program (based on file extension) seems open in adobe reader neglecting anchor. is aware of solution, link specific page or bookmark of shared-pdf ms outlook and/or winword link? common references: mailermailer.com/...anchor-tags-html-emails campaignmonitor.com/...anchor-links-in-email-newsletters/ stackoverflow.com/...anchor-in-pdf-document

jquery - Slider Widget moveTo, changed into value but gives NaN -

i got following problem my sliders works not nice anymore , gives errors. because of updates jquery , other things. i got slider on website (sorry no images yet). got slider , next prev buttons. when click on slider or buttons nice slide comes in front. this done following code in old way: initpl_slider = function() { var steps = math.ceil(parseint(pl.total)/parseint(view[pl.view][0]))-1; var contentwidth = (parseint($("#pl_content").innerwidth())+100); $("#pl_slider").slider({ min: 0, max: (steps*parseint(view[pl.view][0])), handle: ".pl_handle", step: parseint(view[pl.view][0]), change: function(event, ui){ var dir = ""; if(ui.value > pl.limitstart) dir = "-"; pl.limitstart = ui.value; $("#pl_content").animate({ left: dir+contentwidth+"px", opacity: 0 }, 250...

ruby - Namespaced model in Rails generating NameError: uninitialized constant -

i have folder structure this: app/ models/ bar/ foo.rb connection.rb foo.rb connection.rb "abstract class" connecting database, so: class bar::connection < activerecord::base self.abstract_class = true establish_connection "outsidedb_#{rails.env}" end bar/foo.rb accessing foos table outsidedb , so: class bar::foo < bar::connection end and foo.rb accessing foos table app's db, so: class foo < activerecord::base end from rails console if foo.first or bar::foo.first things behave expect in first entry foos table of app db , external db, respectively. however, if try access foo within bar/foo.rb following: class bar::foo < bar::connection def self.test bar::foo.first #=> works foo.first #=> nameerror: uninitialized constant bar::foo::foo end def self.other_test foo.parent #=> object foo.superclass #=> activerecord::bas...

c++ - Qt Speed Gauge to Accept and display an input number -

i new qt. hardware guy. wanted use qt displaying benchmark results of code (execution time) demo. thought more presentable if displayed in visually appealing manner. i came across example implementation of speed gauge in qt @ link: https://github.com/berrima/qt-custom-gauge-widget/tree/master/examples/speedgauge i want display number (say 900) on speed gauge , can done setting value of needle. want needle gradually increase , stop @ 900. can please give me idea how proceed on new , have limited time. any appreciated. in advance.

Idle and Pandas-Python -

i trying launch code have found ipython notebook (i add code :interactive(true)...) , problem when use "run module" idle launches "data.plot" loads , nothing happens. data.plot doesn't seem work. thanks if have idea. note: without "interactive(true)" box show "runtime error" import pandas pd import matplotlib.pyplot plt matplotlib import interactive interactive(true) # read data dataframe data = pd.read_csv('http://www-bcf.usc.edu/~gareth/isl/advertising.csv', index_col=0) print(data.head()) # print shape of dataframe print data.shape # visualize relationship between features , response using scatterplots fig, axs = plt.subplots(1, 3, sharey=true) data.plot(kind='scatter', x='tv', y='sales', ax=axs[0], figsize=(16, 8)) data.plot(kind='scatter', x='radio', y='sales', ax=axs[1]) data.plot(kind='scatter', x='newspaper', y='sales', ax=axs[2]) tr...

java - JAX-WS client get response headers -

i'am trying implement logic. http 401 or 403 error after making call wcf service using jax-ws client (wsimport). com.sun.xml.ws.client.clienttransportexception: server sent http status code 401: unauthorized how can response headers after making call? need implement soaphandler.class ? i find solution : (integer) ((bindingprovider) servclient).getresponsecontext().get(messagecontext.http_response_code);

ios - Access the same variable before and after value changes in different classes - Swift -

Image
i've stucked on simple concept(i guess), have 2 viewcontrollers on storyboard have 2 classes, viewcontroller , viewcontroller2: i have label whit default value (0), , when click on button want change value variable 10, , click on button "show" , print variable, i'm changing label , printing new value. the real problem when want new variable value view, after change value if try print variable on second view variable return de default value(0) viewcontroller import uikit class viewcontroller: uiviewcontroller { var variable = "0" @iboutlet var defaultlabel: uilabel! @iboutlet var label1label: uilabel! @ibaction func setvalue(sender: anyobject) { setvalue() } @ibaction func getvalue(sender: anyobject) { getvalue() } override func viewdidload() { super.viewdidload() } func setvalue(){ variable = "10" defaultlabel.text = variable } func getvalue(){ print(variable) } override func didreceivememorywarning() {...

big o - Big O complexity with n^2 log(n) -

two questions: first, if f(n) = n(3n + nlog(n)) why f(n) Ω(n 2 )? second, why n 2 log(n) not o(n 2 )? these both consequences of fact log(n) tends infinity n tends infinity. 1) n(3n + nlog(n)) omega(n^2) because large n 3n negligible , n^2log(n) bounded below n^2 2) n^2log(n) not o(n^2) since, constant k > 0, n > e^k have n^2log(n) > kn^2, no k satisfies n^2log(n) < kn^2 finitely many n.

testing - How do I properly write out a JUnit test for a method that counts how many e's are in a string? -

here method have defined supposed accept string input , should return number of times char 'e' occurs int: public int count_e(string input){ int count = 0; (int = 0;i<input.length();i++){ char e = 'e'; if (input.charat(i)==e){ count=count+1; i++; return count; } else{ count=count+1; i++; } } return count; } } i trying write junit test see if can input string method , return correct number of e's. below test, , @ moment keep getting error saying method count_e undefined type string. can tell me why coming undefined? @test public void testcount_e() { string input= "isabelle"; int expected= 2; int actual=input.count_e(); asserttrue("there many e's in string.",expected==actual); } } you failed pass anything count_e method! how like: @test public void testcount_e() { string input ...

How to deal with multiple date string formats in a python series -

i have csv file trying complete operations on. have created dataframe 1 column titled "start_date" has date of warranty start. problem have encountered format of date not consistent. know number of days passed today's calendar date , date warranty started product. two examples of entries in start_date series: 9/11/15 9/11/15 0:00 how can identify each of these formats , treat them accordingly? unfortunately have try each format might be. if give example format, strptime attempt parse discussed here . the code end looking like: import datetime possible_formats = ['%m/%d/%y', '%y/%m/%d', etc...] # formats date might in format in possible_formats : try: parsed_date = datetime.strptime(raw_string_date, format) # try date break # if correct format, don't test other formats except valueerror: pass # if incorrect format, keep trying other formats

javascript - Variable won't update out of function -

something going wrong code, title implies. this code matching game, separate document 2 (nodes) , generate smiley faces randomly on 1 side, clone other side. remove last child(face) on rhs user has click on smiley on lhs of page next level, @ point 5 smileys added increase difficulty. user supposed click on smiley left pass next level. everything works except adding of smileys. problem when goes next level, resets number of faces 5(or whatever number set below same commented text) reason! <!doctype html> <html> <head> <style> img {position:absolute;} /*here tried use 500px in style rules div division noticeably off centre, therefore, used 50% instead*/ div {position:absolute; width:50%; height:50%} #rightside {left:50%; border-left: 1px solid black} </style> </head> <body onload="generatefaces()"> <h1 id="titleofgame">matching game!</h1> <p id="int...

Trouble converting html layout from table to divs & css -

i have old web application i'm trying update. in original design html tables used extensively layout both non-tabular , tabular data. i'm trying "modernize" app removing html table layout , replacing divs , css. below example of small amount of information in table , i've converted divs , css. problem css not generic extending level of entire app doesn't seem practicle. unfortunately, can't think of better way lay out. i'm looking ideas of better way perform type of layout using divs , css. this small page i've converted. have other screens of app have similar layouts larger amounts of data , i'd suggestion of approach laying out. i'm not looking rewrite code. need fresh idea doesn't require 4 lines of css every cell of old table layout. <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xh...

html - Javascript - How to get attribute value from a tag, inside a specific div class? -

snippet of html code need retrieve values from: <div class="elgg-foot"> <input type="hidden" value="41" name="guid"> <input class="elgg-button elgg-button-submit" type="submit" value="save"> </div> i need value 41, simple enough with: var x = document.getelementsbytagname("input")[0]; var y = x.attributes[1].value; however need make sure i'm retrieving values inside "elgg-foot", because there multiple div classes in html code. i can class this: var = document.getelementsbyclassname("elgg-foot")[0]; and tried combine in various ways var x , don't know syntax/logic it. example: var full = a.getelementsbytagname("input")[0]; so: retrieve value 41 inside unique class elg-foot. i spent hours googling this, couldn't find solution (partly because don't know search for) edit: answers everyone, seem work. had working...

javascript - Pure js add and remove (toggle) class after scrolling x amount? -

i don't want use jquery this. it's simple, want add class after scrolling past amount of pixels (lets 10px) , remove if ever go top 10 pixels. my best attempt was: var scrollpos = window.pageyoffset; var header = document.getelementbyid("header"); function add_class_on_scroll() { header.classlist.add("fade-in"); } function remove_class_on_scroll() { header.classlist.remove("fade-in"); } window.addeventlistener('scroll', function(){ if(scrollpos > 10){ add_class_on_scroll(); } else { remove_class_on_scroll(); } console.log(scrollpos); }); but console shows number continues grow regardless of scrolling or down. , class fade-in never gets added, though console shows past 10. you forgot change offset value in scroll handler. //use window.scrolly var scrollpos = window.scrolly; var header = document.getelementbyid("header"); function add_class_on_scroll() { ...

ssl - How to import _ssl in python 2.7.6? -

my http server based on basehttpserver python 2.7.6. want support ssl transportation, called https. i have installed pyopenssl , recompiled python source code ssl support. , work when try import ssl in python interpreter, doesn't work when run code on server. error log this: import _ssl # if can't import it, let error propagate it looks quite strange, doesn't it? operating system debian linux distribution. have tried kinds of ways can find on internet days, can me out of trouble? i tried "import _ssl" in server code directly, reminds me this: >>>callstack traceback (most recent call last): file "./script/main.py", line 85, in process net_flag = net_api_process() file "./script/core/netbase/interface.py", line 96, in net_api_process flag1 = network.instance().process() file "./script/core/netbase/network.py", line 271, in process if network.process(max_events): file "./script/core/...

java - AndroidStudio emulator "won't run unless you update Google Play Services" -

Image
i have problem emulator, i'm using api 5.1.1 , have lastest version of google play services sdk manager. androidmanifest.xml: <uses-permission android:name="android.permission.access_fine_location" /> in build.grable: compile 'com.google.android.gms:play-services:+' navigate settings--> apps in emulator , find google play services, check version number , use in build.gradle hope helps

php - JOINS vs. Group_Concat() - multiple one to many relationships -

i have table posts has 1 many relationship multiple tables ( files , categories in simplified example below). posts has many fields returns each row. if returning 1000 rows of posts , have 4 files , 3 categories per post, 12000 records in result set (duplicating post info in order give me file info). grows , grows each 1 many relationship. below shows on simplified version of current join , contemplated group_concat() version. group_concat method simplify php handling tremendously. comments on performance of these 2 methods? update realize main concern join method not php code, server memory (& cpu resources?) consumed processing larger result set. each row can have significant amount of data since have type text field. using joins select p.postid, title, fileid, filename, category posts p left join files f on f.postid = p.postid left join categories c on c.postid = p.postid using group_concat() select p.postid, title, ( select group_concat( ...

Access HTTP Headers while loading the AngularJS Application -

i working on new application using angualarjs framework. user authentication, using cleartrust authentication validating user credentials. once application url accessed navigates clear trust login page , when clicks on login button validate user , once it’s valid user navigates start page “index.html” clear trust passes http headers contains user information’s userid, email, working location, etc. question is, when app.js file loaded how can access http header app.js file? require http header while loading application. me how access http headers? example scenario is, using facebook login application authenticate user. while accessing url (mysite.com/index.html) should navigate facebook login , allow user login his/her credentials. once validated redirected index.html (which startup page app in mysite.com). here in app.js need access user name, user display name, country, etc (say user information details) header.

shell - Bash: check if a relative path exists -

i writing shell script takes in directory argument. need check if directory exists before else. directory can absolute or relative. know can check existence of absolute directory (say, /users/keith/documents/testfolder) using if [ -d "$1"]; # if absolute directory exists fi however, if working directory /users/keith/documents/ , call script , pass "testfolder", test in if statement evaluate false, though testfolder exists within current working directory. i have tried converting directory absolute directory using abs_path=`cd "$1"; pwd` and testing existence of absolute path using if statement above. works fine (recognizes "testfolder" exists if that's pass argument) provided directory passed script indeed exist, if doesn't fails. what need way determine whether directory passed argument exists, regardless of whether passed absolute directory or 1 relative user's current working directory, , cannot fail if direc...

python - pip error: Bad interpreter when trying to run 'pip install ...' on OS X -

i trying install fresh version of virtualenv (there problem path python has stored in sys.executable) , turns out there problem seems related. when try run pip install virtualenv , output: -bash: /usr/local/cellar/python/2.7.10_2/bin/pip: /usr/local/opt/python3/bin/python3.4: bad interpreter: no such file or directory now original point in reinstalling virtualenv keep getting error when run virtualenv venv traceback (most recent call last): file "/library/python/2.7/site-packages/virtualenv.py", line 2363, in <module> main() file "/library/python/2.7/site-packages/virtualenv.py", line 832, in main symlink=options.symlink) file "/library/python/2.7/site-packages/virtualenv.py", line 994, in create_environment site_packages=site_packages, clear=clear, symlink=symlink)) file "/library/python/2.7/site-packages/virtualenv.py", line 1288, in install_python shutil.copyfile(executable, py_executable) file ...

python - How to see all url's loaded using urllib -

what trying open url so: req = urllib2.request('http://www.google.com') response = urllib2.urlopen(req) but want able see every background url loaded before getting http://www.google.com (like js files , images). or better if capture ones text in url.

Is there a way to parallelize a bash for loop? -

i have simple script pulls smart data series of hard drives , writes timestamped log file later logged , parsed relevant data. filename="filename$( date '+%y_%m_%d_%h%m' ).txt" in {a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p} smartctl -a /dev/sd$i >> /path/to/location/$filename done since takes several seconds run, find way parallelize it. i've tried appending '&' end of single line in loop, causes text file written haphazardly sections finish rather sequentially , in readable manner. there way fork seperate processes each drive pipe output orderly text file? also, assume setting filename variable have moved loop in order forks able access it. causes issue if script runs long enough roll on new minute (or two) , script becomes sequentially datestamped fragments rather 1 contiguous file. with gnu parallel this: parallel -k 'smartctl -a /dev/{}' ::: b c d e f g h j k l m n o p > path/to/output the -k option keeps output in...

uiscrollview - Is there any way that i can see PhotoScroller in Swift? -

apple has released many great tutorial @ wwdc 2010.so,i want learn photoscroller 1 of them included photo scrolling zoom feature.but of code in objc.so,is there way can learn in swift? here link photoscroller : https://developer.apple.com/library/ios/samplecode/photoscroller/introduction/intro.html any code or example same appreciated.thank you. you can find swift version of photoscroller app @ following link: https://github.com/villyg/photoslideshow-swift

c# - The correct way to permanently set properties on a ServicePoint -

i turn off nagle algorithm on specific connection (in case - elasticsearch server). my code looks this: servicepointmanager.findservicepoint(new uri(uriwithoutlocalpath)).usenaglealgorithm = false; the problem servicepoint object being recycled after while, causes lose setting. therefore, can't run code once, @ system startup. seem have several options in front of me: globally turn off nagle algorithm (hence, affecting connections don't want affect). increase maxservicepointidletime , servicepoint never recycled (probably bad idea? intuition tells me so). set sort of timer resets properties every n seconds n smaller recycling time servicepoint . reset properties every time use connection. i don't of these options, either affect other things in system, or seem complex want (like timer option). seems me there should simple solution this. ideas?

why this c++ code gives such output? -

#include<bits/stdc++.h> using namespace std; string str ; string str ; int main(){ for(int i=0;i<6;i++) /// 012345 str[i] = + '0' ; for(int j=0;j<6;j++) /// abcdef str[j] = j + 'a' ; cout << str << " " << str << endl ; /// blank line !!! printf("%s\n",str.c_str()); /// abcdef printf("%s\n",str.c_str()); /// abcdef return 0; } output :: abcdef abcdef i expect :: 012345 abcdef 012345 abcdef you have undefined behavior ! the strings declare empty , , indexing of them out of bounds. instead should append characters string, either using append member function or += operator .

ios - How to convert date which is having String type to NSDate? -

this question has answer here: how convert string nsdate? 1 answer i developing ios app using swift. accessing data server , returning data in json format. in having field 'expirydate' getting json , converted string follows: var validitydate = offerelements[indexpath.row]["enddate"].stringvalue it returning date of following format: 2015-08-24t00:00:00.000z i wanna convert mm/dd/yyyy, how can ? your suggestions welcome. thank in advance. this should work minimal or no changes func datefromstring(datestring: string) -> nsdate { let dateformatter = nsdateformatter() dateformatter.dateformat = "yyyy-mm-dd't'hh:mm:ss.sssz" return dateformatter.datefromstring(datestring)! }

mysql - Are polymorphic relationships bad practice? -

i'm using laravel , have run need have polymorphic relationships. seem solve need, being able store different data based on type, in nutshell. however, i'm aware not able use constraints, foreign keys. , i've read around they're anti-pattern. wondering others think it, , if using them without issues. otherwise, there alternative way accomplish polymorphic relationships provide, without using them? (using laravel) polymorphic relations anti-pattern , breaks best practices principles per mjolnic comment. having said this, never store json in blob or text column? wordpress not store data serialized in mysql? in real-world, (outside of university), there many scenarios idea break rules. depending on specific use-case, may appropriate break them. simple blog example. have posts, have pages. both need same table format. benefits gained polymorphic relations far outweigh effort put normalising , development , maintenance when splitting content posts , p...

jasper reports - Jaspersoft ireport How to rename the ireport name not field -

i want change name of jasper report "test report detail " >"test reagent detail" right click on report left panel , click "properties" the first column report name, can click on icon "..." , open report name can edited. use "save as" option save renamed report if necessary.

javascript - Table child rows to be sorted with parent row -

<script> $(document).ready(function() { $("#123").tablesorter(); } ); $(document).ready(function() { $("#123").tablesorter( {sortlist: [[0,0], [1,0]]} ); } ); </script> this script. want child rows of table sorted when sort parent rows.

mongodb - unexpected mongo exit code 100 with meteor on windows -

i keep getting error message when run "meteor" on cmd on windows. unexpected mongo exit code 100. restarting. unexpected mongo exit code 100. restarting. unexpected mongo exit code 100. restarting. can't start mongo server. mongodb had unspecified uncaught expection. can caused mongodb being unable write local database. check have permissions write .meteor/local. mongodb not support filesystems nfs not allow file locking. this happens right after downloaded meteor , created first project. tried resetting project. saw people recommend removing lock file in db folder. however, when check .meteor/local/db , empty. try reset meteor. -meteor reset -meteor update meteor. -meteor update --release 1.4.0.1 your username problem. in case, works fine when moved project's folder other user's folder.

php regex operation for url and # value detection -

this question has answer here: extract urls text in php 11 answers i want make url occurrence in text string link. when tried preg_match($reg_exurl, $text, $url) echo preg_replace($reg_exurl1, '<a href="'.$url[0].'" rel="nofollow">'.$url[0].'</a>', $text); it has replaced first match url @ places. also following regex expression not able detect url ar starting www. $reg_exurl1 = "/(http|https|ftp|ftps)\:\/\/[a-za-z0-9\-\.]+\.[a-za-z]{2,3}(\/\s*)?/"; $text = "the text want filter goes here. http://www.google.com data in http://www.apple.com"; if( preg_match($reg_exurl, $text, $url)){ echo preg_replace($reg_exurl1, '<a href="'.$url[0].'" rel="nofollow">'.$url[0].'</a>', $text); // if no urls in text return text }else { ...

Cycling text animation css -

i want make text cycling effect list of text this i've tried far: html <ul class="descslider"> <li id="first"> <h3>batik</h3> <p class="lead">color</p> <hr> <p class="desc">description 1</p> </li> <li id="second"> <h3>batik</h3> <p class="lead">design</p> <hr> <p class="desc">description 2</p> </li> <li id="third"> <h3>batik</h3> <p class="lead">theme</p> <hr> <p class="desc">description 3</p> </li> </ul> css .descslider{ text-align: center; position: relative; height: 200px; overflow: hidden; margin: 0; padding: 0; } .descslider li{ width: 100%; list-style-type: n...

css - Foundation with SASS, compiled with gulp only importing one component -

here current (the relevant portion) gulpfile: gulp.task('styles', function() { return gulp.src('app/stylesheets/main.scss') .pipe(plumber()) .pipe(sass()) .pipe(autoprefixer()) .pipe(gulpif(production, cssmin())) .pipe(gulp.dest('public/css')) .pipe(livereload()); }); with following main.scss: @import "normalize"; @import "foundation"; here's folder structure of app/stylesheets folder: -- app -- stylesheets ---foundation.scss |-normalize.scss |-main.scss |-foundation-------_functions.scss |-_settings.scss |-_components/ the resulting main.css file after gulp processing ends containing normalize.scss styles , looks _tables.scss , _visibility.scss components. i have tried using includepaths gulp-sass , didn't compile @ all. also, importing css r...

ios - Issue while setting HTTP header through AFNetwokring -

problem: - (void) getreportsummarywithcompletionblock:(void (^)(bool success))success { nsstring *storedtoken = [[user shareduser] accesstoken]; nslog(@"stored class: %@",[storedtoken class]); //logs -- __nscfstring nsstring *constanttoken = @"e5c47aa3-c168-480b-a10c-1c4379096fbf"; nslog(@"constant class: %@",[constanttoken class]); //logs -- __nscfconstantstring [self.manager.requestserializer setvalue:constanttoken forhttpheaderfield:@"authorization"]; //[self.manager.requestserializer setvalue:storedtoken forhttpheaderfield:@"authorization"]; [self.manager get:someurlstring parameters:nil success:^(afhttprequestoperation *operation, id responseobject) { nslog(@"%@",responseobject); success(yes); } failure:^(afhttprequestoperation *operation, nserror *error) { success(no); }]; when log value o...

jquery - Data binding for multiple dropdownlists for default shown values -

i have 3 dropdownlists populated(cascading). country, city , factory. data binded correctly 3 dropdownlists. the problem when select country, relevant cities binded correctly city ddl first value got selected city ddl(default shown value), factory ddl doesn't show relevant factories. if choose element city ddl , again if click on default shown element of city ddl works fine. here script <script> //for ddls var citydropdown = $("#selectedcity"); $('#selectedcountry').change(function () { $.ajax({ url: '@url.action("fillcity", "godown")', type: "get", datatype: "json", data: { country: $(this).val() }, success: function (cities) { citydropdown.empty(); $.each(cities, function (i, city) { citydropdown.append($('<option></option>').val(city.cityid).html(city.cityname)); }); } }...

codeigniter - When 2 different images are uploaded to 2 different folders,then the images are uploaded.but the thumbs are not created -

here controller function, please me create thumbs of both images. images uploaded folder. created function named resize create thumbs. that's given in controller. public function add() { $this->load->helper(array('form', 'url')); $this->load->helper('file'); $this->load->library('form_validation'); $this->form_validation->set_rules('txtprdname', 'product name', 'trim|required|htmlspecialchars'); $this->form_validation->set_rules('sbprdcategory', 'product category', 'trim|required|htmlspecialchars'); $this->form_validation->set_rules('sbprduser', 'managing user', 'trim|required|htmlspecialchars'); $this->form_validation->set_rules('txtprdprofile', 'product profile', 'trim|required|htmlspecialchars'); if ($this->form_validation->run() == false) { $data_view[...

asp.net mvc - How to add partialview to insert data -

i have 2 tables category , product. category:- categoryid,categoryname product:- productid, productname, price, categoryid(fk) i want add data single view. create category partial view , render create page. controller is:- public class productcontroller : controller { private storedbentities db = new storedbentities(); // // get: /product/ public actionresult index() { var products = db.products.include(p => p.category); return view(products.tolist()); } // // get: /product/details/5 public actionresult details(int id = 0) { product product = db.products.find(id); if (product == null) { return httpnotfound(); } return view(product); } // // get: /product/create public actionresult create() { viewbag.categoryid = new selectlist(db.categories, "categoryid", "categoryname"); return view(); } public ...

android intentservice - Connecting to Google Api Client - why? -

i'm building location based app , want use displaying location address instructions. saw need connect google api client don't know 1) why, or 2) benefit of using this google api connection fetching address coordinates (using intent service). 3) can use intent service without connecting google api... 10x

android - How to add recycler view or card view in fragments? -

i have created recyclerview , cardview in android. want add 1 of 3 fragments displayed on clicking respective tabs navigation drawer.so how add in fragment. can me out so. thank much! first add support v7 library in project in xml file put this. <android.support.v7.widget.recyclerview android:id="@+id/my_recycler_view" android:layout_width="match_parent" android:layout_height="match_parent"> </android.support.v7.widget.recyclerview> then in fragment put these lines. scheduler_day_view_horizontal_recyclerview = (recyclerview) v.findviewbyid(r.id.my_recycler_view); layoutmanager = new linearlayoutmanager(context, linearlayoutmanager.horizontal, false); scheduler_day_view_horizontal_recyclerview.setlayoutmanager(layoutmanager); scheduler_day_view_horizontal_recyclerview.setitemanimator(new defaultitemanimator()); scheduler_day_view_horizontal_recyclerview.sethasfixedsize(true); ...

java - why does spring-boot and postgres connection breaks after certain time? -

i run spring-boot gradle using tomcat-connection-pool. standard spring-boot-tools. run several soap-webservices on webserver. works fine when testing load of server. after doing nothing ~7.5hours exception occurs. sure timeout try prevent following: spring.datasource.url=jdbc:postgresql://mydb?autoreconnect=true i use @transactional statements. in general use jpa-repository spring-boot. the connections managed tomcat-connection-pool there no idle-connection-problem. when restart application-server runs fine again. my database-server runs postgresql 9.4.1 on x86_64-unknown-linux-gnu , there no firewall between database , app-server. do need tcp_keep alives ? why connection breaks after time , no more recoverable? my app-properties: # # [ database configuration section ] # spring.jpa.database=postgresql spring.jpa.show-sql=false hibernate.format_sql=true hibernate.hbm2ddl.auto=validate spring.jpa.hibernate.naming-strategy=org.hibernate.cfg.defaultnamingstrategy ...

c - How to get exact SQL statement sent to database -

this question has answer here: enable query logging in sqlite 3 1 answer i want print out exact sql statement sent database logging purposes. have looked @ sqlite3_sql doesn't print out sql statement, original sql use input sqlite3_prepare_v2. here function add value row want print sql statement. int add_value(sqlite3* db, sqlite3_stmt * stmt, const char* oid, const char* value) { char sql[256] = {0}; sprintf(sql, "update table1 set value=? field1=\"%s\"", oid); printf("%s\n", sql); int ret = ::sqlite3_prepare_v2( db, sql, strlen(sql), &stmt, 0 ); /* how print out sql statement sent database? */ ret = ::sqlite3_bind_text( stmt, 1, value, strlen(value), 0 ); ret = sqlite3_step(stmt); return ret; } for bit of background inserting integers , strings d...

c# - Expression for complex type property -

i have scenario dynamically create clause client-side grid's configuration. client sends json server parse , subsequently convert expression can passed repository clause. for moment i'm struggling creating expressions complex property types, one: public partial class resource { public string displayname { get; set; } public virtual resourcetype resourcetype { get; set; } } the code below translation expression works simple types displayname property. expression like: x => x.displayname == "valueenteredbyuserintheui" however, when value entered in grid resourcetype property, expression like: x => x.resourcetype == "valueenteredbyuserintheui" i'm missing 1 step convert this: x => x.resourcetype.name == "valueenteredbyuserintheui" anyone can point me in right direction here? public expression<func<t, bool>> getexpression<tentity>(string field, string operation, object value, string ignorecase...

javascript - Windows Script Host "cannot find file" exception in windows XP only -

code: var regs = {'e':/[e]/g};//in real code here actual regular expressions var fso = new activexobject("scripting.filesystemobject"); var objshell = new activexobject("shell.application"); var lib, new_file; var cur_path = wscript.scriptfullname.substring(0, wscript.scriptfullname.length - wscript.scriptname.length); in_path = cur_path+'input'; out_path = cur_path+'output/'; lib = objshell.namespace(in_path); items = lib.items() n=0; (i=0;i<items.count;i++) { fitem = items.item(i); cur_file = fso.opentextfile(in_path + '/' + fitem.name, 1); new_file = fso.createtextfile(out_path + fitem.name, true); while (cur_file.atendofstream == false) { var line = cur_file.readline(); (key in regs) { line = line.replace(regs[key], key ); } new_file.writeline(line); } cur_file.close(); new_file.close(); n++; } wscript.echo("total files found/conv...

apache spark - How can I change SparkContext.sparkUser() setting (in pyspark)? -

i new spark , pyspark . use pyspark, after rdd processing, tried save hdfs using saveastextfile() function. ' permission denied ' error message because pyspark tries write hdfs using local account, 'kjlee', not exist on hdfs system. i can check spark user name sparkcontext().sparkuser() , can't find how change spark user name. how can change spark user name? there environment variable : hadoop_user_name use export hadoop_user_name=anyuser or in pyspark can use os.environ["hadoop_user_name"] = "anyuser"

c++ - Qt - Return an Array Of Array Of qint32 -

this question has answer here: how return 2d array of pointers in c++ 2 answers i have in main : void main() { qint32 led[32][32]; led = init_all(led); } i have this, don't work : qint32** init_all(qint32 led[32][32]) { //set 0 return led; } i return correctly led. you need pass led pointer (or reference in case of c++) init_all. otherwise, copy passed subroutine, not, want. btw, should start learning c or c++ before starting qt. need basic knowledge of programming language before starting qt.

Cannot see changes staged for commit using git diff -

what want to view changes committed local repo against remote one. when git status i'm getting: on branch develop branch ahead of 'origin/develop' 6 commits. (use "git push" publish local commits) nothing commit, working directory clean as discussed in how show changes have been staged? one (two) of git diffs should work. unfortunately in case of them return nothing. git diff //empty - seems fine git diff --cached //empty git diff head //empty am missing something? you have committed changes. diff show difference between index , repository. if want view changes between local repository remote repository this: git fetch --all --prune git log ^master origin/master // or: git log master ^origin/master the difference between 2 lines 1 display pull diff while second 1 display push diff .

linux - Bash : Replace entire line -

i using following line line number in specific string occurs : nline=$(awk '/text/{ print nr; exit }' $1) echo "line = $nline" returns : line = 78 now, replace specific line other string using : awk 'nr==$nline {$0="new text $2"} 1' test.xml where $2 param given bash script. this command line works fine when enter directly terminal or when put parameter : awk 'nr==78 {$0="new text data"} 1' test.xml but never works expected when parameters given command.. in addition, possible avoid print in terminal ? because when put > /dev/null @ end of line nothing appends. for replacing line(s) can either use sed or awk specify line number in sed or nr (number of record) in awk shown in example below awk 'nr==34 { sub("aaa", "bbb") }' or use fnr (file number record) if want specify more 1 file on command line. awk 'fnr==34 { sub("aaa", "bbb...