Posts

Showing posts from January, 2015

sql server - Create variable name from while loop value SQL -

first time poster on site , need advice: is possible declare/create new variable base on while loop? context: financial calendar company assigns each date within financial year period (month) , week number. these can change each year depending on date of new financial year. i want create function runs while loop week , period number specified date. i want able along lines of while > @enddate if date between such , such week = @w(i) end i not sure how explain it. i have function listing week , period numbers looks messy , not efficient. can advise? thank you edit: apologies my code in sql server. what have far messy , complete draft i'll pop in here now. declare @startdate datetime , @enddate datetime , @thisdate datetime , @p1 datetime , @p2 datetime , @p3 datetime , @p4 datetime --and forth until p12 , @w1 datetime , @w2 datetime , @w3 datetime , @w4 datetime , @w5 datetime --and forth until w52 set @startdate = '

Python Lists Under While Loop -

i want make while loop kind of this list=[] while x in range(r): list-x="something" where each time loop begins makes new list number (x). if loops on 5 times there different lists: list(1) list(2) list(3) list(4). ' is possible? you able vars() function: for in range(5): list_name = ''.join(['list', str(i)]) vars()[list_name] = [] you can reference each list: print(list1) --> [] print(list2) --> [] etc... you can achieve using locals() or globals() functions below: for in range(5): locals()['list{}'.format(i)] = [] hope helps!

ruby on rails - Explain what respond_to? :should in cucumber? -

i using ruby on rails , cucumber first time. trying define step definitions , hope explain following code found in steps definitions me: then /^(?:|i )should see movies: "([^\"]*)"/ |movie_list| #handles text containing text list of movies check if page.respond_to? :should page.should have_content(movie) #checks if movie appears on page else assert page.has_content?(text) end end my scenario is: scenario: ratings selected given on rottenpotatoes home page should see movies and trying test if items database being displayed. supposed use .should , assert on rows of database. hint got assert rows.should == value , can't work because don't understand it! so upon further understanding, produced follow method handle above scenario: then /^i should see movies$/ count = movie.count assert rows.should == count unless !(rows.respond_to? :should) end but cucumber still failing scenario. suggestion? here's ex

c# - If-else statement with radio buttons and a for loop -

i've gotten issue keeps happening , i'm unsure problem is. need create program in microsoft visual studio radiobutton1 finding sum of consecutive numbers , radiobutton2 finding factorial of number. there 3 buttons, 1 for loop, 1 while loop, , 1 do-while loop. i'm working on button. what i'm trying making selection, pressing 1 of buttons, it'll find answer using loop clicked in message box. this i've gotten far: private void button1_click(object sender, system.eventargs e) { if ((radiobutton1.checked == true) && (radiobutton2.checked == false)) { int sum = 0; int number = int.parse(numericupdown1.value.tostring()); (int = 1; <= number; i++) { sum = sum + i; messagebox.show("the sum of consecutive numbers leading " + number + " " + sum + "."); } messagebox.show("the sum of consecutive numbers leading " + number + " " + sum + "."); } else i

isabelle - Can I define multiple names for a theorem? -

suppose have theorem: theorem non_ascii_thm_name: "true" simp i want define ascii name non_ascii_thm_name notation command. example, this: notation non_ascii_thm_name ("ascii_thm_name") the isar commands notation , abbreviation can used constants. there isar command allows me to this? preferably, want isar command provide synonym. example, if use sledgehammer , preferable there exist 1 theorem, non_ascii_thm_name , sledgehammer not using additional fact ascii_thm_name . a partial solution use command: lemmas ascii_thm_name = non_ascii_thm_name this define new theorem called ascii_thm_name same non_ascii_thm_name . there unfortunately no guarantee tools such find_theorems use new name, instead use own heuristics determining "best" name output user. an alternative synonym lemmas theorems , though former considered more standard approach.

twitter bootstrap - responsive css background property -

i have markup : <ol class="carousel-indicators"> <li data-target="#showcarousel-03" data-slide-to="0" class="active"> <h4>title</h4><br/><h5>text</h5><br/><span>+</span> </li> <li data-target="#showcarousel-03" data-slide-to="1"> <h4>title</h4><br/><h5>text</h5><br/><span>+</span> </li> <li data-target="#showcarousel-03" data-slide-to="2"> <h4>title</h4><br/><h5>test</h5><br/><span>+</span> </li> <li data-target="#showcarousel-03" data-slide-to="3"> <h4>title</h4><br/><h5>text</h5><br/><span>+</span> </li> and css : .carousel-indicators li{ display:block; float:left; background: url(images/tri

sql - How can I fetch the last N rows, WITHOUT ordering the table -

i have tables multiple million rows , need fetch last rows of specific id's for example last row has device_id = 123 , last row has device_id = 1234 because tables huge , ordering takes time, possible select last 200 without ordering table , order 200 , fetch rows need. how that? thank in advance help! update my postgresql version 9.2.1 sample data: time device_id data data .... "2013-03-23 03:58:00-04" | "001ec60018e36" | 66819.59 | 4.203 "2013-03-23 03:59:00-04" | "001ec60018e37" | 64277.22 | 4.234 "2013-03-23 03:59:00-04" | "001ec60018e23" | 46841.75 | 2.141 "2013-03-23 04:00:00-04" | "001ec60018e21" | 69697.38 | 4.906 "2013-03-23 04:00:00-04" | "001ec600192524"| 69452.69 | 2.844 "2013-03-23 04:01:00-04" | "001ec60018e21" | 69697.47 | 5.156 .... see sqlfiddle of data so if device_id = 001ec60018e21 want

ruby - Catching client connection disconnect in redis subscription -

i'm trying build notifications system redis , sinatra streams. can't seem catch when connection closes down, blocking redis subscription block seems never close down. best way achieve this? get '/user/:id/next_notification' stream :keep_open |out| $redis.subscribe("notifications:#{params[:id]}") { |on| on.message { |channel, msg| $redis.unsubscribe out << msg } } out.callback { puts "unsub" # $redis.unsubscribe } out.errback { puts "unsub" # $redis.unsubscribe } end end redis subscription blocking call. need execute in separate thread. dunno how in ruby. i'm sure there must threading library in ruby. wrap blocking call in try..catch , know when connection has closed server side.

python efficiency and large objects in memory -

i have multiple processes each dealing lists have 40000 tuples. maxes memory available on machine. if this: while len(collection) > 0: row = collection.pop(0) row_count = row_count + 1 new_row = [] value in row: if value not none: in_chars = str(value) else: in_chars = "" #escape naughty characters new_row.append("".join(["\\" + c if c in redshift_escape_chars else c c in in_chars])) new_row = "\t".join(new_row) rows += "\n"+new_row if row_count % 5000 == 0: gc.collect() does free more memory ? since collection shrinking @ same rate rows growing, memory usage remain stable. gc.collect() call not going make difference. memory management in cpython subtle. because remove references , run collection cycle

python - django related manager - in template -

i trying show latest rating score of location. have 2 tables(django models) class location(models.model): locationname = models.charfield() ... class rating(models.model): von_location = models.foreignkey(location,related_name="locations_rate") rating = models.integerfield() now in db, 1 location(id=1) has 3 ratings(1,2,4). i want show latest record in rating location. can in template using related manager somehow? my vision is: all_locs = location.objects.all() then in template: {% location in all_locs %} {{ location.locations_rate.latest }} {% endfor %} can relatedmanager kind of things? my answer in other related question: models.py class location(models.model): locationname = models.charfield(max_length=100) def __unicode__(self): return self.locationname def latest(self): return rating.objects.values('rating').filter(von_location=self).order_by('-id')[0] class rating(models.mo

Load Tinymce for new textarea can't resize -

i have form have 1 textarea (tinymce onload) , 1 button add new textarea (same id,class) and start tinymce , first textarea couldn't resizeable ? if had 2 textarea onload tinymce, both of them resizeable ! what's wrong , , how load tinymce dynamic textarea? function starttiny() { tinymce.init({ }); } starttiny(); function addnewtextarea() { action add new textarea here starttiny(); }

ruby on rails - Loading local gems through Bundler and mounted apps -

i'm creating gem (let's call mygem ) sinatra server intended mounted within rack based apps. inside gem's gemspec file, have following: gem.add_dependency 'kss' and inside gem's gemfile, have following source 'https://rubygems.org' gemspec gem "kss", :path => "/users/me/code/kss" now when running server within mygem 's folder, works expected: instead of fetching out kss dependency, on local drive , load version. the problem comes in when add mygem rails test app gemfile. in rails test app gemfile, have following line: gem "mygem", :path => "/users/me/code/mygem" i expect, upon bundle install , bundler load mygem , dependencies; kss dependency, instead of loading local dependency, bundler fetches out rubygems find , load it. i'm assuming because in case, it's reading gemspec line , not including dependency override. is there can fix behavior? i'd able run , test st

c++ - Why is "static" needed for a global const char but not for a bool? -

shared header. i can this: const bool kactivateplayground=false; works fine when included among multiple files. i cannot this: const char * kactiveplayground = "kiddiepool"; results in error: duplicate symbols. but works: static const char * kactiveplayground = "kiddiepool"; why static needed const char * not const bool ? additionally, thought static not necessary since const static implicity? in c++, const variables default have static linkage, while non- const variables have external linkage. the reason multiple definitions error that const char * kactiveplayground = "kiddiepool"; creates variable external linkage. hey wait, didn't const variables default static linkage? yes did. kactiveplayground not const . non- const pointer const char . this work expect: const char * const kactiveplayground = "kiddiepool";

c# - image corrupted when Uploading to ftp using ftpwebrequest -

i used code upload image ftp. image corrupted. image im trying upload base64 string.i converted stream , passed uploadimage. public static void uploadimage(stream image, string target) { ftpwebrequest req = (ftpwebrequest)webrequest.create("ftp://www.examp.com/images/" + target); req.usebinary = true; req.method = webrequestmethods.ftp.uploadfile; req.credentials = new networkcredential("usernm", "passwd"); streamreader rdr = new streamreader(image); byte[] filedata = encoding.utf8.getbytes(rdr.readtoend()); rdr.close(); req.contentlength = filedata.length; stream reqstream = req.getrequeststream(); reqstream.write(filedata, 0, filedata.length); reqstream.close(); } instead of: streamreader rdr = new streamreader(image); byte[] filedata = encoding.utf8.getbytes(rdr.readtoend()); rdr.close(); if use byte[] filedata = file.readallbytes(image); gives me error, filename more 260 cha

css - Need help with understanding CSS3 animations -

i trying learn animations in css3 im stuck documentation out there. have code: h1{ -webkit-animation: movedown 1.s ease-in-out .6s backwards; -moz-animation: movedown 1s ease-in-out 0.6s backwards; -o-animation: movedown 1s ease-in-out 0.6s backwards; -ms-animation: movedown 1s ease-in-out 0.6s backwards; animation: movedown 1s ease-in-out 0.6s backwards; } @-webkit-keyframes movedown{ 0% { -webkit-transform: translatey(-300px); opacity: 0; } 100% { -webkit-transform: translatey(0px); opacity: 1; } } @-moz-keyframes movedown{ 0% { -moz-transform: translatey(-40px); opacity: 0; } 100% { -moz-transform: translatey(0px); opacity: 1; } } @-o-keyframes movedown{ 0% { -o-transform: translatey(-40px); opacity: 0;

php - Codeigniter - Parse each row of json data -

hi using foreach loop parse each row of json data.. what exactly trying json data view , sending controller parsing each row of json insert database.. trying insert data putting in loop , calling setcurrentattendance($item) present in model. if approach wrong please let me know correct one.. the php code : $data = json_decode($_post["json"]); var_dump($data); foreach($data $item){ $this->codegen_model->setcurrentattendance($item); } note $this->codegen_model->setcurrentattendance($item); redirects model trying pass $item array , inserting database.. function setcurrentattendance($data){ $this->db->insert('table_name', $data); if ($this->db->affected_rows() >= '1') { return true; } return false; } the json data variable $data : "[{"roll_no":"1101","full_name":"john smith&quo

ruby on rails - coffescript is giving error in my project which before works fine -

i looking video http://railscasts.com/episodes/258-token-fields-revised coffescript code jquery -> $('#employee_material_asset_tokens').tokeninput '/assets.json' theme: 'facebook' prepopulate: $('#employee_material_asset_tokens').data('load') it works fine before gives me error execjs::programerror @ /employee/reviews error: parse error on line 5: unexpected 'indent' (in /home/prem/rails/heronhrm/app/assets/javascripts/employee/assets.js.coffee) i confuse did not change code works fine before .. reason when change code like jquery -> $('#employee_material_asset_tokens').tokeninput '/assets.json' theme: 'facebook' prepopulate: $('#employee_material_asset_tokens').data('load') then token input works prepopulate , theme doesnot work.. i think you're missing , after '/assets.json' . code should like $('#employee_material_asset_tokens').

c# - Authenticated Calls -

i doing authenticated data fetch on server-side follows: httpwebrequest request = (httpwebrequest)webrequest.create(url); request.proxy = new webproxy("..."); request.usedefaultcredentials = true; request.keepalive = true; request.cookiecontainer = new cookiecontainer(); is possible using jquery? you place in static method marked [webmethod] attribute , call from jquery - is, instead of doing call directly through proxy, still client-side async call still goes through server.

ios - Uiview size in xib file is not normal -

Image
when create uiviewcontroller file in xcode uiview size becomes larger default iphone screen size i can't figure out why occurs , how resize default size of iphone. make sure while creating class should done target ipad - uncheck with xib user interface - check

javascript - How to drag a div up and down to scroll? -

instead of having scroll bar, want able drag div scroll down. the div bar contains profile pictures of users online. so far, able drag 1 of profile pictures. want able drag either profile pictures ( @ once ) or drag div scroll when overflows. p.s want vertical scrolling , both jquery or javascript fine me this may useful : http://the-taylors.org/jquery.kinetic/ jquery.kinetic simple plugin adds smooth drag scrolling

c# - Using multiple datasets in RDLC -

i working on rdlc reports, , reports work fine. got stuck when added 1 more dataset rdlc file. on adding dataset, added data source well. ran project, , report no more working giving error: a data source instance has not been supplied data source can 1 please guide me on steps take in order use multiple datasets. using visual studio 2012. multiple datasources added follows: reportviewer1.localreport.datasources.add(rds); reportviewer1.localreport.datasources.add(rds1); refer link: http://www.c-sharpcorner.com/uploadfile/robo60/standalonerdlcreports11142007183516pm/standalonerdlcreports.aspx all parts covered in this. also refer usefull discussion: http://forums.asp.net/t/1241964.aspx

c# - Export to Excel - Installing Office Customization in MVC4 -

i exporting excel file in mvc4 application. excel public class exporttoexcel : actionresult { public gridview excelgridview { get; set; } public string filename { get; set; } public int totalquantity; public decimal totalprice1; public string x1; public exporttoexcel(gridview gv, string pfilename, int totalqty, decimal totalprice, string x) { x1= x; excelgridview = gv; filename = pfilename; totalquantity = totalqty; totalprice1 = totalprice; } public override void executeresult(controllercontext context) { httpcontext curcontext = httpcontext.current; curcontext.response.clear(); curcontext.response.addheader("content-disposition", "attachment;filename=" + filename); curcontext.response.charset = ""; curcontext.response.cache.setcacheability(httpcacheability.nocache); curcontext.response.contenttype = "application/vnd.ms-excel"; stringwriter sw = new stringwriter(); htmltextwriter h

c++ - Deleting resources managed by a vector -

i want vector hold pointers objects own. here vector: private: std::vector<fppvirtual*> m_fapps; i have created elements this: m_fapps.push_back(new fpp1(renderingengine)); //fpp* subclasses of fppvirtual m_fapps.push_back(new fpp2(renderingengine)); m_fapps.push_back(new fpp3(renderingengine)); as m_fapps vector instance variable in class, want make sure class's destructor cleans m_fapps : (int i=0, size=m_fapps.size();i<size;++i){ delete m_fapps[i]; } is acceptable memory management technique? assume loop needed since when vector goes out of scope when owning class destructed, pointers these new objects removed, right? as no 1 gave straight forward answer yet - yes, acceptable , way free memory, having declaration of vector . this can , should avoided, using smart pointers, @olicharlesworth suggested or using other container, ponited @björnpollex.

php - how to remove quotes of any string when preparing queries -

$desc = 'desc'; $getrecords = $conn->prepare('select * `courses` order `id` :sort limit :limitinc, :limit '); $getrecords->bindvalue(':limit',$limit,pdo::param_int); // working $getrecords->bindvalue(':limitinc',$limitinc,pdo::param_int); // working // *** line below isn't working *** $getrecords->bindvalue(':sort', $desc ,pdo::param_str); // not working $getrecords->execute(); i trying call $desc in prepare query.. fatal error: uncaught exception 'pdoexception' message 'sqlstate[42000]: syntax error or access violation: 1064 have error in sql syntax; check manual corresponds mysql server version right syntax use near ''desc' limit 0, 5' @ line 1' in c:\xampp\htdocs\portfolio\nasiraan\try\indexx.php:89 stack trace: #0 c:\xampp\htdocs\portfolio\nasiraan\try\indexx.php(89): pdostatement->execute() #1 {main} thrown in c:\xampp\htdocs\portfolio\nasiraan\try\indexx.p

c++ - Can't get ios::beg to go back to the beginning of the file -

it seems things should no problem cause problems me. don't it. :/ so i'm trying make sure understand how manipulate text files. i've got 2 files, "infile.txt" , "outfile.txt". "infile.txt" has 6 numbers in , nothing else. here code used manipulate files. #include<fstream> using std::ifstream; using std::ofstream; using std::fstream; using std::endl; using std::ios; int main() { ifstream instream; ofstream outstream;//create streams instream.open("infile.txt", ios::in | ios::out); outstream.open("outfile.txt");//attach files int first, second, third; instream >> first >> second >> third; outstream << "the sum of first 3 nums " << (first+second+third) << endl; //make 2 operations on 6 numbers instream >> first >> second >> third; outstream << "the sum of second 3 nums " << (first+second+third) << endl; instream.seekg(0

Websphere Application server not starting -

we have 1 websphere application server instance went down outofmemory , not starting after that. error message in log below. urgent highly appreciated. version 6.0.2.33 03/04/13 14:16:01:536 bst] 0000000a wsserverimpl e wsvr0009e: error occurred during startup meta-inf/ws-server-components.xml [03/04/13 14:16:01:547 bst] 0000000a wsserverimpl e wsvr0009e: error occurred during startup com.ibm.ws.exception.configurationerror: com.ibm.ws.exception.configurationerror: problem initializing adminimpl: @ com.ibm.ws.runtime.wsserverimpl.bootservercontainer(wsserverimpl.java:180) @ com.ibm.ws.runtime.wsserverimpl.start(wsserverimpl.java:133) @ com.ibm.ws.runtime.wsserverimpl.main(wsserverimpl.java:387) @ com.ibm.ws.runtime.wsserver.main(wsserver.java:53) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:85) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodac

Read and write images in pixels in java -

i trying read , write grayscale image using bufferedimage . pixels in writing images little bit different source. not image processing stuff. please me find mistake have made in code. here code file inimage=new file("source.jpg"); file outimage=new file("out.jpg"); /* code reading image*/ bufferedimage image=imageio.read(inimage); writableraster raster=image.getraster(); /* writing same raster new image */ bufferedimage newimg=new bufferedimage(raster.getwidth(), raster.getheight(),bufferedimage.type_byte_gray); newimg.setdata(raster); imageio.write(newimg, "jpg", outimage); i'm sure original image not of type type_byte_gray . suggest output same image type input one: bufferedimage newimg = new bufferedimage(raster.getwidth(), raster.getheight(), image.gettype());

python - purchase_landed_costs module Error openerp 7 -

file "/home/bellvantage/documents/openerp-7.0/openerp-7.0/openerp/osv/orm.py", line 2177, in apply_inheritance_specs raise_view_error("element '%s' not found in parent view '%%(parent_xml_id)s'" % tag, inherit_id) file "/home/bellvantage/documents/openerp-7.0/openerp-7.0/openerp/osv/orm.py", line 2070, in raise_view_error % (child_view.xml_id, self._name, error_msg)) attributeerror: view definition error inherited view 'purchase_landed_costs.c2c_product_landed_cost_view' on model 'product.product': element '<field name="active">' not found in parent view 'product.product_normal_form_view' when go create products in products form error appeared. issue thia here fresh db & no issues other modules i thin bug in purchase_landed_cost module, try install 6.1 version module in 7 version. field active no more exits in product_normal_form_view.

serial port - Raspberry Pi - Rainforest EMU-2 - Python - Read time from SCE smart meter -

i programming in python , first project. appreciated. i obtained device rainforest reads electric meter. unit has usb port accessible via usb. managed hook device raspberry pi , extract hex string serial port. string reading 0x18f0cb39. need take number , convert proper format , output time , date. manual device programming @ http://www.rainforestautomation.com/sites/default/files/download/rfa-z106/raven_xml_api_r127.pdf i quite confused when comes converting epoch time , date. put #'s in front of lines having difficulties. the code have written is: #!/usr/bin/env python import serial import time serial.port = serial.serial("/dev/ttyusb0", 115200, timeout=0.5) serial.port.write("<command><name>get_time</name><refresh>n</refresh></command>") response=serialport.readline(none) response=serialport.readline(none) response=serialport.readline(none) response=serialport.readline(none) response=serialport.readline(

android - Ttitanium webview and HTML5 application cache -

i using titanium create application android. app uses webview load external html5 webpages. webpage uses manifest cache page , assets. works fine on desktop browsers , third party app browsers in android (chrome). when view page in webview in titanium build app, seems manifest not used, page loads server. same problem occurs when use build in browser of phone (htc 1 x). what trying accomplish pages offline available, internet not required tot view cached pages. there fix problem, or should go in direction solve problem? the manifest file: cache manifest # version 1 leerlingen.html jquery.js style.css handler.js network: * first: titanium provides more webview. if planned display web pages maybe should have @ phonegap / cordova might fit needs in better way. as you've noticed not browsers support html5 caching feature expected. can't if doesn't work android in general or specific version because webkit support depends of used webkit version. , dif

php - codeigniter adding multiple condition of the model -

this code public function get_news($newsid= false) { if ($newsid === false) { $query = $this->db->get('news'); return $query->result_array(); $config['per_page']; $this->uri->segment(3); } $query = $this->db->get_where('news', array('newsid' => $newsid, 'language' => '2'); return $query->row_array(); } this not working if remove language condition works in code want add 1 more condition newid => $newsid , want add 1 more here in code lanid = $lanid regards in advance $this-db->where(field1,condition1); $this-db->where(field2,condition2); $this-db->where(field3,condition3); $this->db->get(table); you can set many wish there's litereally no difference. since insist, $this->db->get_where('table', array('field1'=>'condition1',

Can't import PMD Ruleset in Eclipse -

Image
i use same ruleset in ide (eclipse) sonar profile. i got pmd xml ruleset sonar permalinks , import pmd eclipse plugin when try it, "ok" button desactivated ... can me ? the problem sonar exporting ruleset v4.x format , eclipse plugin expects them in v5.x format. try changing rules from: <rule ref="rulesets/basic.xml/unusednullcheckinequals"> <priority>3</priority> </rule> to <rule ref="rulesets/java/basic.xml/unusednullcheckinequals"> <priority>3</priority> </rule> please note ref attribute. simple find , replace work out fine you.

python - Write a makefile with one rule for many targets? -

it may seem simple question, not find way fix it. my intention convert every ".ui" file ".py" file invoking pyuic4 command (from pyqt ). tried manage short makefile: %.py: %.ui pyuic4 $< --output $@ that's need @ moment. the makefile named "makefile" , located in folder "make" invoked from, , ".ui" files. "pyuic4(.bat)" in system's path (windows 7), , unix utilities "make" part of. when running "make" windows console, says: make: *** no targets. stop. invoking pyuic4 command line explicit file names works. i know specify target file own, if possible want avoid this. any ideas? as per kasterma's comment, need tell make target build, you've provided pattern rule. can done in following way. uifiles := $(wildcard *.ui) pyfiles := $(uifiles:.ui=.py) .phony: all: $(pyfiles) %.py: %.ui pyuic4 $< --output $@

git: removing strange remote branch -

i've started work messy repository: task remove useless, merged-in branches. when list remote branches, can see: remotes/origin/xx12 remotes/origin/xx13 remotes/origin/remotes/origin/xx14 i can run git push origin :xx12 git push origin :xx13 to remove xx12 , xx13 . don't know how can remove xx14 has strange path remotes/origin/remotes/origin . don't know how done , why, i'd remove safely. the name of remote branch "remotes/origin/xx14". so, can remove full name others. try: git push origin :remotes/origin/xx14

thumbnails - jQuery image rotate on hover -

any chance change image src on hover , count 10 , again first? this need, default thumb, flv-3.jpg ! <img src="/thumbs/e/b/d/6/d/ebd6d2d6d99e/ebd6d2d6d99e.flv-3.jpg" /> on mouse hover need change number flv-1.jpg flv-2.jpg flv-3.jpg flv-4.jpg etc.. up 10, , again , start number 1, when move mouse thumbs need default thumb flv-3.jpg this im use not solutions, var _thumbs = new array(); function changethumb(index, i, num_thumbs, path) { if (_thumbs[index]) { document.getelementbyid(index).src = path + + ".jpg"; preload = new image(); preload_image_id = (i + 1 > num_thumbs) ? 1 : + 1; preload.src = path + preload_image_id + ".jpg"; = % num_thumbs; i++; settimeout("changethumb('" + index + "'," + + ", " + num_thumbs + ", '" + path + "')", 800) } } function startthumbchange(index, nu

Highstock Issue - Can't draw and plot chart correctly -

i'm working on project display stock information using highstock . question 1: i tried display ohlc data using ohlc graph, high , low using areasplinerange graph, , volume using column chart. everything works fine, if zoom 1m , 3m , 6m , ytd , , 1y . here snapshot. link1 . if zoom all , graph messed link2 . am wrong in coding or it's bug? question 2: in same chart, have code change type of graph ohlc line . works fine when zoom 1m , 3m . here snapshot link3 . show me no line chart when zoom 6m , 1y , , all . here snapshot link4 . how can happen? thank help. the code: here code used display chart $.getjson(url, function (data1) { $.getjson(urlprediction, function (data2) { var ohlc = [], volume = [], closed = [], forecast = [], datalength1 = data1.length; datalength2 = data2.length; (i = 0; < datalength1; i++) { ohlc.push([ data1[i][0], //

java - Bind HashTable/Map to Jtable -

i have c# background , i'm pretty new java. trying port windows application mac using java. the issue have how bind hashtable contains class jtable variables in key show in jtable. in c# wpf it's easy, binding gridview.itemsource dictionary.keys. in java seems more complicated. here have far: map<files, string> files = new hashmap<files,string>(); public class files { public files(string files, string duration, string status) {} } public void addfiles(string addfile, string addduration, string addstatus, string path){ files.put(new files( addfile, addduration, addstatus), path); } in c# class little different, can gridview.itemsource = files.keys , voila, shows upp perfectly. how can achieve similar in java? i know jtable can use multidimensional array load values, right trying load values of hashtable object[][] tabledata , use: string[] columnnames = {"

Php Mysql multisearch functionality -

the issues finding particular businesses based on multi categories. following mysql tables: business_tbl: id | business_name | cat_id | cat2_id | cat3_id | sub_cat_id | sub_cat2_id | sub_cat3_id 1 bz1 1 2 3 1001 2001 3001 2 bz2 1 2 3 1002 2002 3002 3 bz3 1 2 3 1003 2003 3003 business_categories_tbl: id | cat_name 1 food 2 restaurants 3 wine business_sub_categories_tbl: b_sub_cat_id | b_sub_cat_name | b_maincat_id 1001 donuts 1 1002 xx 1 2001 steakhouse 2 2001 yy 2 3001 white 3 3002 zz 3 how can find particular business name based on multi category search? example how mysql query need can search through category ie cat_id, cat2_id , cat3_id, sub_cat_i

simplexml - PHP - String could not be parsed as XML when using SimpleXMLElement -

this question has answer here: “string not parsed xml” php error 1 answer i have string field in database value: <productorderitem> <product> <productoffering> <id>1</id> </productoffering> <componentproduct> <productoffering> <id>10</id> </productoffering> <characteristicvalue> <characteristic> <name>color</name> </characteristic> <value>black</value> </characteristicvalue> <characteristicvalue> <characteristic> <name>imei</name> </characteristic> <value>imei100</value> </characteristicvalue> </componentproduct> <componentproduct> <productoffering> <id>11</id> </productoffering> <characteristicvalue> <characteristic> <name>msisdn</name> </char

create image for database diagram in sql server -

Image
i have created database diagram in sql server. have take 15 more tables in db diagram. take screenshot. can't take screenshot more 5 table. take screenshot 2 or more times. if sql server automatically create image , if in single screenshot means ok. way this? this screenshot. ask chance take 15 tables in single screenshot through sql server? yes, can this. open diagram in ssms, right click on diagram surface (on blank space between tables, not tables themselves) , click "copy diagram clipboard" option. you can paste full diagram whatever program want.

android - How to set focus on button if clicked and buttons are made in xml -

i have created 3 buttons , want change focus of button clicked user using coding there way ? i have seen these links link1 link2 but want know when made instances of these 3 buttons want focus clicked @ time , want change focuscolor on click defined me using coding? can tell me? final button button = (button) findviewbyid(r.id.button_id); button.setfocusable(true); button.setonfocuschangelistener(new view.onfocuschangelistener() { @override public void onfocuschange(view v, boolean hasfocus) { // todo auto-generated method stub } }); try sample code

c# - base class extended object implamentation -

bit of noobie question hey ho. example: baseclass bc = new extendedclass(); //assume extendedclass inherits baseclass ((baseclass)bc).extendedmethod(); bc.extendedmethod(); ((extendedclass)bc).extendedmethod(); //overridden in extendedclass extendedclass ec = new extendedclass(); ((baseclass)ec).extendedmethod(); ec.extendedmethod(); ((extendedclass)ec).extendedmethod(); //overridden in extendedclass ? what implementations bc.extendedmethod(); , ec.extendedmethod(); call @ runtime? different? assume casted calls call specific implementation within class. edit: added relevant tag. public class base { public void extends() { console.writeline("base class"); } } public class extend : base { public new void extends() { console.writeline("extend class"); } } public class program { public static void main() { base b = new base(); b.extends(); extend e = new extend();

c# - Is it bad practice to have multiple DoWorkEventHandlers? -

i have gui-application perform different validations. of these validations might take longer running them in backgroundworker, current code looks this: //sample validator interface public interface validator { void validate(); } //bgws dowork-method: private void mybackgroundworker_dowork(object sender, doworkeventargs e) { validatora.validate(); validatorb.validate(); validatorc.validate(); } now there validators have support cancelation well. can achieved adding pile of code or can way: public interface validator { void dovalidationwork(object sender, doworkeventargs e); } class normalvalidator { void dovalidationwork(object sender, doworkeventargs e) { //validation-work } } class cancelablevalidator { void dovalidationwork(object sender, doworkeventargs e) { backgroundworker bgw = sender backgroundworker; while(!bgw.cancellationpending) { //validation-work } } } //setup myb

select - Optimize MySQL query with larger database -

how can write below query efficiently select distinct a.id table1 a.id not in (select distinct b.id table2 b) post query result inserted table2 via insert query. the problem table1 has approx ~75300 records , table2 has ~74000 records. this query executed every 10 mins , takes approx 1.5 mins execute. any possibilities query faster? try using join select distinct a.id table1 left join table2 b on a.id = b.id b.id null the left join clause select rows a regardless of whether or not there matching rows in b . can use where clause @ end ensure rows returned a have no match in b

c# - how to map multiple routes in mvc -

i having home controller default action landing. but errorcontroller default action should index in registerroutes method in global.cs, had written : - routes.maproute( "default", // route name "{controller}/{action}/{id}", // url parameters new { controller = "home", action = "landing", id = urlparameter.optional } but when trying redirect error application_error event : - exception error = server.getlasterror(); string redirecturl = "~/error/id=" + errorid; httpcontext.current.server.clearerror(); httpcontext.current.response.redirect(redirecturl); it throwing error - action landing not found. just add route above current route more specific error case: routes.maproute( "error", // route name "error/{action}/{id}", // url parameters new { action = "index", id = urlparameter.option

javascript - Tiny mce height different in different browser -

i have code in js: tinymce.init({ width: "100%", height: "550", }); yet height on tinymce seen differently in different browser. idea how can solve issue? this depends on how big differences are. because each browser has differences in rendering textarea's, buttons etc.

Is there a Python MySQL API that returns Prepared Statements for re-use? -

neither mysqldb nor oursql allow returning prepared statements filled parameters successive executions. there others? at least .executemany() oursql seems more proficient mysqldb sql statement prepared once submitted values. (does python support preparation , re-use of prepared statements postgresql?) for postgresql question, answer there no python-specific way handle prepared statements @ least of last october (i not python programmer common across languages). postgresql offers sql-language way language can use prepared statements if sql queries can executed. code examples on how in python, see http://initd.org/psycopg/articles/2012/10/01/prepared-statements-psycopg/ there couple of major caveats though. 1 of them prepared statements planned on first run, , plan re-used. works great queries same plan uniformly required (say, simple inserts) causes problems parameters might change enough new plans might required. following ok in cases(there still nasty cor

How to start server for Selenium grid Java Maven setup -

i setup selenium framework maven java. dependencies storing in pom.xml here got doubt.. how start server java -jar selenium-server-standalone-2.18.0.jar -role hub .. should place jar again in folder , should start path ? or shall go maven dependencies folder (.m2\repositories) ? can 1 suggest me ? if question not clear please ping back. explain in different way. thanks raju running selenium grid maven might not idea; depends on , how going do. normally, run selenium tests in parallel against several/many different environments , has considerable resource cost. when start processes maven, run within main thread (as child threads), therefore having resources limited maven's configuration. depends on machine/s , configuration/s, starting grid maven , running few selenium tests in parallel (the hub , couple of nodes 5 instances each) on 1 average machine make maven hang lack of memory. avoid it, can adjust configuration, run tests sequentially (not in parallel, 1 n

java - which email service are used in CloudFoundry in general? -

i trying implement email service project in cloudfoundry. have idea email services used in cloudfoundry in general , how ? there no support email within cloud foundry itself. suggest using mail service sendgrid .

ios - How to draw CALayer border around its mask? -

so, have calayer , has mask & want add border around layer's mask. example, have set triangle mask layer , want have border around layer. can please me solve problem? some suggestions: use opaque shadow instead of border (you have blurred effect). create layer, set background color color want border, mask mask bigger 1 have simulate border width, , put centered behind layer (may not work every shape). do morphological operation on mask image calculate border, instance vimagedilate family of functions (more complicated, , may run performance problems). if know shape , can described mathematically, draw , stroke explicitly core graphics functions. or, in same case (shape known mathematically), use cashapelayer draw border.

spring - java.lang.AbstractMethodError at org.hibernate.ejb.Ejb3Configuration.configure while deploying EAR in JBOSS AS 7 -

i got following error while deploying ear in jboss as7: caused by: org.springframework.beans.factory.beancreationexception: error creating bean name 'entitymanagerfactory' defined in class path resource [meta-inf/springdaocontext.xml]: invocation of init method failed; nested exception java.lang.abstractmethoderror @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.initializebean(abstractautowirecapablebeanfactory.java:1338) @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:473) @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory$1.run(abstractautowirecapablebeanfactory.java:409) @ java.security.accesscontroller.doprivileged(native method) @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbean(abstractautowirecapablebeanfactory.java:380) @ org.springframew

maven - NoSuchMethodError with Hamcrest 1.3 & JUnit 4.11 -

another instance of nosuchmethoderror junit & hamcrest combination. offending code: assertthat(dirreader.document(0).getfields(), hasitem( new featurematcher<indexablefield, string>(equalto("patisnummer"), "field key", "field key") { @override protected string featurevalueof(indexablefield actual) { return actual.name(); } } )); commented lines 152–157 in indexertest.java (commit ac72ce ) causes nosuchmethoderror (see http://db.tt/qkkkte78 complete output): java.lang.nosuchmethoderror: org.hamcrest.matcher.describemismatch(ljava/lang/object;lorg/hamcrest/description;)v @ org.hamcrest.featurematcher.matchessafely(featurematcher.java:43) @ org.hamcrest.typesafediagnosingmatcher.matches(typesafediagnosingmatcher.java:55) @ org.hamcrest.core.iscollectioncontaining.matchessafely(iscollectioncontaining.java:25) @ org.hamcrest.core.iscollectioncontaining.matchessafely(iscollectioncontaining.java:14)