Posts

Showing posts from April, 2015

Check if a list of ids all exist in MySQL and PHP -

what efficient way in mysql , php check if list of ids exist? want function return result true if all ids exists, else false . i thinking: $ids = array(2233, 5545, 9478, 5343, 3545); do_all_groups_exist($ids); function do_all_groups_exist(array $ids = array()) { if(empty($ids)) { return true; } $sql = "select count(`id`) count groups `id` in (" . implode(',', $ids) . ")"; ... $row = mysqli_fetch_object($result); return (intval($row->count) === count($ids)) ? true : false; } is there better way? you can result in sql statement itself $countids= count($ids); $sql= "select case when ( select count(id) cnt groups id in (" . implode(',', $ids) . ") )=$countids 'true' else 'false' end result" ... $row=mysqli_fetch_array($re

C++: Store contents of text file into 2D array as strings (trouble with null terminator?) -

i'm working bit more arrays , reading files try , deeper understanding of them, apologize if ask lot of questions in regards that. i have program supposed read characters file , store characters strings 2d array. example, file contains header number , list of names: 5 billy joe sally sarah jeff so 2d array in case have 5 rows , x number of columns (one row per names). program reads file 1 char @ time. think i'm having problem inserting null terminator @ end of each row indicate it's end of string, overall, i'm not sure what's going wrong. here code: #include <iostream> #include <fstream> #include <string> #include <cstdlib> using namespace std; const int max_name_length = 50; void printnames(char [][max_name_length + 1], int); int main(void) { ifstream inputfile; string filename; int headernum, = 0, j; const int max_names = 10; char ch; char names[1][max_name_length + 1]; cout << "please

sql - Multi-row, instead of single row data transformation with trigger in MYSQL -

i have query: create trigger move_form_data after insert on schema.original_table each row insert schema.new_table (name, street_address, street_address_line_2, city, state, zip, country, dob) select name, street_address, street_address_line_2, city, state, zip, country, dob view_data_submits with calls view: create view view_data_submits select max(case when element_label = 0 element_value end) name, max(case when element_label = 1 element_value end) street_address, max(case when element_label = 2 element_value end) street_address_line_2, max(case when element_label = 3 element_value end) city, max(case when element_label = 4 element_value end) state, max(case when element_label = 5 element_value end) zip, max(case when element_label = 6 element_value end) country, max(case when element_label = 7 element_value end) dob schema.original_table group_id = (select max(group_id) schema.original_table

Php - how to run python -

i'm getting error: ************************ exception: n5boost11filesystem316filesystem_errore boost::filesystem::create_directory: permission denied: "/.dogecoin" dogecoin in appinit() terminate called after throwing instance of 'boost::filesystem3::filesystem_error' what(): boost::filesystem::create_directory: permission denied: "/.dogecoin" aborted (core dumped) this index.php: <html><body><h1>it works!</h1> <p>this default web page server.</p> <p>the web server software running no content has been added, yet.</p> <?php echo '<p>hello world</p>'; $output = array(); echo shell_exec("python gennewadd.py 2>&1"); echo phpinfo(); ?> </body></html> and heres gennewadd.py: def gennewadd(): c = csv.writer(open("/home/dogecoin/bin/addresses.csv", "a"), quoting=csv.quote_all) os.system("

java - How to get the time of the day in milliseconds? -

i want time of day in milliseconds, not day have specific date, time. made something, thought worked, went debugging , concluded doesn't work how want to. i want use check if current time between both specified starttime , endtime . long starttime = settings.getlong("starttime", 0); long endtime = settings.getlong("endtime", 0); if ((currenttime.getmillis() >= starttime) && (currenttime.getmillis() <= endtime)) { //do stuff here } how setting time of propeties starttime , endtime : calendar starttime = calendar.getinstance(); starttime.set(calendar.hour_of_day, 16); starttime.set(calendar.minute, 00); editor.putlong("starttime", starttime.gettimeinmillis()); calendar endtime = calendar.getinstance(); endtime.set(

nsstring - Learning about NSNumber -

if i`m getting string iboutlet use: nsstring *stringname = [[self iboutletname] text]; but how can value if it`s number? here ya go: nsstring * somenumberstring = [[self iboutletname] text]; int someint = [somenumberstring intvalue]; note, i'm sure there more, asa starter, can use: float somefloat = [somefloatstring floatvalue]; // floats double somedouble = [somedoublestring doublevalue]; // doubles if want string value nsnumber do: nsstring * stringvalue = [somensnumber stringvalue];

java - what's the wrong that i fell in with stone.scissors&paper game? -

my code results in exception .. can me spot problem? import java.util.scanner; import java.util.random; class apples { public static void main(string[] args){ scanner sps = new scanner(system.in); system.out.println("choose:\tstone,paper or scissors"); sps.hasnext(); random rand = new random(2); int scissors = rand.nextint(0); int stone = rand.nextint(1); int paper = rand.nextint(2); system.out.println((sps.hasnext("scissors")||sps.hasnext("stone")||sps.hasnext("paper"))? null:"go play away here"); if(rand.nextint() == 0 && sps.hasnext("scissors")){ system.out.println("scissors"); system.out.println("you tie"); }else if(rand.nextint() == 0 && sps.hasnext("stone")){ system.out.println("scissors"); system.out.println("you lose"); }else if(rand.nextint() == 0 &&

android - Accessing UI elements from fragment class -

i have class extends fragment class below: public class fragmentcreategroup extends fragment { @override public void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); imageview group=(imageview)findviewbyid(r.id.group_image);//shows error here } @override public view oncreateview(layoutinflater inflater, viewgroup container,bundle savedinstancestate) { // todo auto-generated method stub return inflater.inflate(r.layout.fragment_creategroup, container,false); } } which associated following xml file <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/linearlayout1" android:layout_width="match_parent" android:layout_height="match_parent" android:contentdescription="@string/cr_group_grpname_d

Creating a List in python for Google App Engine -

before go on, let me have searched internet clarification before asking here.i have class class course(ndb.model): tutor = ndb.stringproperty(required=true) ... and student class. want include in course class list of students (represented id)registered on course.from search, came across options stringlistproperty() this website , class listproperty(item_type, verbose_name=none, default=none, ...) google tutorial on types , property classes.i still confused right way this.i need layman's explanation , possibly guide can find tutorial example.thanks you've got bunch of options, straight forward use ndb.keyproperty repeated=true . values key of particular student. e.g.: class student(ndb.model): name = ndb.stringproperty() class course(ndb.model): students = ndb.keyproperty(repeated=true) def create_course(students): """create new course object , return it. args: students: iterable of `student` model insta

Error in android apps development in eclipse -

during android application development in eclipse when going create avd error coming [2014-03-10 09:37:27 - sdk manager] error: error parsing c:\users\pallabi.android\devices.xml, backing c:\users\pallabi.android\devices.xml.old - how resolve it? try clean eclipse ./eclipse -clean or assign android sdk correct path in local.properties # file automatically generated android tools. # not modify file -- changes erased! # # file must *not* checked version control systems, # contains information specific local configuration. # location of sdk. used ant # customization when using version control system, please read # header note. sdk.dir=/applications/android-sdk

Track url redirection android -

i loading url webview . url login page website . want track redirected urls last 1 when page loads after user logs in. any idea how can done? try : webview.setwebviewclient(new webviewclient() { public boolean shouldoverrideurlloading(webview view, string url) { intent intent = new intent(this, youractivity.class); intent.putextra("url", url); startactivity(intent); return true; } } also see here

r - Add a column for counting unique tuples in the data frame -

this question has answer here: how frequencies add variable in array? 3 answers suppose have following data frame: userid <- c(1, 1, 3, 5, 3, 5) <- c(2, 3, 2, 1, 2, 1) b <- c(2, 3, 1, 0, 1, 0) df <- data.frame(userid, a, b) df # userid b # 1 1 2 2 # 2 1 3 3 # 3 3 2 1 # 4 5 1 0 # 5 3 2 1 # 6 5 1 0 i create data frame same columns added final column counts number of unique tuples / combinations of other columns. output should following: userid b count 1 2 2 1 1 3 3 1 3 2 1 2 5 1 0 2 the meaning the tuple / combination of (1, 2, 2) occurs count=1, while tuple of (3, 2, 1) occurs twice has count=2. prefer not use external packages. 1) aggregate ag <- aggregate(count ~ ., cbind(count = 1, df), length) ag[do.call("order", ag), ] # sort rows gi

objective c - CALayer auto resizing in iOS on device orientation change -

i have added 1 more calayer custom view ,the code hostedgraphlayer.frame = self.layer.bounds; [self.layer addsublayer:hostedgraphlayer]; when device orientation changes view's layer's sublayer rotated not autoresizing respect view. layer wont have autoresize property ios. one of answer in stackoverflow calayers didn't resized on uiview's bounds change. why? in case setting layer's frame on device orientation change ,layer wont autoresize respect view in between rotation start , end, can seen in simulator toggling slow animation. is there fix "when view rotated layers rotated , should resize w.r.t view". no there not built in fix yet, you have change frames . correct me if wrong.

Hibernate Global Filter not applied on DML - Delete,Update query -

i trying use hibernate's global filter implement discriminator based multi-tenancy single table multi-tenancy model (shared database tenants). i came know global filter not being applied on below mentioned sql operation. create update delete it applied on criteria based search, not being applied on dao.findbyid(..) apis well. is right global filter select query, not dml operations? if so, there no meaning use hibernate global filter 1 operation, create,update,delete? i having doubt, please me.

java - how to convertfrom long to String -

this question has answer here: how convert / cast long string? 7 answers hi i'm trying convert long value string getting error type mismatch: cannot convert long string this block of code please have look urlconnection localurlconnection = new url("http://hugosys.in/sqlite/sk2.db").openconnection(); int = localurlconnection.getcontentlength(); bufferedinputstream localbufferedinputstream = new bufferedinputstream(localurlconnection.getinputstream()); bytearraybuffer localbytearraybuffer = new bytearraybuffer(1024); fileoutputstream localfileoutputstream = new fileoutputstream(download_db.this.dbfile); long l = 0l; (;;) { int j = localbufferedinputstream.read(); if (j == -1) { localfileoutputstream.flush(); localfileoutputstream.close(); return; } l += j; localbytearraybuffer.append((byte)j); if (localbytearraybuffer.length() > 2000) { by

sql - Some rows of Order by column is null. How to make Order by column optional on that situation -

i have prob in following select query. select * ".$table2." a,purpose_details b b.purpose_code=a.purpose , purpose_code in(1,4,6,7,10) , ((fromdt<='$frmdate'and todt>='$frmdate') or (fromdt<='$frmdate' , todt='1111-11-11')) , substr(a.appno,4,1)!=6 order purpose_priority, cast(substr(a.case_no,12,4) int) ,cast(substr(a.case_no,4,1) int), cast(substr(a.case_no,5,7) int),cast(substr(a.appno,12,4) int) , cast(substr(a.appno,4,1) int),cast(substr(a.appno,5,7) int)"; the problem rows in table2 may or may not have value of appno. (ie) appno value may null of rows. due appno 1 among in order column particular code retuns invalid input error. finally want select query arrange columns appno when appno value not null . note: order clause rest of columns should applied on both situations. pls me sort out. in advance. order can definitly handle null values substr cann

php - Laravel 4 Resource routing error -

i have route : // work route::resource('work', 'workcontroller'); route::get('work/{id}/delete', array('as' => 'admin.work.delete', 'uses' => 'workcontroller@confirmdestroy')) ->where('id', '[0-9]+'); and controller workcontroller residing @ app/controllers/admin in view call this: <a href="{{ route('admin.work.index') }}" class="btn btn-success btn-lg" role="button"><span class="glyphicon glyphicon-book"></span> <br/>work</a> and error: error message: class app\controllers\admin\work not exist what wrong code? have used same approach pages, users , menus , worked. can confirm name of controller file in app\controllers\admin?. route should // work route::group(array('prefix' => 'admin', function() { route::resource('work', 'workcontroller');

c# - How to write integration rest for asp.net web api -

i busy design web service asp.net web api. , want start doing unit tests on each controller. here test class far: [testclass] public class mydevicescontrollertest { [testmethod] public void testvaliduser() { mydevicecontroller controller = new mydevicecontroller(); var result = controller.get(); } [testmethod] public void testinvaliduser() { mydevicecontroller controller = new mydevicecontroller(); var result = controller.get(); } } but web service makes use of token authentication. how need emulate authentication process. so thinking not maybe make user of http request test it? ie instead of testing controller make http request , check answer? what easier / better way go testing it? in asp.net web api, authentication happens in pipeline before controllers invoked, you'll need write integration tests that. walk through how in on-line course on outside-in tdd , here's gis

html - Links with Active State -

this first time posting here. highly appreciated. i trying set "active" state links ids database. current active links different style. have set different color here testing: here code: $query = "select * recipes categoryid = '".$mycategory['categoryid']."'"; $result = mysql_query($query); while($row = mysql_fetch_array($result)) { echo "<ul class=\"nav_style\"><li><a href=\"?recipeid=".$row['recipeid']."\"> ".$row['recipename']."</a></li></ul>"; here css: .nav_style a:link, .nav_style a:visited { color: #c0c0c0; text-decoration: none; } .nav_style a:hover { color: #58595b; text-decoration: none; } .nav_style a:active { color: #eee; text-decoration: none; } note part of url coming database. highly appreciate help. thanks, $query = "select * recipes categoryid = $mycategory['categoryid']";

android - CalledFromWrongThreadException - Only the original thread that created a view hierarchy can touch its views -

this question has answer here: android “only original thread created view hierarchy can touch views.” 14 answers i want connect mysql database via webservice. login = (button) findviewbyid(r.id.btngiris); login.setonclicklistener(new view.onclicklistener() { public void onclick(view arg0) { thread th = new thread(new runnable() { @override public void run() { runonuithread(new runnable() { @override public void run() { new authentication() .executeonexecutor(asynctask.thread_pool_executor); } }); } }); th.start(); authentication class webservice class authentication extends asynctask

Programmatic way to set Date & Time in Android -

in android setting > date & time, there check box next "automatic date , time, use network-provided time". i turn on programically. have tried things adb shell setprop persist.sys.timezone america/xxx can't find right property automatic date , time. try following: adb shell date -s yyyymmdd.hhmmss

android - How to handle exception occur while getting regular location updates in background service? -

i have regular updates of user location. have created simple service flag set start_sticky. i using googleplayservices locationclient getting regular location updates. i starting service through homescreen activity. here code service import android.app.service; import android.content.intent; import android.location.location; import android.os.bundle; import android.os.ibinder; import android.os.message; import android.os.messenger; import android.os.remoteexception; import android.util.log; import android.widget.toast; import com.google.android.gms.common.connectionresult; import com.google.android.gms.common.googleplayservicesclient; import com.google.android.gms.common.googleplayservicesutil; import com.google.android.gms.location.locationclient; import com.google.android.gms.location.locationlistener; import com.google.android.gms.location.locationrequest; public class gpslocationupdatingservice extends service implements googleplayservicesclient

timepicker - Get time using time picker android -

how can time, set user on time picker widget in android ? like this. timepicker.gettime(); try below. for picking hour can use timepicker.getcurrenthour(); and picking minutes can use timepicker.getcurrentminute(); and can set hour , minute integer variable. like int hour = timepicker.getcurrenthour(); int minute = timepicker.getcurrentminute(); for more information can refer link http://www.mkyong.com/android/android-time-picker-example/

java - Fetching 500K+ of rows from Oracle DB using Hibernate -

i fetching rows table writing rows csv file, table contains more 500,000 rows, while fetching data throws " heap out of memory " exception. how handle this? use query.scroll() insteand of query.list() results of query. avoid loading whole result set memory.

javascript - jQuery check if any text input has value -

i want ask if there's better way in jquery select multiple text input check if of them has value. here's code: if ($("#reference").val() != "" || $("#pin").val() != "" || $("#fname").val() != "" || $("#mname").val() != "" || $("#datepicker").val() != "") { /*logic goes here */ } you below: if ($("#reference,#pin,#fname,#mname,#datepicker").filter(function() { return $(this).val(); }).length > 0) { //.. } using common function following make reusable: function hasvalue(elem) { return $(elem).filter(function() { return $(this).val(); }).length > 0; } and call this: hasvalue("#my-input-id");

about run shell command in rails -

i have controller call shell command. in local, action method wait shell run until finished. but when runs in production server, rails not wait shell command run finished,the action method runs quickly. anyone can tell me reason? sorry. it's call script command cause problem

c# - How to add header columns based on data fetch from the database in gridview -

i have gridview , want make headers dynamically based on sql query like... select question quiz quizid 123. this query return * number of questions based on quizid . how create headers data that's been selected database? you can use datatable this. i don't know technologies used database management, used linq sql . , following sample: dataclassesdatacontext db = new dataclassesdatacontext(); protected datatable getdatasource() { datatable dt = new datatable(); var questions = db.executequery<string>("select question quiz quizid 123").tolist(); // header implementation int count = 0; foreach (var question in questions) { datacolumn dc = new datacolumn(question); dt.columns.add(dc); count++; } // rows implementation here datarow row = dt.newrow(); ... dt.rows.add(row); return dt; } protected void page_load(object sender, eventargs e) { gridview1.datasource

powershell - Script to send new files via email from monitored folder -

i'm wondering if can point me in direction of how automate sending of newly added files located in monitored folder via email (exchange), ideally without outlook installed on server. i use scripts daily notify me of changes in watched folder via email, none of these attach files on email, , @ best list new files names etc. we have software outputs 3 small text files @ same time day, has email manually same external address each day. i'd automate process. i'm running server 2008 r2, , don't mind powershell , vb etc. appreciated. thank you. this should going. $watchpath = "c:\folder\" $sendtolist = @("touser@domain.com") $sendfrom = "fromuser@domain.com" $emailsubject = "file '{0}' changed" $smtphost = "smtp.server" $watcher = new-object system.io.filesystemwatcher $watcher.path = $watchpath $watcher.includesubdirectories = $false $watcher.enableraisingevents = $true $changed = register-

java - Reusing a panel to store values -

i need reuse textfield in panel store values. refer long simple code. basically doing creating panel containing textfield creating array of object of class holder has variable name going store values textfield class holder { string name; } public class yummy12 extends holder { int t; public static void main(string args[]) { new yummy12(); } holder[] obj=new holder[5]; jbutton button1=new jbutton("add one"); jbutton button2=new jbutton("exit"); jpanel panel=new jpanel(); jtextfield textfield=new jtextfield("enter text here"); jlabel label1=new jlabel(); jframe frame=new jframe(); yummy12() { for(int i=0;i<5;i++) { obj[i]=new holder(); } //set component bounds (only needed absolute positioning) label1.setbounds (165, 75, 100, 25); textfield.setbounds (350, 75, 100, 25); button1.setbounds (170, 230, 100

javascript - Google maps wont show up on the browser -

i trying use google map api v3 , display map route between few geolocation points. far able generate single path wrote code below, doesn't give error in js while running wont show on browser. not sure wrong , might doing coding wrong. sorry that. <style type="text/css"> html, body, #map_canvas { margin: 0; padding: 0; height: 100% } </style> <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script> <script type="text/javascript"> var start = [-33.890542, 151.274856]; var end = [ -33.950198, 151.259302]; var beaches = [ [ -33.923036, 151.259052], [ -34.028249, 151.157507], [ -33.80010128657071, 151.28747820854187] ]; var map; var mapoptions = { center: new google.maps.latlng(start[0], start[1]), zoom:

angularjs - Angular js code not getting called, any thing wrong with syntax -

below code calling on factory controler below code not working, there thing wrong syntax? <script> eposapp.factory('getcustomization', function () { return { customization: @html.raw(json.encode(@model)) } }); </script> you need (remove new line after return), eposapp.factory('getcustomization', function () { return { customization: @html.raw(json.encode(model)) } }); in javascript semicolon insertion , therefore take return valied statement , function return undefined

jquery - Assign values to Button Randomly -

i have 1 random variable selects random numbers between 1-10. want create question in user have guess random number generated. want give user 4 options. i have 4 distinct variables a , b , c , rand . function generateoption() { var rand = math.floor((math.random() * 9)+1); var arr = []; var n,a,b,c; for(var i=0; i<3; i++) { do{ n = math.floor(math.random()*9+1); } while(arr.indexof(n) !== -1&&n!=rand); arr[i] = n; // alert(arr[i]); } a=arr[0]; b=arr[1]; c=arr[2]; alert(a+" "+b+" "+c+" "+rand); } i have 4 buttons <table style=" margin: 0 auto;"> <tr> <td><input id="nextbutton3" type="button" class="finish"></td><td></td><td><input id="nextbutton4" type="button" class="finish"></td> </tr> <tr>

c# - using dt.AsEnumerable().Sum for columns having string/null value -

i using following way total of column datatable string total = dt.asenumerable().sum(x => x.field<decimal>("col1")).tostring(); this works fine when values of col1 number. my question is- lets consider if 1 value of col1 string or null or else other number, above code throw error obviously. is there way check whether value number , use '0' instead if value not number. i tried - string total = dt.asenumerable().sum(x => x.field<decimal>("col1") int ? x.field<decimal>("col1") : 0).tostring(); but not sure if correct way. please help if it's not decimal string invalidcastexception in field<t> method . have know type is. i assume col1 can null , field<t> supports nullable types: decimal total = dt.asenumerable() .sum(r => r.field<decimal?>("col1") ?? 0); or without replacing null 0 : decimal? total = dt.asenumerable() .sum(r => r.field<deci

c++ - Affect on std::cout on performance of the program -

i have written program fetch file details , place them in sqlite database. in process have observed 2 scenarios: scenario 1: loop through each , every file , fill file details(path) in database(sqlite3). while each file encountered,keep counter , print same via std::cout. time taken execute program:30mins scenario 2: loop through each , every file , fill file details(path) in database(sqlite3). time taken execute program:7mins i unclear of why because of std::cout ,the time taken 5 times more of not printing it? any pointers on scenario highly appreciated.thanks lot. regards, ravi try use std::ios_base::sync_with_stdio(false) , default std::cout sync stdio

node.js - ldapjs authentication error -

my company has ldap server, try test ldap connection using nodejs ldapjs module, want test connection @ first place, no search function included. here code: exports.authenticate = function(req, res){ var ldap = require('ldapjs'); var username = req.body.username; var password = req.body.password; var client = ldap.createclient({ url: 'ldap://192.168.3.220/' }); client.bind(username, password, function (err) { if(err){ res.send(err); }else{ res.send('login'); }); }; when input correct username , password, sends "login", expected. when input correct username wrong password, sends err object, expected. here problem: when input valid username or invalid username (such "fjdkfjdklsjfsjd") without password, sends "login", abnormal. i new ldap , ldapjs, might simple mistake not figure out. please help.... for binding, need pass dn , password associated entry in ldap, not

ios - How to add cocoapods to existing workspace not project -

i working on project composed of 3 other projects in workspace. want use cocoapods manage dependecies in workspace, cocoapods creates own workspace 1 addtional project. want add cocoapods project workspace exists. there simple way achive that? you can specify workspace in podfile. workspace 'myworkspace' please consult link more info: http://guides.cocoapods.org/syntax/podfile.html#workspace

java - Why my usb to serial port is not recognized in Ubuntu? -

i have continue development of specific java embedded project talks serial external devices. previous development done using windows , try run using ubuntu. have port issue when using code: string comport = gateway.config.gethardwarerevision() <= 1 ? "com0" : "com1"; string ports = system.getproperty("microedition.commports"); log.log("---available ports: " + ports); serial = (commconnection) connector .open("comm:" + comport + ";blocking=on;baudrate=" + baud_rates[baudrate] + ";autocts=off;autorts=off"); instream = serial.openinputstream(); outstream = serial.openoutputstream(); basically connect usb serial cable, noticed ubuntu assigning port /dev/ttyusb0 change code to: `string comport = gateway.config.gethardwarerevision() <= 1 ? "/dev/ttyusb0" : "com1";` because hw revision <=1 should load port. unfortunately after man

arrays - why Segmentation fault error in this program in c? -

why dr segmentation fault in code? correct here, syntax ... etc.the program simple,just 2 sort content of 2 arrays third array; have taken 2 arrays array1 , array2 , third 1 array in sorting done. #include<stdio.h> int main() { int array1[10] = {1, 2, 4,5,7,8,45,21,78,25}; int array2[5] = {3, 6, 9,15,17}; int array[20]; int i,j,temp; int l1 = sizeof(array1)/sizeof(int); int l2 = sizeof(array2)/sizeof(int); int l3 = l1+l3; (i = 0;i < l1; i++) { array[i]=array1[i]; } (i = 0;i < l2; i++) { array[i+l1]=array2[i]; } (i = 0;i < (l1+l2); i++) { printf("%d\n", array[i]); } printf("\nsorted array:\n"); for(i=0;i<l3;i++) { for(j=i;j<l3;j++) { if(array[i] > array[j]) { temp=array[i]; array[i]=array[j]; array[j]=temp; } } } (

java - Cannot find symbol HibernateUtil -

i'm following tutorial on hibernate seen here , in 'filmhelper' class i'm trying session object so: package dvdrental; import org.hibernate.session; public class filmhelper { session session = null; public filmhelper() { this.session = hibernateutil.getsessionfactory().getcurrentsession(); } } but i'm getting 'cannot find symbol' error stating cannot find 'hibernateutil' ... has changed in way obtain session in hibernate, tutorial out of date, or have done wrong? i'm not sure how should retrieve session, if filmhelper instance stored somewhere. if have access entity manager (i assume because of java-ee tag), need this: session s = (session)entitymanager.getdelegate(); update : the tutorial linked has part "creating hibernateutil.java helper file", maybe that's what's missing. but please note start. more complex or robust solutions should have @ documentation , maybe use jpa a

objective c - iOS 6 custom grouped UITableViewCell incorrect size -

Image
i have created uitableviewcell subclass contains uitextfield . when add cell grouped table view in ios 6 cell gets extended table view edges. here code custom cell. #import "activitynameeditcell.h" @implementation activitynameeditcell - (id)initwithstyle:(uitableviewcellstyle)style reuseidentifier:(nsstring *)reuseidentifier { self = [super initwithstyle:style reuseidentifier:reuseidentifier]; if (self) { self.textfield = [[uitextfield alloc] init]; [self addsubview:self.textfield]; } return self; } - (void)setselected:(bool)selected animated:(bool)animated { [super setselected:selected animated:animated]; // configure view selected state } - (void)layoutsubviews { self.textfield.frame = cgrectmake(self.contentview.frame.origin.x + 10, 0, self.frame.size.width - self.contentview.frame.origin.x - 10, self.frame.size.height); } @end this same cell class lays out correctly in ios 7 is there glaringly obvious i&#

weblogic - JMS with clustered nodes -

i have 2 clustered managed servers running on weblogic, , seperate jms server1 , server2 running on each managed server. problem in application properties file, hardcoded , pass jms server1 jndi name application. both applications running on each node uses 1 fixed jms server, not distributed , clustered. if jms server 1 down, whole application down. my question how let application dynamically find jms server in above senario? can please point me direction? thanks! it's in weblogic docs at: http://docs.oracle.com/cd/e14571_01/web.1111/e13738/best_practice.htm#cacddfjd basically created comma separated list of servers , jms connection logic should automatically able handle case when 1 of servers down: e.g. t3://hosta:7001,hostb:7001

mysql - Add rows in between with default values -

i have table values this i using mysql , first field date (timestamp), second double 09:00:00 xxx 09:01:00 yyy 09:04:00 zzz would possible insert adds missing rows (09:02:00, 09:03:00)? in case sql like? create procedure inserts necessary values temporary table. this: drop procedure if exists sp_date_range; delimiter $$ create procedure sp_date_range(in startdate datetime, in enddate datetime) begin drop table if exists tmp_date_range; create table tmp_date_range(a_datetime datetime primary key); set @date := startdate; while (@date <= enddate) insert tmp_date_range values (@date); set @date := @date + interval 1 minute; end while; end $$ delimiter ; now call start , end dates. call sp_date_range('2014-03-10 14:00:00', now()); now have table this: mysql> select * tmp_date_range; +---------------------+ | a_date | +---------------------+ | 2014-03-10 14:00:00 | | 2014-03-10 14:01:00 | | 2014-03-10 14:02:00 | | 2014-03-10 14:03:0

php - Populate html textbox with Javascript canvas data -

i have canvas couple of images in it, use following code width , height of image when click on image: canvas.addeventlistener('click', function (e) { var mouse = mystate.getmouse(e); var mx = mouse.x; var = mouse.y; var shapes = mystate.shapes; var l = shapes.length; (var = l-1; >= 0; i--) { if (shapes[i].contains(mx, my)) { var mysel = shapes[i]; mystate.selection = mysel; mystate.valid = false; var message = 'image width*height = ' + mysel.w + '*' + mysel.h; alert(message); return; } } and have simple html text boxes this: width:<input type="text" id="width" size="10"> height:<input type="text" id="height" size="10"> is possible somehow populate textboxes width , height when click on image? there maybe way put width , height php variable , put value in textbox? haven't got experience j

sql - Add job to scheduler to invoke that job automatically everyday -

i have created job runs on everyday @ 09:00:00. below snippet have used create job : begin dbms_scheduler.create_job( job_name => 'proecss_state_arch' ,job_type => 'stored_procedure' ,job_action => 'test' -- procedure name ,start_date => sysdate 9:00:00 ,repeat_interval => 'freq=daily' ,enabled => true ,comments => 'job schedule archiving process_state'); end; sole purpose of run stored procedure 'test' on everyday @ 09:00:00 how add job scheduler invoke job automatically on everyday? can please tell me ?? you need specify byhour run job everyday @ 9 pm. begin dbms_scheduler.create_job( job_name => 'proecss_state_arch' ,job_type => 'stored_procedure' ,job_action => 'test&#

c# - How to retrive value of listbox.valuemember property -

i beginner in c# programming. have filter result in mode: listamicizie1.displaymember = "viewname"; // it's alias listamicizie1.valuemember = "idutente"; //it's primary key in db table listamicizie1.datasource = ds.tables["utenti"]; //db table now must register in db table value of result of listbox , use code string idu = string.empty; string value = string.empty; foreach (var item in listamicizie1.valuemember) { (int j = 0; j < listamicizie1.items.count; j++) { idu = listamicizie1.selectedvalue; value += idu + ","; } } value = value.trimend(','); value = value.trimend(','); idutente = user.text; string cnnstr = system.configuration.configurationsettings.appsettings["cnnstr"].tostring(); string querysql2 = " insert amicizia (idutente1, [idamici]) values ('" + idutente + "', '" +