Posts

sql server - How to check if running store procedure was triggered by job? -

is there way check within store procedure whether triggered job or using other methods i.e. ssis, @ hoc query etc? there similar question sql server find jobs running procedure check job steps, not need. this scenario. i have sp spdosomethingimportant , can run job or i.e. user in database. so within sp want have check if trigger job , name or id of job. i created following sproc: create procedure testme insert test_log select * sys.dm_exec_sessions session_id = @@spid go i ran ssms. in test_log , column program_name "microsoft sql server management studio - query" i created job run sproc. in test_log , column program_name "sqlagent - tsql jobstep (job 0xcb393e8ff0e9d44485204d0100803469 : step 1)" so if didn't want pass parameter indicate if it's running job, think figure out sys.dm_exec_sessions.program_name

javascript - HTML5 form button onsubmit not working -

i have simple form 2 html5 buttons. each button submits form different php page. working well, 'onsubmit' function never triggered. want show dialog box before delete.php page called. <form method="post"> <input type="text" name="fname"> <!-- html5 formaction --> <button type="submit" name="update" formaction="update.php">update</button> <button type="submit" name="delete" onsubmit="return confirm('do want delete?');" formaction="delete.php">delete</button> </form> i have tried different variations, javascript code never triggered. why? try this <form method="post"> <input type="text" name="fname"> <!-- html5 formaction --> <button type="submit" name="update" formaction="update.php...

java - Hibernate, delete from collection -

i have database contain 2 tables connect one-to-many relationship. enteract database through hibernate. this hbm.xml files: question.hbm.xml <?xml version="1.0" encoding="utf-8"?> <!doctype hibernate-mapping public "-//hibernate/hibernate mapping dtd 3.0//en" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="app"> <class name="question" table="question"> <id name="id" column="id" type="java.lang.long"> <generator class="native"/> </id> <property name="text" column="text" type="java.lang.string" not-null="true"/> <set name="answers" cascade="all"> <key column="question_id"/> <one-to-many class="answer"/...

python - Convert Spanish date in string format? -

how convert date in string format compare current time? i tried this: import time, datetime if time.strptime(date.find(text=true), "%a, %d/%m/%y").now() > datetime.now(): but error: valueerror: time data u'dom, 07/02/2016' not match format '%a, %d/%m/%y' need advice on how this. you need setup proper locale before handling language/region specific data. try again with import locale locale.setlocale(locale.lc_time, '') time.strptime(date_string, "%a, %d/%m/%y") the '' tells library pickup current locale of system (if 1 set). if need parse date in different locale, situation little bit more complex. see how strftime date object in different locale? gritty details. it possible explicitly set specific locale, e.g. locale.setlocale(locale.lc_time, 'es_es.utf-8') time.strptime('dom, 01/02/1903', '%a, %d/%m/%y') => time.struct_time(tm_year=1903, tm_mon=2, tm_mday=1, tm_hour=...

c - how to convert a double value into scientific notation and store it in a string -

this question has answer here: correct format specifier double in printf 7 answers i know while printing can convert regular number scientific notation using %e , there way convert scientific notation , store in string . can same string converted decimal notation ? i intend convert , print number entered user scientific notation , add entered number , display final result . entered numbers in decimal notation , output in scientific notation. yes, there sprintf() , , snprintf() this char string[100]; int result; double value; value = 1e-3; result = snprintf(string, sizeof(string), "%e", value); if ((result < 0) || (result >= sizeof(string))) error_please_dont_use_string(); // return or else fprintf(stdout, "%s\n", string);

image - How to reduce size of a multipart file in java -

i have java spring mvc application in there option upload image , save server. have following method: @requestmapping(value = "/uploaddocimagecontentsubmit", method = requestmethod.post) public string createupdatefileimagecontentsubmit(@requestparam("file") multipartfile file, modelmap model) { //methods handle file upload } i trying reduce size of image refering following: increasing-resolution-and-reducing-size-of-an-image-in-java , decrease-image-resolution-in-java problem facing in above examples, dealing java.io.file objects saved specified location. dont want save image. there way can use similar compress multipart image file , continue upload. why don't resize on client before upload? save bandwidth blueimp jquery upload can this

mysql - Total of Male and Female in Grade 8 using sql, codeigniter -

Image
i have problem total in yearlevel total number of male , female in grade 7: i can count using codeigniter: <h3> total students: <?php echo $this->db->count_all('studentinformation'); ?></h3> and group them using this: select yearlevel, sex, count(id) numgender studentinformation group sex, yearlevel my problem count in yearlevel total of grade7, grade 8 , arrage them perhaps you're looking for? use case expressions conditional counting: select yearlevel, count(*) studentcount, count(case when sex = 'female' 1 end) femalecount, count(case when sex = 'male' 1 end) malecount studentinformation group yearlevel