Posts

Showing posts from August, 2010

iphone - How do I implement "Cancel" button inside the method building data source in ModelController.m for Page View Controller -

i have page view controller that's implemented in 3 files. 1 of them, modelcontroller.m implements "generatedata" method, builds , formats pages page view controller. inside method, first thing create progress bar popup "cancel" button. then, inside while() loop, keep building pages , @ same time, every 10th page, update progress bar user see application still generating output. once "generatedata" method completes, i.e. builds pages (and there may on 1,000 or 10,000 pages depending on user input), returns "self" method inside rootviewcontroller.m, in turn passes generated data in "dataobject" "viewwillappear" in dataviewcontroller.m, displays pages in object user. it works great, except "cancel" button. because "generatedata" method runs on main thread, blocks , "cancel" button becomes totally unresponsive. "blocks" of course mean takes cpu cycles, not allowing anyting

php - Start session after destroying it in Codeigniter -

in program making sure previous user logged out destroying session before logging in next one, after destroying session $this->session->sess_destroy() errors when trying log next user in (session related operations) how can restart session? thanks when destroying session, doing right, have redirect or re-load url make session re-start.

html - Need help making a sub menu that opens on hover -

i have menu have built working fine, trying add sub menu items appear when mouse hovers on menu item. know how this? <div id="menu"> <a href="#" >home</a> <a href="#">submit new record</a> <a href="#">sales salesperson</a> <a href="#">total sales</a> <a href="#" >sales issue</a> <a href="#" >sales ad size</a> <a href="#" >add new user</a> <a href="#">edit record</a> <a href="#">logout</a> </div></center> <style> #menu{ background-color:#3f9ad1; height:75px; width:1206px; } #menu a{ border-style:solid; border-width:2px; border-color:white; padding-top: 20px; float:left; display:block; width:130px; height:70px; text-dec

coding style - Python PEP 8: Blank lines at the beginning of a module -

there question treat not talk points interested. pep 8 says blank lines: separate top-level function , class definitions 2 blank lines. then if have: a module class: # -*- coding: utf-8 -*- class a(object): pass do separate begin of class , encoding comment 2 blank lines? a module import statement , classes: # -*- coding: utf-8 -*- import module class b(object): pass class c(object): pass do separate import statement , encoding comment 1 blank line? and import statement , begin of class 2 blank lines? and main module: #!/usr/bin/env python # -*- coding: utf-8 -*- import module def main(): = module.a() return 0 if __name__ == '__main__': status = main() do separate import statement , top-level function 2 blank lines? and end of top-level function , conditional statement 2 blank lines? there's python module called pep8 can check code see if complies pep8 guidelines. i tried running pep8 on exampl

android - PhoneGap with Openlayers: popup which to redirect to another page get a error Uncaught ReferenceError: $ is not defined -

i have phonegap application use openlayers show local map. use popup show information of location appeared before marker. append link popup redirect page, error "uncaught referenceerror: $ not defined" when click popup redirect. new pages still show don't have js library or css loaded, generating error "uncaught referenceerror: $ not defined". think js libraries no longer in dom when redirect popup. use ajax load other pages , add dom, reference js libraries in first page index.html. redirect successful other redirections in application. please me error! thanks! based on code , our conversation, links generated outside jqm, won't recognized it. thus, essential link jquery , jquery mobile new link. in code, link generated openlayer , not jqm.

javascript - DurandalJS - navigate without viewmodel refresh -

i have list of contact groups show on view. when click on contact group, want change current hash , load associated contacts. say, have 3 contact groups all (no id) friends (id := 1) family (id := 2) others (id := 3) if click on friends, url need change #/people/1 , callback needs called parameters (id = 1). if click on all, no id should passed (#/people) load contacts. something like: router.when("#/people/:id", function (routedata) { console.log(routedata.id); //output: 1 // load contacts id }); router.when("#/people", function () { // load contacts }); function oncontactgroupclick(contactgroup) { router.navigatetowithoutreset("#/people/" + contactgroup.id); } the reason is, have central location not matter if call made via code or hand (change url, or click on hyperlink). a example gmail/contacts if use router.navigateto durandaljs, whole view model reloaded. there way durandaljs without refre

Setting Jquery UI slider's initial value from an input -

i'm trying generalize slider code work few input + slider combinations. i have working - slide slider, input value updates or enter number in input, slider moves proper location. however, i'm having trouble initializing sliders default values of inputs. here's code looks like: javascript $(".slider").slider({ min: 0, max: 5, value: $(this).parent().find(".inputnumber").val(), step: 0.25, slide: function (event, ui) { $(this).parent().find(".inputnumber").val(ui.value); } }); html <div class="inputwrap hidden"> <input class="mini inputnumber" type="text" value="0.5"> <div class="slider"></div> </div> this works me (with number of sliders): $(".slider").slider({ min: 0, max: 5, step: 0.25, slide: function (event, ui) { $(this).pa

c++ - Settings menu UI implementation -

i'm trying implement bb10 settings menu, looking 1 in calendar app example. question here is, components should use? using listview xml model looks great, incompatible translation. using c++ model looks overkill simple menu couple of entries… there's established pattern somewhere, can't find it. screenshot of calendar app settings view what want expendable content property of title bar :

Long string in Crystal Reports -

i have report cr. in report check if record exist more once in table, if it's case concatenate column "other" of these records , display 1 line in report concatenated value. however, concatenated string long , think stringvar has limit of 254 characters. if think use more 1 stringvar can not guess how many variables should declare since can not guess every time how many duplicated records have. please? thanks ! walloud

node.js - Chunk event never fires in https request -

i'm testing calls api (splunk). when call in curl, works expected. curl -k -v -u admin:password -d 'search=search error | head 10' -d "output_mode=json" https://192.168.50.16:8089/servicesns/admin/search/search/jobs/export this works correctly , returns body containing json array of results. but when try make same request node app, no body. in code below, on chunk event never fires. no errors; request appears go off correctly , 200 header "content-type":"application/json; charset=utf-8". why no body/chunks? request method differently here curl do? far can tell, these should exact same request. while troubleshooting, make quick php script echo'd post vars. when pointed code @ script instead, worked fine - got chunks php output. i'm left try figure out why api might respond correctly request curl, not 1 node.js. thoughts? var https = require('https'); var querystring = require('querystring

javascript - jCanvas - Stretching image to fit height, and letting it flow over in width -

i've been trying figure out how scale image/pattern fill canvas in height, go clip in width using jcanvas. i've been trying calculate myself, poor skills in math have not been useful. i've tried google way thru, has been unsuccessful. i emulate "background-size: auto 100%;" code: // path function draw(patt) { that.$canvas.drawline({ layer: true, fillstyle: patt, name: 'mypath', x1: 0, y1: 0, x2: that.toppoint, y2: 0, x3: that.bottompoint, y3: that.height, x4: 0, y4: that.height, closed: true }); } // image var patt = that.$canvas.createpattern({ width: that.width, height: that.height, source: function(context) { $(this).drawimage({ source: that.$laimg.attr('src'), x: 0, y: 0, fromcenter: false, width: that.width, height: that.height }); }, repeat: "repeat", load: draw }); i s

php - mysql, display text format when echoing out content? -

i trying echo out text stored in mysql table, text in column 'content' formated, i.e. has breaks. for reason when echo out text text displaying 1 continious result , want keep text format/breaks when echoing out, there way can this? table: id | user | content 1 5 hello, hows today? 2 4 text php <?php $message_set = read_message(); while ($message = mysql_fetch_array($message_set)) { <div class="message_content"> <? echo "{$message['content']}"; ?> </div> css .message_content{ margin-left:90px; padding-top:9px; padding-right:15px; padding-bottom:20px; } the text displaying 1 continious result, because that's way how line breaks treated in html default php sends output html browser default. have either convert line breaks html <br> tags (e.g. using nl2br() ), or use css style <div> in such way line bre

understanding the reference properties of data.table in R -

just clear stuff myself, better understand when copies made , when not in data.table . question points out understanding when data.table reference (vs copy of) data.table , if 1 runs following end modifying original: library(data.table) dt <- data.table(a=c(1,2), b=c(11,12)) print(dt) # b # [1,] 1 11 # [2,] 2 12 newdt <- dt # reference, not copy newdt[1, := 100] # modify new dt print(dt) # dt modified too. # b # [1,] 100 11 # [2,] 2 12 however, if 1 (for example), end modifying new version: dt = data.table(a=1:10) dt 1: 1 2: 2 3: 3 4: 4 5: 5 6: 6 7: 7 8: 8 9: 9 10: 10 newdt = dt[a<11] newdt 1: 1 2: 2 3: 3 4: 4 5: 5 6: 6 7: 7 8: 8 9: 9 10: 10 newdt[1:5,a:=0l] newdt 1: 0 2: 0 3: 0 4: 0 5: 0 6: 6 7: 7 8: 8 9: 9 10: 10 dt 1: 1 2: 2 3: 3 4: 4 5: 5 6: 6 7: 7 8: 8 9: 9 10: 10 as understand it, reason happens because when execute i statement,

Magento - DB error with product extension -

i have installed extension: http://www.magentocommerce.com/magento-connect/catalog/product/view/id/16917/ sqlstate[23000]: integrity constraint violation: 1452 cannot add or update child row: foreign key constraint fails (`mysite_testsite2`.`cataloginventory_stock_item`, constraint `fk_catinv_stock_item_prd_id_cat_prd_entt_entt_id` foreign key (`product_id`) references `catalog_product_entity` (`entity_id`) o) any ideas how go fixing this? try looking file under folder app/code/[local or community]/[companyname]/[modulename]/sql/[modulename]_setup/mysql4-install-x.x.x.php what fix create table sql... good luck :d

centos - Selinux - File Contexts Look Good, But Selinux Won't Allow Write -

i trying learn selinux. sandbox , using vsftpd experiment with, have vsfptd server running in centos. have annonmous users place files in /var/ftp/incoming. on remote machine can have user log in not place file on remove vsftpd server: $ftp mysql_server connected mysql_server (192.168.1.31). 220 welcome blah ftp service. name (mysql_server:root): anonymous 331 please specify password. password: 230 login successful. remote system type unix. using binary mode transfer ftp> put atd local: atd remote: atd 227 entering passive mode (192,168,1,31,19,161). 553 not create file. ftp> on vsftpd server, aureport -a report shows: [root@mysql_server ftp]# aureport -a avc report ======================================================== # date time comm subj syscall class permission obj event ======================================================== 4. 04/08/2013 13:30:36 vsftpd unconfined_u:system_r:ftpd_t:s0-s0:c0.c1023 21 dir write system_u:object_r:public_content_t:s0 denied 28

python - trying to get return info from one function to another -

i'm trying use functions (something inherently bad @ apparentlyxd) , trying return statement info first , use in second. both rolling dice, first function have first set returned, used in second function give user option reroll. doing wrong in implementation it's not recognizing original dieset list? def rolldie(): die1 = 2 die2 = 2 die3 = 2 die4 = 4 die5 = 5 dieset = [die1,die2,die3,die4,die5] print(dieset) return dieset def reroll1(): rolldie() reroll1 = input("would reroll? yes or no: ") if reroll1 == "no": dieset = [die1,die2,die3,die4,die5] else: count = 0 times = int(input("how many die reroll? ")) while count < times: whichreroll = input("reroll die: ") if whichreroll == "1": die1 = random.randint(1,6) else: die1 if whichreroll == "2": die2 = random.randint(1,6) else: di

c - Linux kernel module copy_to_user not working -

i attepting write linux kernel module raspberry pi. good, except when try use either copy_to_user, or put_user, returns value of "34336" if print llu, , if print character, nothing. the interesting thing working, made changes, stopped working, reverted working version, , no longer works. code module: ssize_t st_read(struct file *filp, char *buf, size_t count, loff_t *f_pos) { char memory_buffer = 'b'; /* transferring data user space */ copy_to_user(buf,memory_buffer,1); /* changing reading position best suits */ if (*f_pos == 0) { *f_pos+=1; return 1; } else { return 0; } } code reading value: fd = open("/dev/systimer", o_rdonly); // check errors if(fd < 0) { perror("open(o_rdonly)"); return errno; } else close(fd); read

asp.net - No parameterless constructor defined for this object. MVC4 Razor, already elminated any parameters in constructor -

update: added bind exclude select list items. now, i'm getting there no viewdataitem of type ienumerable has key blah blah... if can't use viewmodel select lists, point? getting error on post action. know has been asked before, 've followed instructions no avail. thoughts wrong? not sure if should include view or not... here model: public class outreach { [displayname("number of mailings")] [range(1, 100000,errormessage="please positive number number of mailings")] public int mailings { get; set; } [displayname("number of calls")] public int pcalls { get; set; } [displayname("number of emails")] public int emails { get; set; } [displayname("number of walkins")] public int walkins { get; set; } [displayname("number of faxes")] public int faxes { get; set; } public int osid { get; set; } public int month { get; set; } public int year { get

Send string via Bluetooth from Raspberry Pi to Arduino C -

i trying send string via bluetooth raspberry pi arduino connected hc-05 bluetooth chip via c code. i have received data arduino on pi using rfcomm socket get's initialised on pi written arduino via bluetooth dongle , read pi. is there similar method can initialise , write data bluetooth dongle sent arduino.

sql server - T-SQL Query showing Random Results and is Not Ordering Results in DESC Order -

i having issues following t-sql query. first query shown below 1 working fine historically. there no date parameter in query , grouped top scores user , listed top scores in descending order. the second query 1 not doing it's supposed to. basically, instead of ordering results in descending order highest lowest, it's showing top scores shows them in random order. first query w/ no date parameters (this working should showing top scores in descending order): with gscore ( select top 10 userid, max(gamescore) score rg_gamescore gameid = 15 group userid order max(gamescore) desc ) select gscore.score gamescore, usr.userid, usr.displayname gscore inner join rg_users usr on gscore.userid = usr.userid second query date parameters (not working should, showing top scores not listing them in descending order, seems randomizing them every time run query): with gscore ( select top 10 userid, max(gamescore) score rg_g

sml - output file to stdin -

how 1 output characters in file stdin in sml/nj? here have far i'm stuck i'm getting errors thrown @ me compiler. code: fun outputfile infile = let val ins = textio.openin infile; fun helper copt = case copt of none = textio.closein ins; | some(c) = textio.output1(stdin,c); helper(textio.input1 ins)); in helper ins end; any thoughts i'm going wrong? well, depends on trying file input. if want print characters read file, without outputting file, can print output: fun outputfile infile = let val ins = textio.openin infile; fun helper copt = (case copt of none => textio.closein ins | c => print (str c); helper (textio.input1 ins)); in helper (textio.input1 ins) end; outputfile "outtest"; (*if name of file "outtest" call way*) however, above example bad, since give infinite loop, when hits none, not know how terminate , close file. therefore, version cleaner, more

validation - execute action is not considering actual result name in Struts2 -

let me ask question, maybe simple, newbie in struts2. i have action method in profileaction action: @override public string execute() throws exception { httpservletrequest request = servletactioncontext.getrequest(); httpsession session = request.getsession(); string id = (string) session.getattribute("id"); if (id != null && !id.equals("") && !id.equals("0")) { return success; } return "nosession"; } and in xml: <action name="perfil" class="agenda.profileaction"> <result name="success" type="tiles">/profile.tiles</result> <result name="nosession" type="tiles">/login.tiles</result> </action> <action name="conexion" class="agenda.profileaction" method="login"> <interceptor-ref name="jsonvalidationworkflows

php - zend framework 2 How do i link a file in the controller (What is the path) -

how link file in controller $openuuserpersonalfile = fopen("/zendebayapp/data/usersinformationin/userpersonal.txt", "r"); echo fgets($openuuserpersonalfile) . "<br />"; fclose($openuuserpersonalfile); would corrent? here how link file in layout /zendebayapp/public/css/mainpagelayout.css this controller is: \zendebayapp\module\application\src\application\controller assuming you're using zf2 skeleton application, you'll notice public/index.php contains line like: chdir(dirname(__dir__)); that's changes directory root of project. so reference file in example, you'd do: $fp = fopen('data/usersinformationin/file.txt', 'r');

Python and json, How to print data["key"] -

i have simple scraping code: import urllib import re import json htmltext = urllib.urlopen("http://dx.com/p/getproductinforealtime?skus=48616") htmltext = json.load(htmltext) print htmltext it outputs: {u'data': [{u'sku': 48616, u'isshowdiscount': false, u'currencycode': u'usd', u'issoldout': false, u'adddate': u'10/28/2010', u'discount': 0, u'currencysymbol': u'us$', u'price': u'4.20', u'listprice': u''}], u'success': true} i can not figure out how data in correct format can use terms on left side of colons key terms on right side. i to print htmltext["sku"] 48616 or print htmltext["price"] 4.20 any ideas on this? what have there dictionary key data , so access inner list with: htmltext[u"data"] then access "sku" , need access dictionary within list in "data"

Very beginner - Reading a fixed number of characters in a line C++ -

this pretty basic question i've started in c++. read 20 characters of line file (text). example: wayne, bruce 0000000 i want save "wayne, bruce" , spaces following string. i've been trying while , can't figure out how go this. such, if me out, ask answer kept simple. tried googling , think found answers, of them way on head. thank you. #include <algorithm> #include <fstream> #include <string> int main() { std::string str; std::ifstream file("test.txt"); std::copy_n( std::istreambuf_iterator<char>(file), 20, std::back_inserter(str) ); } note isn't safe if file in question has less 20 chars.

java - How to fix bad Double-Buffering -

i tried following double buffering tutorial, , don't know did wrong. works before before did tutorial, there still , occasional flicker here , there. have 2 files game , gameloop game: import java.awt.graphics; public class game extends gameloop { public void init() { setsize(854,480); thread th = new thread(this); th.start(); offscreen = createimage(854,480); d = offscreen.getgraphics(); } public void paint(graphics g) { d.clearrect(0, 0, 854, 480); d.drawimage(disk, x, y, this); g.drawimage(offscreen , 0, 0, this); } public void update(graphics gfx) { paint(gfx); } } gameloop import java.applet.applet; import java.awt.graphics; import java.awt.image; import java.awt.mouseinfo; import java.awt.point; import java.awt.pointerinfo; import java.awt.event.keyevent; import java.awt.event.keylistener; import java.awt.event.mouseevent; import java.awt.event.mouselistener

ruby on rails 3.1 - How can I render partial in show.html.erb -

i have these 2 models in ruby on rails application - artist , song. associated follows: class artist < activerecord::base has_many :songs attr_accessible :artist_name and class song < activerecord::base belongs_to :artist attr_accessible :title, :track_url, :artist_id i have code in views/artist/show.html.erb: <%= render 'artist_song' %> <table> <% @artist.songs.each |song| %> <tr> <td><%= song.title %></td> </tr> <% end %> </table> the partial im trying render(_artist_song.html.erb) in same view looks this: <table> <% @artist = artist.all %> <% @artist.each |artist| %> <tr> <td><%= link_to artist.artist_name, artist %></td> </tr> <% end %> </table> the way suppose work when click on artist shown trough partial, code below partial has show

d3.js - D3: ordinal scales, rangebands, and the new york subway -

i've got visualization showing median income levels in census tracts nyc subway runs through (image here — https://dl.dropbox.com/u/17156665/screen%20shot%202013-04-08%20at%209.56.20%20pm.png ). looking show stops in boroughs. using file data ( https://docs.google.com/spreadsheet/pub?key=0apl2zvhpomondfdtuwhxv252elnorvnqt0g5y0nzv1e&output=html ). thinking best way draw single vertical line when county switches, , appending name of borough @ bottom. right i've got series of rects in background if statement coloring each, it's pretty clunky. have played around ordinal scales , rangebands no avail. better solutions appreciated. (this interesting juxtaposition of data!) imo ordinal scale unwieldy this, more importantly, there problem in case in line goes through same borough more once (like m line, starts , ends in queens); because ordinal scale expects unique values. probably best solution first build array of data representing each borough's start

python - pip freeze and order of dependencies -

`pip freeze > requirements.txt` automatically writes dependencies in apparently alphabetically order, this:- matplotlib==1.2.0 numpy==1.6.2 pandas==0.9.1 the problem pip install -r requirements.txt (when deploy code dependencies listed in requirements.txt ) end failing because matplotlib needs numpy installed first. how can ensure matplotlib listed after numpy in requirements.txt file when pip freeze it? for case not matter, because pip builds every requirements (calling python setup.py egg_info each) , install them all. specific case, not matter, because numpy required installed while building matplotlib . it problem matplotlib , , created proposal fix it: https://github.com/matplotlib/matplotlib/wiki/mep11 see comments issue @ pip issue tracker: https://github.com/pypa/pip/issues/25 this question duplicate of matplotlib requirements pip install in virtualenv .

android - How to get the Map Extent change event in OSMdroid? -

i using osmdroid library in custom android app. at every extent change (& when map zoomed in) want query sqlite database , records lie within extent. need similar map extent change event. i not find such event on mapview class. how achieve want do? update using maplistner this: mapview.setmaplistener(new maplistener() { public boolean onzoom(zoomevent arg0) { return false; } public boolean onscroll(scrollevent arg0) { onextentchange(); return false; } } ); but onscrollevnt fired several times each pan of map. how last or final scrollevent? setmaplistener(new delayedmaplistener(new maplistener() { public boolean onzoom(final zoomevent e) { //do return true; } public boolean onscroll(final scrollevent e) { log.i("zoom", e.tostring()); return true; } }, 1000 ));

c++ - no matching function error in the case of relation between base class and extend class -

i got 2 classes: tjob , reload_job. reload_job extends tjob: class reload_job: public tjob i got function: void run_all_threads(std::vector<tjob*> &jobs){...} and call: std::vector<reload_job*> jobs; thread_pool->run_all_threads(jobs); //error: no matching function a got error @ call. however, if changed function's form into: void run_all_threads(tjob* job) and call: reload_job* job; thread_pool->run_all_threads(job); work could guys me explain why got compling error in case of vector of tjob pointer. much! your issue stems fact vector< reload_job* > not sub-type of vector< tjob* >, though reload_job sub-type of tjob. in first example, compiler searches function signature run_all_threads(vector < reload_job* >) . there no function signature. void run_all_threads(std::vector<tjob*> &jobs){...} std::vector<reload_job*> jobs; thread_pool->run_all_threads(jobs); //error: no function matches

java - How to use FEST tests with Groovy's GMock framework -

i'm trying use fest swing test suite write test different interface responses. in single class situations works well. however, have situation have using gmocktestcase. set mocked method calls returns , create "play" enclosure, asserts fail. if run same test without mocked class test passes. there order in things must set up? here test: @test void testsshouldreturnradiobuttonselectedfromclassgroupbuttongroupkeypressed(){ def mockclassmap = getclassmap() mockpg.getavailibleclass().returns(mockclassmap) panel.plygen = mockpg panel.racevalue = 1 panel.gendervalue = 2 panel.gpane.mainm.setvisible(false) panel.gpane.createplayerstats.setvisible(true) //panel.plygen = new playergenerater() play{ festsetup(panel.gpane.chooseclass) panel.gpane.rerolldice.requestfocusinwindow() // simulate key stroke change panel view robot.keypress(vk_a) robot.keyrelease(vk_a) // simul

java - How to convert "MM-dd-yyyy hh:mm" String date format to GMT format? -

my date format "mm-dd-yyyy hh:mm" not current date ,i have send date server before send need change date gmt format when change following code: private string[] dateconvertor(string datevalue) { string date_value[] = null; string strgmtformat = null; simpledateformat objformat,objformat1; calendar objcalendar; date objdate1,objdate2; if(!datevalue.equals("")) { try { //specify format objformat1 = new simpledateformat("mm-dd-yyyy,hh:mm"); objformat1.settimezone(calendar.getinstance().gettimezone()); objformat = new simpledateformat("mm-dd-yyyy,hh:mm"); objformat.settimezone(timezone.gettimezone("gmt")); //convert gmt format //objformat.settimezone(timezone.getdefault());//); objdate1=objformat1.parse(d

css - Gap/Space between header 1 and 2 -

i'm trying place h2 right below h1, seems creating huge gap/space. there way avoid or error in coding? thank you. link site: http://younani.com/armen/musicindex.html html: <!doctype html> <html lang="en"> <head> <title>armens website</title> <meta charset="utf-8"> </head> <body> <div class="clearfix" id="container"> <p><link rel="stylesheet" href="armen.css" /></p> <h1><i>four floor</i></h1> <h2>artist management &amp; events</h2> <p></p> <h3>&ldquo;it&rsquo;s not take things from,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; it&rsquo;s take them to.&rdquo; <br />&nbsp; &nbsp; &nbsp; &nbsp

android - Gettine Exception: java.lang.IllegalStateException: database not open -

although common error , there may many posts related exception. here strange situation. getting java.lang.illegalstateexception: database not open exception in android 2.2. in remaining mobiles working well. logcat: java.lang.illegalstateexception: database not open @ android.database.sqlite.sqlitedatabase.querywithfactory(sqlitedatabase.java:1291) @ android.database.sqlite.sqlitedatabase.query(sqlitedatabase.java:1251) @ android.database.sqlite.sqlitedatabase.query(sqlitedatabase.java:1331) @ com.mythrii.ilpa.datahelper.checkrating(datahelper.java:126) @ com.mythrii.ilpa.splashactivity$1.run(splashactivity.java:35) @ android.os.handler.handlecallback(handler.java:587) @ android.os.handler.dispatchmessage(handler.java:92) @ android.os.looper.loop(looper.java:144) @ android.app.activitythread.main(activitythread.java:4937) @ java.lang.reflect.method.invokenative(native method) @ java.lang.reflect.method.invoke(method.java:521) @ com.android.internal.os.zygoteinit$methodandargsc

Sorting data from database with Rails -

i suspect question stupid , answer obvious, totally stuck it. in controller movies_controller.rb have method index , fills array @movies values database calling @movies = movie.all , , method sort , same, use @movies = movie.order(:title) instead. if call sort explicitly index see in view index.html.haml sorted title list of movies expect. but, how can call method sort clicking on link? try in index.html.haml: %th= link_to 'movies title', 'movies', :on_click => 'self.sort' in routes.rb: match ":controller => movies, :action => sort" => 'movies/index' and nothing happening, method sort never executes. actually, have no idea how right. looks obvious everyone, me. can find short answer how right? please, kick me in right direction! if looking sorting data in table need plug in in place sort table according attribute. following jquery plugin that, https://github.com/linjunpop/jquery-tablesorter-rai

javascript - HTML Page Layout Change at Runtime -

a html page contains 3 frames. <frameset cols="30%, *"> <frame src="frame_a.htm"> <frameset rows="60%, *"> <frame src="frame_b.htm"> <frame src="frame_c.htm"> </frameset> </framset> what need is, change frames layout 2 other styles on click event of button. page contains 3 buttons, 1) default style, 2) style-2, 3) style-3 <!-- style-2 --> <!-- <frameset cols="*, 30%"> <frameset rows="60%, *"> <frame src="frame_b.htm"> <frame src-"frame_c.htm"> </frameset> <frame src="frame_a.htm"> </frameset> --> <!-- style-3 --> <!-- <frameset cols="30%,35%,35%"> <frame src="frame_a.htm"> <frame src="frame_b.htm"> <frame src="frame_c.htm"> </frameset> --> how can this, when page loaded , user cl

java - String functions not working properly -

this program.it shouldnt print sentences starting word "ltp" or sentences containing word "trailing" ,but doesnt that..i dont understand why.please me this. import java.io.*; public class fileinputdemo { public static void main(string args[]) { // args.length equivalent argc in c try { // open file first // command line parameter fileinputstream fstream = new fileinputstream( "c:\\documents , settings\\work\\desktop\\new folder\\new folder\\02apr2013log1.txt"); // convert our input stream // datainputstream datainputstream in = new datainputstream(fstream); // continue read lines while // there still left read while (in.available() != 0) { string s=in.readline(); // print file line screen if(s.startswith("ltp") || s.contains("trailing"))

linux - Not able to see the Perl output executing from Java class -

i using java class execute perl script on linux box. .class being created successfully. when execute class, says exit code successful sop , i'm not able see perl output or execution of script. if execute perl directly, works fine... this perl script: #!/usr/local/bin/perl print ("enter distance converted:\n"); $originaldist = <stdin>; chop ($originaldist); $miles = $originaldist * 0.6214; $kilometers = $originaldist * 1.609; print ($originaldist, " kilometers = ", $miles, " miles\n"); and java class call script: import java.io.inputstream; import java.io.inputstreamreader; import java.io.bufferedreader; import java.io.ioexception; class test { public static void main(string[] args) throws ioexception { string[] acmdargs = { "perl", "-e" , "pl newprg.pl" }; runtime oruntime = runtime.getruntime(); process oprocess = null; try { oproces

symfony1 - is database.xml can be replaced by a php class file -

in web application of application in symfony , in non symfony. non symfony have constant class file , symfony have database.yml file. is there chance can use php class file instead of database.yml in symfony. create class having configurable variable @ single point. , in database.yml include class , can call these variable there only.

c# - Hide master page content in pages which are using it at design mode -

this question has answer here: how hide content on pages , not others via master page? 2 answers my maser page broken , when trying design pages inheriting master page shown ugly , non-editable. is there way hide master page content in design mode can continue editing pages without trouble dealing master page content ? there must way disable it.. maybe extension ? try hide control using: style="display:none" in style tag.

java ee - Which is better Struts or Spring and Why? -

i java developer working on swing api. have knowledge of jsp , servlet. wanna learn framework. want know 1 better, struts or spring.and apache's wicket. thanks in advance it depends on want learn them for. struts lot simpler, or maybe smaller, might better start with. struts web framework , it's used define controllers , render views, in mvc architecture. here's more mvc architectures if need it. ususally need combine other frameworks, such hibernate , ejbs finish off project. spring huge, it's more entire platform. has kinds of modules, don't have use of them. spring mvc starting point , equivalent of struts, , there pick other modules, such spring security , spring data, tailor project's needs. here's more spring .

javascript - Change Adfly ads to js -

im trying inject js file. <script> var adfly_id = 3793905; var adfly_advert = 'banner'; var frequency_cap = 5; var frequency_delay = 5; var init_delay = 3; </script> <script src="adf.ly/js/entry.js"></script> and load adding page. <script type="text/javascript" src="http://server.com/adfly.js"></script> is possible? because have no luck. i try this... document.write('<script type="text/javascript">var adfly_id = 3793905;var adfly_advert = 'int';var frequency_cap = 5;var frequency_delay = 5;var init_delay = 3;</script><script src="cdn.adf.ly/js/entry.js"></script>'); -- var adfly_id = 3793905; var adfly_advert = 'int'; var frequency_cap = 4; var frequency_delay = 5; var init_delay = 3; src="cdn.adf.ly/js/entry.js" and var sc = document.createelement('script'); sc.src = "adf.ly/js/entry.js" docume

How to Read JPEG image into BufferedImage object using Java -

Image
this not duplicated question here, because i've been searching solution long time in google , stackoverflow, , still cannot find solution. i have these 2 images: these 2 images same website same prefix , same format. difference size: first larger, while second smaller. i downloaded both of images local folder , used java read them bufferedimage objects. however, when outputted bufferedimages local files, found first image red, while second normal(same original). what's wrong code? byte[] rawdata = getrawbytesfromfile(imagefilepath); // code read raw bytes image file imageinputstream iis = imageio.createimageinputstream(new bytearrayinputstream(rawdata)); bufferedimage img = imageio.read(iis); fileoutputstream fos = new fileoutputstream(outputimagepath, false); imageio.write(img, "jpeg", fos); fos.flush(); fos.close(); ps: used gimp open first image , detected color mode 'srgb', no alpha or other stuff. this apparently know bug, saw s

python - Can I get imshow() like behaviour in a wx.lib.plot.PlotCanvas? -

Image
i'm new wxpython have been matplotlib user time now. developing wxpython app in have simple frame single panel (actually, wx.lib.plot.plotcanvas instance). in panel want show data, in form of binary array (called imarr), one: array of shape (64,n), , n can vary between 400 , 1200 (i can sort out panel sizing myself). to in matplotlib use like: fig=figure(figsize=(12,2)) ax=fig.add_subplot(111) ax.set_ylim(0,63) ax.set_xlim(0,imarr.shape[0]) ax.set_aspect('equal') matplotlib.imshow(imarr) but i'm lost in wxpython. have been looking wx.lib.plot, apart nice line , marker plotting capabilities, there doesn't seem equivalent imshow (or pcolor). one (ugly) solution have use matplotlib above create png image , use wx magic display image on panel (please set me straight if won't easy). i'd prefer within wxpython, portability , general tidiness. advice on how display binary array on wx.lib.plot.plotcanvas (or more generic wx.panel) useful! w

sms - Blackberry 8520 message field comes blank -

Image
in 1 of application need share link via sms. using blackberry os 5.0. here code sharing message via sms. messageconnection mc = null; try { mc = (messageconnection) connector.open("sms://"); } catch (ioexception e) { e.printstacktrace(); } textmessage textmessage = (textmessage) mc.newmessage(messageconnection.text_message); textmessage.setaddress("sms://"); system.out.println("======1===="); textmessage.setpayloadtext("afasdfadsfsdaf"); invoke.invokeapplication(invoke.app_type_messages, new messagearguments(textmessage)); in case of 9810 shows message box text. following image. i using same code 8520. image follows:- please me out whether feasible, if not please share me specific link feature not feasible. thanks

c++ - boost::bind implicit conversion to boost::function or function pointer -

i'm using boost::function this: template<class t1> void run(boost::function<void (t1)> func, string arg) { t1 p1 = parse<t1>(arg); func(p1); } when used this, ok: void test1(int i) { cout << "test1 i=" << << endl; } ... boost::function<void (int)> f = &test1; run(f, "42"); i want able pass raw function pointer directly, overload run() function this: template<class t1> void run(void (*func)(t1), string arg) { t1 p1 = parse<t1>(arg); (*func)(p1); } ... run(&test1, "42"); // ok now, want able pass result of boost::bind run() function. this: void test2(int i, string s) { cout << "test2 i=" << << " s=" << s << endl; } ... run(boost::bind(&test2, _1, "test"), "42"); // edit: added missing parameter 42 but wont compile: edited bind.cpp: in function ‘int main()’: bind.cpp:33:

Manipulating data in a complex mongoDB data model -

{ name: “bimal”, role: “developer”, reports_to: “girish”, technology:[{ name: “php”, rating: 5 },{ name: “javascript”, rating: 4 }], project: [{ project_name: “tgt”, client_name: “said”, estimated_time: 20, tasks: [{ start_time: new date(2013, 2, 13, 7, 47), end_time: new date(2013, 2, 15, 7, 47), description: “design page” }, { start_time: new date(2013, 3, 13, 7, 47), end_time: new date(2013, 2, 13, 7, 47), description: “coding page” }] }] } i have complex database structure. need add new technology , rating after javascript.also need edit description of task has a description "design page". to add new technology use either $push or $addtoset. update description in project section use positional operator $ $set . remember in subdocument order not maintain time . in case want order in technology key , please add 1 more key called order , use in each subdocument . while show

Making a cell in selected row non editable in kendo grid -

i have kendo grid making column non editable when grid loads using editable:false property. but when new record created , user can select values form combo box in grid.if particular value selected non editable field must editable.i have tried following code. nothing happens. event_type: { validation: { customfn : function(input){ if(input.attr('name')=='event_type'){ input.attr("validationmessage", "<?php echo messageclass::setmessage("er037", "event type") ?>"); if(input.val()== "--select--" || input.val()== '') return false ; if(input.val()=="invoice"){ alert("invoice"); var grid = $("#eventgrid").data("kendogrid"); $('#event_type').attr('readonly','readonly');

eclipse - Java uses a String constant with the quotes -

Image
when compare constant string mb inside variable mb inside result false. string constant looks "mb" ([",m,b,"]=4 length) , variable "mb" ([m,b]=2 length). what's wrong here. java cannot put quotes inside code string. public static final string gc_telcodefixed = "fx"; if (!telcode.getid().equals(com.quoka.qis.db.constant.constants.gc_telcodefixed)) throw new telcodetypemismatchexception(telcode.gettype()); invisible characters might cause behavior. how did "mb" got there? did type them or copy-paste program? copy-paste operation might end invisible characters , text editors not show them. this can reproduced copying pdf file linux document viewer. hope helps, yaron

object - Working with Types in Perl -

i worked fortran since years , types within fortran of course. now, since employed @ new company, have work perl. since main work operate data within text file , have read through file, want generate "objects" or "types" data. in fortran further work easier :) is possible perl generate types strict type schema can in fortran? for example ... in fortran: type demotype integer character(256) str end type then can work variables of type. type(demotype) demovar e.g. is there chance work in perl? sorry english ... native german speaking :) there cpan modules can you. option: class::struct (which belongs standar perl distribution, no further installation required). example (taken module documentation): use class::struct; struct( rusage => { ru_utime => 'timeval', # user time used ru_stime => 'timeval', # system time used }); struct( timeval => [ tv_secs => '$',

python - How to parse Django templates for template tags -

situation i'm writing checker program checks django templates. example want check if django templates use url template tag, use quotes on first parameter django 1.5 compatible. want check have included {% load url future %} in templates. for example if program parses following django template, want raise exception. {% extends 'base.html' %} <td> <a href="{% url first second %}"> </a> </td> but template should parsed without exception. {% extends 'base.html' %} {% load url future %} <td> <a href="{% url 'first' second %}"> </a> </td> i'm not limited simple example. have other parsings do. example want check how many load template tags present in template. question how can elegantly solve parsing problem? i don't want use regular expressions. i django self has utilities in regard. think using them idea, don't know how. i want run program separate