Posts

Showing posts from April, 2010

java - do I have odbc/jdbc and their drivers installed and configured by default? -

i have got confused odbc/jdbc concepts,i know mean , how work,but have questions,it kind of me answers. have used sql server db never installed , configured odbc or driver,what this?do have them installed , configured default? necessary have odbc/jdbc , drivers installed , configured ? why should java have jdbc?why can't use odbc other programming languages? can use example c# , jdbc? i have used sql server db never installed , configured odbc or driver,what this? i thought said knew odbc was? kind of sounds not not sure? an odbc driver open database driver connection generic way connect databases. might work basic functionality it's typically best more specific driver type database you're using. do have them installed , configured default? you have odbc drivers default (i'm not sure system you're on or how set up) connections not configured. can configure them environment variables in windows (if that's you're using) or withi

android - Is it dangerous not closing Cursor in getCursor method? -

i've made own getcursor method looks this protected cursor getcursor(string selectquery) { sqlitedatabase db = this.getwritabledatabase(); cursor cursor = db.rawquery(selectquery, null); return cursor; } since cannot call cursor.close() before return it, dangerous leaving cursor open this? or close method returns object? you @ some point "toomanycursorsexception" - or something that . you're using cursor have try {} finally{} block , in say: if(cursor != null) { cursor.close(); } i used web programming create model pojos when reading data dao , use in up-levels. never sending cursor above layers.

validation - Determine if a form element has any validators attached -

is possible determine if form element has validator attached? example... <input type='text' required /> <--- has validator <input type='text'/> <--- has none i have directive assigns image depending on whether valid or not @ moment showing valid when there no validator rules assigned. you're in directive: var link = function(scope, ielement, iattrs) {} couldn't check iattrs.required ? alternatively, i'd implement angular's ng-required directive on inputs, check $dirty , $invalid flags on form. check fiddle more info: http://jsfiddle.net/euqtn/

javascript - Limit backbone Model attributes that server sends to page? -

i have been reading on backbone.sync , backbone parse. admit confused. have bb model inheriting model , sending attributes page. want limit attributes sends page, right sending database table (only want id, fname, lname, etc). model wont used save, reference within page. question override backbone.sync or parse , do on inheriting model or "super" model? initial call: tss.principal = new tss.models.user(@html.raw(this.user.tojson())); inheriting model principal use: tss.models.user = _.extend(tss.models.user, { parse: function (response, options) { this.set("roles", new tss.collections.roles(response.roles)); response.roles = null; return tss.models.user.parse.call(this, response, options); } }); actual "super" model: tss.models.user = backbone.model.extend({ idattribute: "id", urlroot: tss.paths.data + '/usersapi' }); you should doing serverside (in user.tojson() function) , prevent dat

asp.net mvc - Retrieving previously uploaded file -

i wondering if possible in mvc4 (.net 4.5) upload file server , save memory. in separate form post, collect file , deal @ point. i need able upload file on 1 part of page , able submit form details on another, able access file have uploaded. logical reasons, cannot have file posting @ same time on main form. must separated. while store file in memory session, there few risks in doing so: what if resets app pool or web server? data lost can user upload large file? lots of small files uploaded? need make sure can handle memory requirement if these aren't concerns, feel free store file in session: session["uploadedfile"] = somebytearray; if these concerns, suggest: store file on disk , fetch when need to store data in session database

windows - copy folder to multiple servers with different %userprofile% -

i not have access gpo or ad/ou, found easiest create batch file users. here want achieve : i have on 50 servers, , 10 users connecting these machines. on different machines, want populate, 1 location (1 main server, 1 main location/main user), internet favorites (c:\users\main user\favorites\links) on every machine... i want create batch file, minimum user manipulation, . basicly, give batch file 10 users, , launch on 1 machine, , populate links %userprofile%, location of choice. i started figuring xcopy, advice/help on completing it. xcopy "\\nameofmachine\c$\users\main user\favorites\links" "\\serverlist.txt\c$\users\%userprofile%\favorites\links" /e /i i think easiest way so. initial location updated monthly new links... if user running should mirror source target folder, making them identical. @echo off robocopy "\\nameofmachine\c$\users\main user\favorites\links" "%userprofile%\favorites\links" /mir

email - Create automatically PDF from article and include them as attachment in Mail in Drupal -

on drupal 7 site, create pdf's of articles printer, email , pdf versions module . pdf version of each article available at /printpdf/nid the next thing im sending articles newsletters simplenews module . want attach created pdf attachment mail. if there field file in contenttype, , example pdf uploaded , send node, pdf attached mail. but in case want create pdf of article , attach pdf mail sending simplenews module. i have solved problem writing own module. this module uses hook_node_submit create pdf (with dompdf), save server , place field of contenttype when node saved or edited. this way pdf sent attachement in mail.

llvm - Simple CPP file failed to compile with Clang -

#include "clang/ast/astconsumer.h" #include "clang/ast/recursiveastvisitor.h" #include "clang/basic/diagnostic.h" #include "clang/frontend/compilerinstance.h" #include "clang/basic/filemanager.h" #include "clang/basic/sourcemanager.h" #include "clang/basic/targetoptions.h" #include "clang/basic/targetinfo.h" #include "clang/frontend/compilerinstance.h" #include "clang/lex/preprocessor.h" #include "clang/parse/parseast.h" #include "clang/rewrite/rewriter.h" #include "clang/rewrite/rewriters.h" #include "llvm/support/host.h" int main() { return 0; } i compiling clang++ -i/home/pc/llvm-3.3.src/tools/clang/include -i/home/pc/llvm-3.3-build/tools/clang/include -i/usr/local/include -fpic -fvisibility-inlines-hidden -wall -w -wno-unused-parameter -wwrite-strings -wno-missing-field-initializers -pedantic

c# : how to read from specific index in List<person> -

i have class of persons , list collection list contains values of person class such : list ilist has 2 values [0]={firstname,lastname} . [1]={firstname2,lastname2} now when iterating list able print list want change value of parts of list e.g in index 1 if want change value of firstname2 firstname3 not able . can tell me how print list , on index changing value of index , i.e. firstname , secondname variable in person class can update values according docs on msdn can use familiar index operator (like on use on arrays). mylist[1].lastname = "new last name"; should you. docs here; http://msdn.microsoft.com/en-us/library/0ebtbkkc.aspx keep in mind need bounds checking before access.

indexing - Solr field depth -

how 1 set solr such have "child" node fields? example, doc, there exists 2 cars, each car has subset of colors. for example: <doc> <field name = "make"> toyota </field> <field name = "car"> camri </field> <field name = "color"> silver </field> <field name = "color"> red </field> <field name = "car"> corolla </field> <field name = "color"> blue </field> <field name = "color"> red </field> <doc> how 1 go getting these relationships indexed? the general practice denormalize database solr works plain schema. example, can make multi-valued field , put these values it: camri/silver camri/red corolla/blue corolla/red

sql - BCP syntax error in sybase -

i'm running bcp code through command line looks similar below bcp tempdb..temptable out output.txt -s servername -i, -u username –p pword –r \n -t each time , error saying "syntax error in 'úp' if remove after username able code work prompted password gives table in format imposssible use. could advise syntax error may occuring? from can tell, appears have few issues. -i not valid option -t should specify field delimeter you haven't specified mode (character or native) (-c or -n) assuming trying create csv, here's may looking for: bcp tempdb..temptable out output.txt -s servername -u username -p password -c -t , -r \n you may find page helpful bcp section of sybase ase utility guide it's ase 15.5 docs, syntax same versions 12.0 , newer.

sql - Partition scheme change with clustered Index -

Image
i have table has 600 million records , has partition on ps_trpdate(trpdate) column, want change partition ps_lpdate(lpdate). so have tried small amount of data following steps. 1) drop primary key constraints. 2) adding new primary key clustered index new partition ps_lpdate(lpdate). is feasible 600 million records? can guide me it? , how works non partitioned tables? --343 my gut feeling should create parallel table using new primary key, file groups , files. to test out assumption, looked @ old blog post in stored first 5 million prime numbers 3 files / file groups. i used tsql view kalen delaney wrote , modified standards @ partition information. as can see, have 3 partitions based on primary key. next, drop primary key on my_value column, create new column named chg_value, update prime number, , try create new primary key. -- drop primary key (pk) alter table tbl_primes drop constraint [pk_tbl_primes] -- add new field new pk alter table tbl_primes

c - Dealing with a large amount of variables -

i writing large c program , have 1 file file.c contains large number of variables. let's has function named func() being used other files. unfortunately, function func() has use large amount of variables , since contains lot of code i've decided write functions used func() in order make code more readable. now, have 3 main possibilities: declare variables global. declare variables local inside func() , pass these variables arguments functions inside file.c using struct (or other trick can think of). declare variables local , instead of using other functions throw code inside func() result in long , unreadable code. any suggestions ? in general, second option best. over-use of global variables considered bad practice. it's may source of poor performance in cases because global has loaded, whereas if can keep variable local can stored in register. also, code reuse easier. function receives parameter more general. can called in various use c

Redirect back after login -

i need force login visit web site, reason when visitor shows page redirect him login page , if logins or registers web site redirect him time original page visited. problem in last step, i'm not able redirect original page because url not saved in history before first redirect for first redirect use not users <script type="text/javascript"> window.location.href = '/login-guest'; </script> for second redirect, after login or registration use <script type="text/javascript"> history.back(-1); </script> i think need add script add url history before first redirect tx, best regards you try using html5 sessionstorage store users webpage in first script , retrieve in second script edit: code: edit 2: onpageload because of onload() cannot move checkpage function body page 1: <!doctype html> <html> <head> <script> function checkpage(){ if(sessionstorage.visited != 1){

mysql - Convert 3 columns (day,month,year) to PHP Date/Timestamp -

i have database 3 columns, varchar(20) dob_day dob_month dob_year how can convert these php date/timestamp , age of person (the row) for example, if had following: dob_day = 07 dob_month = 08 dob_year = 1994 this needs display 19 user 19 years of age you should storing date of birth date . solution return age database side: select timestampdiff(year,concat(dob_year, '-', dob_month, '-', dob_day),curdate()) `age` result | age | ------- | 19 | see demo

ios - Refreshing annotations mix photos -

first time view controller load, download data web service, use details add annotations. when tap button download again data , put in on again, wrong photos each , every time. tried clear cache , doesn't help, tried lot of ways. ideas? edit: - (void)addcustomerstomap { marker = nil; profilepics = [[nsmutablearray alloc] init]; if ([self.usersnearme iskindofclass:[nsdictionary class]]) { nsdictionary *singleuser = (nsdictionary*)self.usersnearme; self.usersnearme = [[nsarray alloc] initwithobjects:singleuser, nil]; } if ([self.usersnearme iskindofclass:[nsarray class]]) { (int = 0; < self.usersnearme.count; i++) { nsdictionary *dict = self.usersnearme[i]; float lat = [[dict objectforkey:@"lat"] floatvalue]; float lon = [[dict objectforkey:@"lon"] floatvalue]; nsstring *name = [dict objectforkey:@"name"]; nsstring *time = [

Why Stack in java cannot be created with type parameter(generic) -

stack generic class in java, definition class stack<e> extends vector<e> , why cannot instantiate type parameter stack<integer> s = new stack<>(); vector can? of course, can. stack<integer> stack = new stack<>();

Emacs Org Mode: Executing simple python code -

how can execute simple python-code in emacs' org mode? the first example works fine, can't make give me result of simplest computations: ; works #+begin_src python def foo(x): if x>0: return x+10 else: return x-1 return foo(50) #+end_src #+results: : 60 ; not work #+begin_src python 1+1 #+end_src #+results: : none ; not work #+begin_src python print(1+1) #+end_src #+results: : none i set org mode using following lines: ;; enable python in-buffer evaluation (org-babel-do-load-languages 'org-babel-load-languages '((python . t))) ;; python code safe (defun my-org-confirm-babel-evaluate (lang body) (not (string= lang "python"))) (setq org-confirm-babel-evaluate 'my-org-confirm-babel-evaluate) there two ways of getting result of source block - output , value . mixed them up, hence troubles. first block fine. to fix second block: #+begin_src python :results value return 1+1 #+end_src to fix third block: #

ios - Object returned from fetch request has incorrect data -

i attempting object fetch request, , checking property of object. depending on type property cause me display notification or not. after making successful connection, set property type of object 'updated' 'inserted.' then, when refresh view, pull objects coredata , check properties 'updated' type. problem having objects returned in fetch request attempted change 'updated' still display old 'inserted' value fetch request, don't after submission. reverting. (and saving context) what more confusing have gotten program @ actual tables in database file stored on device, , shows correct value of updated in table. fetch request still comes object having incorrect data. , no amount of refreshing fixes issue. how can fetch request giving me objects old/incorrect data when coredata file shows tables correct values? // code fetch request // return array of assets specific customer nsfetchrequest *fetchreq = [nsfetchrequest fetchrequ

postgresql - How to get from Postgres database to Hadoop Sequence File? -

i need data postgres database accumulo database. we're hoping using sequence files run map/reduce job this, aren't sure how start. internal technical reasons, need avoid sqoop. will possible without sqoop? again, i'm not sure start. write java class read records (millions) jdbc , somehow output hdfs sequence file? thanks input! p.s. - should have mentioned using delimited file problem we're having now. of our long character fields contain delimiter, , therefore don't parse correctly. field may have tab in it. wanted go postgres straight hdfs without parsing. you can export data database csv or tab-delimited, or pipe-delimited, or ctrl-a (unicode 0x0001) - delimited files. can copy files hdfs , run simple mapreduce job, maybe consisting of mapper , configured read file format used , output sequence files. this allow distribute load creating of sequence files between servers of hadoop cluster. also, likely, not one-time deal. have load data pos

user interface - A good place to start with angularjs ui (bootstrap) and ng-animate to create a wizard similar to boostrap-application wizard -

i pretty new angularjs , create wizard, similar 1 found here ( https://www.google.com/url?sa=t&rct=j&q=&esrc=s&frm=1&source=web&cd=1&cad=rja&sqi=2&ved=0cckqfjaa&url=https%3a%2f%2fgithub.com%2famoffat%2fbootstrap-application-wizard&ei=zsomutrzn_shsqty3icidq&usg=afqjcnggfj85a77baltojgaohuk0mivhhg&bvm=bv.51495398,d.dmg ) using angularjs ui , ng-animate. any assistance appreciated. thanks, melroy

java - android - Run code before layout is shown -

one of items on app option leads activity. ok, can send option other activity, must read option , hide stuff layout based on info. i have added oncreate method, no succes: bundle extras = getintent().getextras(); string type = extras.getstring("objects"); if(type == "animals"){ imageview fieldswamp = (imageview) findviewbyid(r.id.btnswamp); ((linearlayout)fieldswamp.getparent()).removeview(fieldswamp); imageview fieldgrass = (imageview) findviewbyid(r.id.btngrass); ((linearlayout)fieldgrass.getparent()).removeview(fieldgrass); } then tried on "onlocationchanged" method no success either. i'm not sure if problem in code or if put it. can please help? thanks in advance! try this, because .equalsignorecase better comparing strings, , it'll ignore letters case. if("animals".equalsignorecase(type)){ imageview fieldswamp = (imageview) findviewbyid(r.id.btnswamp); ((linea

android - Galaxy tab 2 7" does not fit sw600dp? -

Image
everywhere in android documentation can ready have use sw600dp 7 inch tablets, not seem true, because galaxy tab 2 7" has 546dp smallest width. http://www.gsmarena.com/samsung_galaxy_tab_2_7_0_p3100-4543.php dp = 600 / (170 / 160) = 546 should use sw500dp in layouts instead? android device pixel densities classified in buckets : while galaxy tab 2 screen may 170 dpi, falls within range of mdpi translates 160 dpi being used in practice dp calculations. device should still have 600dp width.

Export to PDF Using Java or plain html -

i displaying few tables using html table tag , css . using struts 2 , include "export pdf" functionality. right 1 page have use this. later 1 there 1 or 2 more page have use feature. looking easy implement available plugins or jar or can used that. there java api generating pdf. here is: http://itextpdf.com/download.php call servlet or struts action, , use httpservletrersponse.getoutputstream direct pdf document browser.

how to read text file from internet in Android -

i want read remote text file , show content in textview. have written code, doesn't information text file , has "force stop" error. how can find reason of problem or solve it? isn't there wrong in code? private class downloadfile extends asynctask<string, integer, void> { protected void doinbackground() { try { url url = new url("http://host/f.txt"); bufferedreader in = new bufferedreader(new inputstreamreader(url.openstream())); string line = null; while ((line = in.readline()) != null) { //get lines } in.close(); lbl.settext(line); } catch (malformedurlexception e) { e.printstacktrace(); } catch (ioexception e) { e.printstacktrace(); } } protected void onprogressupdate() { //called when background task makes progress } protected void onpreexecute() { //called before doinbackground() started } protected void onpostexecute()

java - Why is using BufferedInputStream to read a file byte by byte faster than using FileInputStream? -

i trying read file array using fileinputstream, , ~800kb file took 3 seconds read memory. tried same code except fileinputstream wrapped bufferedinputstream , took 76 milliseconds. why reading file byte byte done faster bufferedinputstream though i'm still reading byte byte? here's code (the rest of code entirely irrelevant). note "fast" code. can remove bufferedinputstream if want "slow" code: inputstream = null; try { = new bufferedinputstream(new fileinputstream(file)); int[] filearr = new int[(int) file.length()]; (int = 0, temp = 0; (temp = is.read()) != -1; i++) { filearr[i] = temp; } bufferedinputstream on 30 times faster. far more that. so, why this, , possible make code more efficient (without using external libraries)? in fileinputstream , method read() reads single byte. source code: /** * reads byte of data input stream. method blocks * if no input yet available. * * @retu

xcode - Undefined symbols for architecture x86_64 when linking c project -

i try compile picoc project xcode. no external libraries, .c , .h files imported in command line tool c project. all .c files compile without issue, when xcode linking, these messages: undefined symbols architecture x86_64: "_basicioinit", referenced from: _picocinitialise in platform.o "_cstdout", referenced from: _printsourcetexterrorline in platform.o _platformvprintf in platform.o "_mathfunctions", referenced from: _includeinit in include.o "_mathsetupfunc", referenced from: _includeinit in include.o "_picocplatformscanfile", referenced from: _includefile in include.o ... the command giving error following: /applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/clang -v -arch x86_64 -isysroot /applications/xcode.app/contents/developer/platforms/macosx.platform/developer/sdks/macosx10.8.sdk -l/users/laurent/library/developer/xcode/deri

c# - Check the type of file clicked in a listbox -

how can check file type of object in listbox? i'm returning list of strings online server , wanting have event gets fired when click on item has .folder file type @ end. i've tried looking can't find anything. can please provide link or sample code can achieve achieve. you include fileinfo assembly , use fileinfo.extension. fileinfo finfo = new fileinfo(filename); string filename = finfo.extension

jquery - How do I get the click function to work on first click -

i have script. works great if topic liked, if has never been marked liked, need double click show user has liked. how work first time. continuation old conversation had gotten great on here old conversation $(document).ready(function(){ $("#like<? echo $msgid;?>").click(function(){ var islike = $(this).text() === "like", url = islike ? "status-updates/like.php?status_id=<? echo $msgid;?>&user=<? echo $session->username;?>" : "status-updates/unlike.php?status_id=<? echo $msgid;?>&user=<? echo $session->username;?>"; $.post(url + "?status_id=<? echo $msgid;?>&user=<? echo $session->username;?>", $(this).serialize()); settimeout(function () { $("#likediv<? echo $msgid;?>").load('status-updates/like-count.php?status_id=<? echo $msgid;?>'); $(".wholikes

java - ProgressDialog in Android - Indicator shows full even for 30% -

Image
i'm trying create progress dialog shown below in code. problem when hit cancel, , click on progress bar(edit:display progress bar button) again, doesn't work expected. indicator moves faster, , times quits without completing. this code call onclick3 when click 'click display...' button on screen shot. progressdialog progressdialogadvanced; public void onclick3(view v ){ showdialog(1); progressdialogadvanced.setprogress(0); t = new thread(new runnable() { @override public void run() { for(int = 1; <=10; i++){ try{ thread.sleep(500); progressdialogadvanced.incrementprogressby((int)10); }catch(interruptedexception e ){ e.printstacktrace(); } } progressdialogadvanced.dismiss(); } }); t.start(); } this code create progressbar: protected dialog oncreatedialog(int id) { switc

group by - SQL Removing Duplicate Result with Left Join -

i've got code if pulling info 2 different tables, , i'm getting duplicates. i've tried distinct in select statement, lots of errors "ntext data type cannot selected distinct because not comparable." so next attempt try group by, errors "column person.pers_firstname invalid in select list because not contained in either aggregate function or group clause. so records have multiple relationship fields, it's problem because records have none, 1 or more 1 relationship (the options null, project engineer, project owner, or project contractor). current code shows null , project engineer, if there's records other 2 excluded. if include other relationship descriptions duplicates. select rtrim(isnull(pers_firstname, '')) + ' ' + rtrim(isnull(pers_lastname, '')) pers_fullname, rtrim(isnull(oppocomp.comp_phonecountrycode, '')) + ' ' + rtrim(isnull(oppocomp.comp_phoneareacode, '')) + '

ruby - Why don't rails tests give me useful error messages? -

i'm pretty new rails, , i'm trying functional tests going on rails application, , of tests throwing errors. something's set wrong, don't know yet, trying figure out. testing output not helping me @ all. here's test output looks (somewhat truncated): started attachmentscontrollertest: pass should index (0.29s) readercontrollertest: pass should catalog (0.09s) should volume (0.01s) ... finished in 0.411071 seconds. 6 tests, 5 assertions, 0 failures, 1 errors, 0 skips rake aborted! this totally useless. okay, there's error in volume test. kind of error? where's being thrown? don't know, , won't tell me. way less useful if said "one or more of tests has failure and/or error". has stupid newbie question, how can meaningful information out of errors thrown? assume know absolutely nothing testing built rails. because don't. can't find documentation on reading output, , "give me stack trace" command line

javascript - Is unsecure to pass credentials through a ssl request, what's the better (KISS) solution? -

i'm using couchdb , i'm starting implement authentication/authorization. found best , simple solution pass credentials on ssl connection, i'm not sure if strategy ensure site secure. could keep strategy, buy real ssl certificate , deploy in prodution? as per original comment, using ssl passing credentials ensure security in transit, aspect valid. a more important thought bear in mind security covers multitude of layers, , these credentials form 1 part of overall system. simple example, have entire site running on secure encryption available man, riddled sql injection attacks. think "security" @ every level, not one.

ios - UITableView offset in UINavigationViewController, displayed under UINavigationBar -

on ios 6, trying reproduce side menu left , right of facebook app. got 2 view controllers respective views added on same window (just 1 bellow other). secondary controller uitableviewcontroller embedded inside uinavigationviewcontroller (named "slide menu") has width of 300 pts -- frame : (0, 0, 300, 480). switching , forward side menu executing pretty well, have 1 tricky issue on secondary view, if push view (the green 1 on pictures) , pop it, table view goes bellow navigation bar 20 pts... checked , superview of table view doesn't start @ 64pts (on y origin) @ 44pts. what interesting using exact same code, changing frame of secondary view controller (0, 0, 300, 480) (0, 0, 320, 480) fixes problem! size different {320, 480} bring issue... http://d.pr/i/rnr4 thanks have tried ? tableview.autoresizingmask = uiviewautoresizingflexibleheight;

APN configuration windows CE -

i have pradotec pda : http://www.pradotec.com.my/webadmin/v2/hrt500.html#content has windows ce preinstalled tried configure gprs connection dialing *99#, opens port, authenticate user, , breaks showing message :carrier not detected, made homework, , find anp problem after loooot of investigation found need add in configuration parameters following commands: at+cgdcont=1,ip,??? ?? local apn address, problem port doesn't open , says "busy" other application, if 1 know how way configure correctly apn in pda. if using pradotech pda model hrt700 or hrt500 must remove header @ at commands because pradotech added

visual c++ - Who can help me understand this C++ programming project? -

as have been learning week, overloading standard operators on class, can exploit intuition of users of class. overloading operator, changing way compiler uses operator based on arguments. here project week: create c++ program using visual studio design “phonecall” class holds phone number call placed, length of call in minutes, , rate charged per minute. overload extraction , insertion operators class. in program, overload == operator compare 2 phonecalls. consider 1 phonecall equal if both calls placed same number. also, create main() function allows enter ten phonecalls array. if phonecall has been placed number, not allow second phonecall same number. save file phonecall.cpp. compile application using visual studio , run make sure error free. the following code have far: #include <iostream> #include <string> using namespace std; class phonecall { private: string phonenumber; double perminuterate; double calldurationminutes; public:

Java Eclipse Heat Index -

i complete beginner , hardly know basics of java (i've been in class 2 weeks). first assignment calculate heat index based on current temperature , current humidity given user, in java using eclipse. have come code, however, no avail. code ask users input temperature , humidity, not print out results. provided uml diagram required use build code way have better understanding of why did did. ultimately, think problem lies somewhere in process of passing values , different methods... there willing take , possibly guide me in right direction? import java.util.scanner; public class heatindexcalculator1 { private int temperature; private double humidity; private double heatindex; public static void main(string args[]) { //get current temp , humidity user scanner input = new scanner(system.in); system.out.printf("please enter current temperature in degrees fahrenheit: "); int currenttemp = input.nextint(); system

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

have researched death , cannot find answer. i have actionbar using appcompat. supporting api v7 (api v8 do). actionbar works api v11. api < v11 has problem of removing icon (and feature) actionbar without supplying overflow. big picture have app logo, app title, , 3 icons squidging same actionbar on low end phone. trying make room! i happy 1 of 2 solutions. either: a method of getting overflow functionality can retrieved pull down. (preferred) method of removing icon , text actionbar below current xml api 11+: <resources> <!-- base application theme api 11+. theme replaces appbasetheme res/values/styles.xml on api 11+ devices. --> <style name="appbasetheme" parent="theme.appcompat.light.darkactionbar"> <item name="android:actionbarstyle">@style/liteactionbarstyle</item> <item name="actionbarstyle">@style/liteactionbarstyle</item> </st

iphone - How to use methods from NSManagedObject entity using NSManagedObject -

i using nsmanagedobject save values, not using entity that. because want not limit entities. tried using (oist *)managedobject.entity, not working. how use managedobject theit's this: oist.h @class file; @interface oist : nsmanagedobject @property (nonatomic, retain) nsset *files; @end @interface oist (coredatageneratedaccessors) - (void)addfilesobject:(file *)value; file.h @class oist; @interface file : nsmanagedobject @property (nonatomic, retain) oist *gist; @end - (void)newmanagedobjectwithclassname:(nsstring *)classname forrecords:(nsdictionary *)records { nsmanagedobject *newmanagedobject = [nsentitydescription insertnewobjectforentityforname:classname inmanagedobjectcontext:[[gpcoredatacontroller sharedinstance] backgroundmanagedobjectcontext]]; [records enumeratekeysandobjectsusingblock:^(id key, id obj, bool *stop) { [self setvalue:obj forkey:key formanagedobject:newmanagedobject]; }]; } - (void)setvalue:(id)value forkey:(nsstring *)key f

python - In Django how to return an existing model instance when saving to database -

how return instance before saving database? below similar trying accomplish: class personne(models.model): nom = models.charfield(max_length=100, verbose_name="origem") def save(self, *args, **kwargs): found = none try: found = personne.objects.get(nom=self.nom) super(personne, self).save(*args, **kwargs) except audiofile.doesnotexist: return found def test_personne_is_the_same(self): p1 = personne.objects.create(nom="malcom x") p2 = personne.objects.create(nom="malcom x") self.assertequal(p1, p2) assertion giving: p1 != none there number of reasons why save() method won't work written. (for one, return value of save() isn't used, return found has no effect.) but there's no reason try , reinvent yourself: rid of custom save() , use get_or_create() : def test_personne_is_the_same(self): p1, _ = personne.objects.get_or_create(nom=&quo

php - Contact Form Won't work:\ -

i downloaded template, can't form work. great! wifes website... please me hero:) here's mailhandler.php... <?php $owner_email = $_post["owner_email"]; $headers = 'from:' . $_post["email"]; $subject = 'a message site visitor ' . $_post["name"]; $messagebody = ""; $messagebody .= '<p>visitor: ' . $_post["name"] . '</p>' . "\n"; $messagebody .= '<br>' . "\n"; $messagebody .= '<p>email address: ' . $_post['email'] . '</p>' . "\n"; $messagebody .= '<br>' . "\n"; if($_post['state']!='nope'){ $messagebody .= '<p>state: ' . $_post['state'] . '</p>' . "\n"; $messagebody .= '<br>' . "\n"; } if($_post['phone']!='nope'){ $messagebody .= '<p>phon

javascript - title attribute to Grid View template field -

i using grid view in have defined "templatefield" , property header text , sortexpression = true. when viewing in browser see creates anchor element javascript. how can give title tag anchor in code. want show title attribute "click sort". but haven't see property this. how can or without javascript or c#. here code <asp:templatefield headertext="username" sortexpression="username"> <edititemtemplate> <asp:textbox id="txtusername" runat="server"></asp:textbox> </edititemtemplate> <itemtemplate> <asp:label id="label1" runat="server"></asp:label> </itemtemplate> </asp:templatefield> i have solved problem using jquery. for have same problem have done following process. i have created css class header row th , adding title th using jquery following code.

sap - Split app in ui5 the back button doesnot work -

i tried implement split app feature in mobile application .but after navigating detail2 page "back" navigation button put , not work when pressed . have placed code below : (revert if need more info on that) view.js file (content) : sap.ui.jsview("split_app.first_view", { getcontrollername : function() { return "split_app.first_view"; }, createcontent : function(ocontroller) { var olist1 = new sap.m.standardlistitem({ type: sap.m.listtype.active, title: "to detail 1", tap: function(){ osplit.todetail("detail1"); } }); var olist2 = new sap.m.standardlistitem({ type: sap.m.listtype.active, title: "to detail 2", tap: function(){ osplit.todetail("detail2"); } }); var otext = new sap.m.label({ text

Wrong url in magento paging -

i have problem regarding paging of custom module. when click on next page take url localhost/magento/fme-support/index/index/url/bc/?p=1, url doesn't work properly, correct url localhost/magento/fme-support/category/bc/?p=1 . please suggest me how , change url. thanks. try making url rewrites off if doesn't work there issue extension have installed check redirect in extension

Java Generic type identification -

this class structure. public class node<t> { private t value; public node(t val) { this.value = val; } public t evaluate() { return value; }; } t can integer , double , date , long or string . now, there anyway can know type t is? thanks. you can invoke getclass() method on generic variable , find out class. generics erased @ run-time, unbounded generic nothing java.lang.object . can invoke method supported object class on generic variable at run-time, getclass() on generic object return actual class used substitute generic for example public class node<t> { private t value; public node(t val) { class<?> clazz = val.getclass(); checktype(clazz); this.value = val; } public t evaluate() { return value; }; private void checktype(class<?> c) { if(c.getname().equals(integer.class.getname())) { //... } } }

asp.net - How to insert a Root Node in Tererik RadTreeView? -

i have radtreeview telerik control working great me drag/drop, add, rename , delete functionalities. want insert root node cannot updated/rename , deleted. try add root node in treeview. protected void page_load(object sender, eventargs e) { tree1.databind(); radtreenode root = new radtreenode("root"); while (tree1.nodes.count > 0) { root.nodes.add(tree1.nodes[0]); } tree1.nodes.add(root); }

uitableview - Accordion table cell - for expand and collapse ios -

i trying expand/collapse of tableview cells in accordion cell pattern, that, when user taps row detailed description of selected row within cell extending row height. have 2 arrays, 'array' , 'detailarray' displaying in 'cell.textlabel.text' , 'cell.detailtextlabel.text' cells resp. have made 'cell.detailtextlabel.hidden = yes' hidden, when user taps row can extended text of cell. my code, - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"cell"; uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier forindexpath:indexpath]; // configure cell... cell.textlabel.text=[array objectatindex:indexpath.row]; cell.detailtextlabel.text=[detailarray objectatindex:indexpath.row]; cell.detailtextlabel.hidden = yes; return cell; } - (void)tableview:(uitableview *)tableview didselectrowatindexpa

spring - Avoid timeout on long running process of report generation -

i have webapp developed using spring mvc. using jasperreports generate series of reports user download. in several of these reports, filling them jasper takes long , causes either transaction timeout, tomcat timeout or gateway timeout on client side. what's solution long-running processes this? note should somehow inform user whenever process finished can download file. the cleanest way handle such issue have asyncronous communication client. the first request /myapp/report?name=...&paramters... triggers jasper report refresh report , returns ticket id then, client have call url retrieve report (for instance every 5 seconds) /myapp/reportdownload?ticketid=xxxxx if jasper thread on , report ready, send report, otherwise tell client retry in 5 seconds until gets report. the way implement depends on technlogies using in front , backends, you'll find dozen of tutorials on internet. the worst way fix increase timeout in connector configuration ( http://

Diagnostics to find out why Azure Web Role doesn't start -

i trying deploy large web site azure web role. however, azure on instances tab of azure dashboard, tells me suffers error during start up, causing restart on , on again. where can find log files tell me going wrong? manage.windowsazure.com site doesn't seem have any. first, debug on dev machine. make sure deployed right .cscfg file, don't have broken connection strings, you're referencing right version of dlls (the same azure's vms) or copying newer versions azure. if fail, read this topic on windowsazure.com , topics in node on msdn . hello world code sample has basic demonstration of diagnostics should helpful. the basics of diagnostics in windows azure: must manually enabled each role importing diagnostics module in servicedefinition.csdef file a storage location needs configured resulting logs in serviceconfiguration.cscfg file, such storage emulator, or windows azure storage account. depending on types of logs, stored in either blobs or tab

c# - Initializer syntax: new ViewDataDictionary { { "Name", "Value" } } -

i searching way pass viewdatadictionary partial view in asp.net mvc came syntax: new viewdatadictionary { { "name", "value" } } i'm bit confused initializer syntax here. can explain me? viewdatadictionary implements idictionary<string, object> . idictionary<string, object> collection of keyvaluepair<string, object> . your viewdatadictionary initializer (outer curly braces) contains set of curly braces represents keyvaluepair<string, object> initializer. the reason possible explained in this answer . you can add multiple items comma separating keyvaluepair<string, object> initializers: var data = new viewdatadictionary { { "name", "value" }, { "name2", "value2" } }; same as: var data = new viewdatadictionary { new keyvaluepair<string, object>("name", "value"), new keyvaluepair<string, object&g