Posts

Showing posts from May, 2011

jquery - Applying Slidesjs slide on Knockout binded image list -

when try apply slidesjs (carousel-like) slide animation on image list (shown below), error appears , images stacked on no slide animation. tried image slider on knockout binded image list fed web api? uncaught typeerror cannot read property 'style' of undefined (at slidescontrol[0].style[transform] below) if (this.data.vendorprefix) { prefix = this.data.vendorprefix; transform = prefix + "transform"; duration = prefix + "transitionduration"; timing = prefix + "transitiontimingfunction"; error line-->slidescontrol[0].style[transform] = "translatex(" + direction + "px)"; ...[script goes on] error occurs because there no style attribute on slidescontainer[0], there no slidescontainer either beacuse set as: slidescontrol = $(".slidesjs-control", $element) so problem why slidesjs-control not generated slidesjs plugin. idea? edit (a hint) i have discovered when sl

c# - How to Bind ItemsSource with ObservableCollection in WPF -

in wpf application - add new item observablecollection via button click event handler . want show added item adds observablecollection via binding itemscontrol wrote code not working. can solve problem. here code is: .xaml file <dxlc:scrollbox verticalalignment="top"> <itemscontrol x:name="lstitemsclassm" itemssource="{binding path=topp, mode=twoway}"> <itemscontrol.itemtemplate> <datatemplate> <stackpanel orientation="vertical"> <button content="{binding name}" tag="{binding pkid}"/> </stackpanel> </datatemplate> </itemscontrol.itemtemplate> </itemscontrol> </dxlc:scrollbox> .cs file public observablecollection<classmm> topp { get; set; } int dv , startindex, lastindex; public

android - Send Java FD via UNIX Domain sockets using JNI -

i writting application android passes java fd taken parcelfiledescriptor.getfd() according [1] states int native fd. now, fd, trying write on unix domain socket existing process listening. this, using jni , pass int received above jni function argument named fdtosend . when jni code attempts call sendmsg(), error occurs stating "bad file number". with google, seems socket connection might closed when call sendmsg(), cannot see how case. the sendfd() method found in [2]. below bridging jni function: jniexport jint jnicall java_com_example_myapp_appmanager_bridgesendfd(jnienv *env, jint fdtosend) { int fd; struct sockaddr_un addr; if ( (fd = socket(af_unix, sock_stream, 0)) == -1) { __android_log_print(android_log_error, appname, "socket() failed: %s (socket fd = %d)\n", strerror(errno), fd); return (jint)-1; } memset(&addr, 0, sizeof(addr)); addr.sun_family = af_unix; strncpy(addr.sun_path, "/data

java - How to use a method within a fragment? -

i'm trying write fragment has method set in textview. have following fragment: public class detailfragment extends fragment { @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view view = inflater.inflate(r.layout.my_fragment, container, false); // settext("set something"); return view; } public void settext(string item) { textview view = (textview) getview().findviewbyid(r.id.detailstext); view.settext(item); } } this works fine. shows textview. want edit text in textview programatically. thought i'd first start editing within fragment. i've got method should able it. when uncomment settext("set something"); it gives me inflateexception: error inflating class fragment. , have no clue why. would know how can solve this? do way class ... extends fragment{ private textview _mytextview; oncreateview(...){ //inflate view

sql server - Sql Sync Framework 2.0 -

Image
i have working on sql sync framework university project, getting following error invalid object name 'scope_info'. attaching screen shot show issue, kindly please help. if thing else required please comment. platform: windows xp visual studio 2010 sql server 2008 / express 2008 sql sync framework 2.0 when provision using sync framework creates metadata table tables schema_info, scope_config, scope_info, in addition create corresponding tracking table tables in syn scope. make sure have schema_info table , tracking tables. if not deprvision sync scope , reprovision , try again. see detail documentation of how provision , deprovison http://msdn.microsoft.com/en-us/library/ff928603.aspx

Using web service from about 100000 users in the same time -

i have web service called about...let 100000 users in same time (within 3 hours). services reads , updates sql database using entity framework 4.1. here code [webmethod] public bool addvotes(string username,string password,int votes) { bool success= false; if (membership.validateuser(username, password) == true) { dbcontext context = new dbcontext(); appusers user = context.appusers.where(x => x.username.equals(username)).firstordefault(); if (user != null) { user.votat += votes; context.savechanges(); success = true; } } return success; } the web service called android mobiles(as said maybe 100000 maybe more maybe less that`s not important right now). there deadlock possibility or possibility things go wrong? what happen when reading database , when updating. 1 of answers said: updating field vote per each user. if there problem how advice me correct it. thank in advance

html - Javascript: making two circles follow cursor independently, without redundency -

i'm trying yellow , red circles in js fiddle below follow cursor independently, how can generalize code if add more circle divs don't have copy redundant code? http://jsfiddle.net/fhmkf/218/ the code has lot of redudency: // first circle variables var center = { x: $(".container").width()/2 - 15, y: $(".container").height()/2 - 15 }; var distancethreshold = $(".container").width()/2 - 15; var mousex = 0, mousey = 0; // second circle variables var center2 = { x2: $(".container2").width()/2 - 25, y2: $(".container2").height()/2 - 25 }; var distancethreshold2 = $(".container2").width()/2 - 25; var mousex2 = 0, mousey2 = 0; $(window).mousemove(function(e){ var d = { x: e.pagex - center.x, y: e.pagey - center.y }; var distance = math.sqrt(d.x*d.x + d.y*d.y); if (distance < distancethreshold) { mousex = e.pagex; mousey = e.pagey; } else { mou

bootstrap 3 modal window not working -

i'm using bootstrap 3 (full version) , use bootstrap modal in code: <a data-toggle="modal" data-target="deletemessage" class="btn btn-danger btn-sm"><span class="glyphicon glyphicon-remove"></span> Удалить</a> <!-- modal --> <div id="deletemessage" class="modal fade in" tabindex="-1" role="dialog" aria-labelledby="mymodallabel" aria-hidden="false"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <h4 class="modal-title">modal title</h4> </div> <div class="modal-body"> ...

java - Log4j 2 root logger overrides everything? -

i relatively new log4j 2. currently, have configuration file: <?xml version="1.0" encoding="utf-8"?> <configuration status="warn"> <appenders> <file name="debugfile" filename="../../logs/debug.log"> <patternlayout pattern="%d{hh:mm:ss.sss} [%t] %-5level %logger{36} - %msg%n"/> </file> <file name="benchmarkfile" filename="../../logs/benchmark.log"> <patternlayout pattern="%d{hh:mm:ss.sss} [%t] %-5level %logger{36} - %msg%n"/> </file> </appenders> <loggers> <logger name="com.messaging.main.consolemain" level="debug"> <appenderref ref="debugfile"/> </logger> <logger name="com.messaging.main.clientmain" level="debug"> <appenderref ref="benchmarkfile"/> </logger> <r

railstutorial.org - NoMethodError rails couldn't find my method 'feed' - Rails Tutorial -

i following rails tutorial , told type in static pages controller: def home if signed_in? @micropost = current_user.microposts.build @feed_items = current_user.feed.paginate(page: params[:page]) end end here result of rspec tests: failures: 1) static pages home page signed in users should render user's feed ←[31mfailure/error:←[0m ←[31mvisit root_path←[0m ←[31mnomethoderror:←[0m ←[31mundefined method `feed' #<user:0x5ae7480>←[0m ←[36m # ./app/controllers/static_pages_controller.rb:6:in `home'←[0m ←[36m # ./spec/requests/static_pages_spec.rb:29:in `block (4 levels) in <top (required)>'←[0m 2) user ←[31mfailure/error:←[0m ←[31mit { should respond_to(:feed) }←[0m ←[31mexpected #<user id: nil, name: "tim green", email: "timgreen1@outlook.com", created_at: nil, updated_at: nil, password_digest: "$2a$04$5zt aqlxq5e6zt5du.ggmaes2qv9yplobdwjixxu8wkjn...", r

Printing SQL table header names via PHP -

i have this. i'm trying capture sql table header name php. works fine me. however i'm struggling tune echo whole list of table header names except 1 or 2 dont need print. suppose names of column number 10 , 15 not need printed how tweak attempt? here goes the code far. // db1 connection $sql = "select * sal_vol;"; $result = mysqli_query($db1,$sql); $i = 0; while($i<mysqli_num_fields($result)) { $meta=mysqli_fetch_field($result); echo $i.".".$meta->name."<br />"; $i++; } while($i<mysqli_num_fields($result)) { if ($i == 10 || $i == 15) continue; $meta=mysqli_fetch_field($result); echo $i.".".$meta->name."<br />"; $i++; }

R change one column of a data.frame to a binary vector -

this question has answer here: dummy variables string variable 6 answers i have read file data.frame in r, , can see 5th column contains values separated ";". possible turn data.frame larger data.frame , expand 5th column binary vector? > head(uinfo) v1 v2 v3 v4 v5 1 100044 1899 1 5 831;55;198;8;450;7;39;5;111 2 100054 1987 2 6 0 3 100065 1989 1 57 0 4 100080 1986 1 31 113;41;44;48;91;96;42;79;92;35 5 100086 1986 1 129 0 6 100097 1981 1 75 0 so, simpler example, if first 2 rows are: 1 100044 1899 1 5 1;2;4;7 2 100054 1987 2 6 3;8 i want get: 1 100044 1899 1 5 1 1 0 1 0 0 1 0 0 0 2 100054 1987 2 6 0 0 1 0 0 0 0 1 0 0 do have use program such python prepr

php - Next button: The next row in the database that does not contain a specific value -

i have list of articles (of creatures) on hand coded php website. want put previous , next buttons. problem is, each article or creature has unique id creatures have alternative names. in database each name creature or row in own right unqiue id. example: on baba jaga page (id 150) , next 1 in database (id 151) baba yaga (normally links of baba yaga redirect baba jaga). each creature referenced alternative name (redirect) or unique (page visible use). so next creature 150 in example isn't 151 152 - babe blue ox. what code write next unique creature in chronological order? while loop or something? creatures have many alternative names next each other in database. use can use query (i don't know schema, forget post it): select id articles `id` > 150 , `type` = 'unique' order id asc limit 1

ruby - Cannot analyze XML with Nokogiri -

i have xml file i’m trying analyze nokogiri: <?xml version="1.0" encoding="iso-8859-15"?> <ehd:ehd ehd_version="1.40" xmlns:ehd="urn:ehd/001" xmlns="urn:ehd/icd/001"> <ehd:header> <ehd:document_type_cd v="icd" dn="icd-stammdatei" s="1.2.276.0.76.5.100"/> <ehd:service_tmr v="2013-07-01..2013-12-31"/> </ehd:header> <ehd:body> <icd_stammdaten> <kapitel_liste> <kapitel> <nummer v="1"/> ....... normally node doing: doc = nokogiri::xml(params[:file]) puts doc.css('nummer') now tried: doc = nokogiri::xml(params[:file]) puts doc.css('ehd:document_type_cd') to output: <ehd:document_type_cd v="icd" dn="icd-stammdatei" s="1.2.276.0.76.5.100"/> but somehow no output! how can be? use xpath when deali

python - create celery task, but don't run until explicitly called later -

my use case users can edit article. if user not original author notification asks author permission. if author agrees update goes ahead. i considering creating celery task aimed @ running update function - task can either run when author agrees, or deleted if author dismisses change. is use of celery? concerned using "queue" meaning celery better used on fifo/lifo basis, rather calling jobs id. is use case celery tasks? if nay, better idea? to confirm in pseudocode: when user suggests update: task_id = my_task.delay_execution_until_called_by_id(*args) when owner accepts: get_task_by_id(task_id).run()

jquery - IE 7 crashes when calling javascript function -

i have jqgrid in asp.net mvc 4 view , in view define type used jqgrid. jqgrid within jquery tab (i have jquery tab component). the jqgrid in tab inserted follows: <div id="jqgrid"> @html.partial("../grids/_mygrid") </div> this called ajax call in same view follows: @using (ajax.beginform("search", "item", new ajaxoptions { httpmethod = "get", insertionmode = insertionmode.replace, updatetargetid = "jqgrid", onsuccess = "showgriditems()" })) { // stuff } in same view have defined type used jqgrid follows: <script type="text/javascript"> var paramfromview = { deleteallcaption: '@resource.captionpagerdeleteall', cleargridurl: '@url.content("~/item/cleargriddata")', deleteallconfirmationmessage: '@resources.resource.itemdeletealldataconfirmation', url: '@

c++ - Resource (e.g. FLS index) exhaustion with CRT-statically-linked COM InProc servers -

i think static-linking (to crt, i.e. /mt compiler option) convenient when building small tools, easy deployment . ( sysinternals tools process explorer example of that.) however, made me note crt uses several resources might run out in contexts plugin architectures (e.g. shell extensions): in particular, fls index seems 1 runs out quickest, , loadlibrary() fail when loading 127th crt-statically-linked dll. i've built shell extensions, , i've never encountered problem, though. has ever experienced resource exhaustion problem crt-statically-linked in-proc com servers (like shell extensions)? if so, there "fix" (other using dynamic-linking crt, unfortunately complicates deployment, , requires megabytes download vcredist, when instead small stuff crt statically-linked few hundreds kilobytes...). hmya, bit worrying if have backup in case meteor impact destroys machine. user of shell extension have figured out while ago a-miss. getting 100+ dl

java - Can't figure out how to get my attempt to make a digital clock to keep time -

so assignment (surprise, homework!) make gui represents digital clock 2 lines. first line clock (hh:mm aa), , second line gives date scrolling text (eeee - mmmm dd, yyyy). i've managed of show up, can't figure out how date update computer's clock - meaning run @ 1:47 pm, , never changes 1:48 pm. i've been reading around bit, , seems answer problem use thread , have try{thread.sleep(1000)} or along lines, after few hours of experimentation, can't figure out how apply have: import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.util.date; import java.text.dateformat; import java.text.simpledateformat; public class innerclasses extends jframe { public innerclasses() { this.setlayout(new gridlayout(2, 1)); add(new timemessagepanel()); add(new datemessagepanel()); } /** main method */ public static void main(string[] args) { test frame = new test(); frame.settitle("clock"); frame.setlocationrelativeto(nul

python - Tkinter Canvas Update Memory Leak -

i'm seeing memory leak in code below. i'm creating , processing data in separate modules, isn't causing leak can see. believe it's because calling new instance of drawing class each time change scale, although i'm not sure how correct issue. i've read this thread , when try , implement self.canvas.destroy() method on code receive error. wondering method applied code below solve issue? code snippet: from tkinter import * class interface_on: def interface_elements(self, master): self.master=master self.master.title( "my canvas") self.c=canvas(self.master, width=1000, height=1000, bg='black') self.c.grid(row=0, column=0) menubar = menu(master) filemenu = menu(menubar, tearoff=0) filemenu.add_command(label="new", command=self.edit_new) menubar.add_cascade(label="file", menu=filemenu) master.config(menu=menubar) drawing_utility_run=draw

visual studio 2010 - Green () : and ; -

Image
i shutdown vs2010 project yesterday , working well. opened today , 1 of .cpp files has green formatting on parenthesis, semi-colons, , colons (see attached photo). auto-complete not working. i've deleted .sdf file project, fixes auto-complete issue. did not work. additionally, broken .cpp file still identified vs2010 c/c++ file. google doesn't seem turn folks similar problems. has encountered issue? how can fix it? i have experienced similar thing before, though in vs2012. ended doing building solution in release mode, switching debug mode , re-built again.

database design - Can I Have FK in 2NF and 3NF in Relational Schema? -

so i'm normalizing invoice, wrong include fk *inv_num* in 2nf relational schema's. have. the * shows pk 1nf ( *inv_num , inv_date, c_id, c_name,c_str,c_state,part_num, part_desc, part_quanused, part_price, lbr_num, lbr_desc, lbr_price,tax_rate) partial dependencies (c_id--> c_name,c_name,c_str,c_state) (part_num--> part_desc, part_quanused, part_price) (lbr_num--> lbr_desc, lbr_price) transitive dependencies (c_state--> tax_rate) 2nf customer ( *c_id , c_name,c_name,c_str,c_state) 2nf part ( *part_num , part_desc, part_quanused, part_price) 2nf labor ( *lbr_num , lbr_desc, lbr_price) so i'm normalizing invoice, ... actually no, not really. invoices temporal nature, inv_date extremely important. in other words, fd not {c_state} -> {tax_rate} , {c_state, inv_date} -> {tax_rate} . fd not {c_id} -> {c_state} , {c_id, inv_date} -> {c_state} . fd not {part_num} -> {part_price} , {part_num

javascript - html form does not respond to hitting "enter" button -

i have html form, not sends data php file, buts sends data javascipt function. works fine if hit "go" button, if choose , hit "enter", not work. not send data function, is. i have made other forms same pattern, send data javascript function in same file , work . 1 refuses. how fix this? thanks <form id="boroughform" enctype="multipart/form-data" method="post" action="#" onsubmit="return goborough(this); return false;" > choose borough:<br/> <select name="boroughselect" id="boroughselect" > <option selected value=" ">choose...</option> //fill options results of query performed eariler - works <?php ($v=0; $v< sizeof($borough) ; $v++) {echo '"<option value="'.$bid[$v].','.$bboxa[$v].','.$bboxb[$v].','.$bboxc[$v].','.$bboxd[$v].'" >'.$borough[

Assigning variables after parsing file with c++ -

i'm looking little guidance or particular barrier i'm having in c++. i'm coming python background of things confusing me. i'm taking text file command line argument , attempting parse/assign variables things i've read in text. i've made super simple text file, , deem super simple cpp file. did write based off of of other advice similar questions saw answered on here. in python, implement quick regex sort .readlines() function , assign variables, , know won't quite easy in cpp heres i've got: #include <fstream> #include <iostream> using namespace std; int main(int argc, char *argv[]) { if (argv > 1) { std::ifstream s(argv[1]); if (s.is_open()) ; // compiler complained unless on own line { int i, j, k; // assign ints, no idea why s >> >> j >> k; // std::cout << << endl; std::cout << j << endl;

perl - Sed: syntax error with unexpected "(" -

i've got file.txt looks this: c00010018;1;17/10/2013;17:00;18;920;113;none c00010019;1;18/10/2013;17:00;18;920;0;none c00010020;1;19/10/2013;19:00;18;920;0;none and i'm trying 2 things: select lines have $id_play 2nd field. replace ; - on lines. my attempt: #!/usr/bin/perl $id_play=3; $input="./file.txt"; $result = `sed s@^\([^;]*\);$id_play;\([^;]*\);\([^;]*\);\([^;]*\);\([^;]*\);\([^;]*\)\$@\1-$id_play-\2-\3-\4-\5-\6@g $input`; and i'm getting error: sh: 1: syntax error: "(" unexpected why? you have escape @ characters, add 2 backslashes in cases (thanks ysth!), add single quotes between sed , make filter lines . replace this: $result = `sed 's\@^\\([^;]*\\);$id_play;\\([^;]*\\);\\([^;]*\\);\\([^;]*\\);\\([^;]*\\);\\([^;]*\\);\\([^;]*\\)\$\@\\1-$id_play-\\2-\\3-\\4-\\5-\\6-\\7\@g;tx;d;:x' $input`; ps. trying can achieved in more clean way without calling sed , using split . example: #!/usr/bin/perl

python - str() not returning string in my function -

so i've defined recursive function numtobaseb converts given number in base ten other base between 2 , 10. desired output string, reason keep getting int. def numtobaseb(num, b): if num == 0: return '' elif b > 10 or b < 2: return "the base has between 2 , 10" else: return numtobaseb(num // b, b ) + str(num % b) so me: numtobaseb(4, 2) return 100 instead of desired output: '100' your program working designed: >>> numtobaseb(1024,2) '10000000000' >>> numtobaseb(4,2) '100' of course, if print(numtobaseb(4,2)) , quotes not displayed.

Triangular Lists in Haskell? -

i have write function (without using preloaded functions) decides if list of ints triangular or not, , triangular mean if increases number , decreases, example: [2,4,5,7,4,3] also: [], [1], [1,1], [1, 2, 3], [3, 2, 1], [1, 2, 2], [2, 2, 1] (so non-strict increasing , decreasing) i came dont know next, advice appreciated: ex :: [int] -> bool ex [] = true ex (x:xs) | i’ll try explain code while develop it. problem can split in two: detecting increasing part of list, , decreasing part of list. key idea of working lists in haskell (if don’t have empty list @ hand) @ head of list, , tail , , try go through list in order. so let write function detect whether list non-strictly decreasing first. there of course several ways, this. let’s try recursive approach without parameters. had start dec :: [int] -> bool dec [] = true now lets continue pattern matching. next largest list not empty list 1 element, decreasing: dec [x] = true the next step interesting. if

asp.net - passing viewmodel correctly - changes not showing on POST -

i having trouble app. when user dynamically adds rows (javascript) add more 'claimlines' 'claim' posted values don't appear, 'dummy' values set viewmodel in first place. user amending or indeed adding (new rows) not being recorded on post. as far can see passing viewmodel between controller , views missing something. have been struggling while, hugely appreciated. im new asp.net mvc , indeed programming in general. im following steven sanderson's blog. viewmodel using system; using system.collections.generic; using system.linq; using system.web; using ef_tut.models; using ef_tut.viewmodels; namespace ef_tut.viewmodels { public class claimviewmodel { public int claimid { get; set; } public int submissionuserid { get; set; } public datetime? datesubmitted { get; set; } public bool approvedyn { get; set; } public datetime? dateapproved { get; set; } public icollection<claimline> clai

php - Best Way To Show User Their Photo -

okay wondering best way show user own photo , if way safe or should change. url: http://localhost/project/everyone/myphoto.php?num=2 php code: $user_id = $_session['user_id']; if (isset($_get['num'])) { $num = $_get['num']; if ($stmt = $dbconn->prepare("select 1 t_photos id ='$num' , user_id ='$user_id' limit 1")) { $stmt->execute(); $stmt->store_result(); $rows = $stmt->num_rows; if ($rows === 1) { $stmt = $dbconn->prepare("select url,uploaddate t_photos id = ?"); $stmt->bind_param('i', $num); // bind "$email" parameter. $stmt->execute(); // execute prepared query. $stmt->store_result(); $stmt->bind_result($photopath, $uploadtime); // variables result. $stmt->fetch(); } else { $error2 = "error 2 fuck"; require 'notfound.php'

apache - file upload chown/chgrp permission issue in php/zend -

i have issue after file uploaded linux server, uploading file in zend framework(php), issue when upload file takes apache owner/group permission, should same owner/group permission parent folder, for ex. per folder permission like -rwxrwxrwx 1 username *username* 1000 2013-06-10 20:03 tempfolder (owner/group permission username/username) but when upload file name temp.txt tempfolder folder, takes default apache owner/group permission following, -rwxrwxrwx 1 apache *apache* 1000 2013-06-10 20:03 temp.txt so want temp.txt owner/group permission same tempfolder please possible, thanks in advance.

php - cakePHP route element directs to missing controller action? -

i'm trying setup following routing in cakephp 2.3: domain/news/slug i've followed cookbook guidelines on routing , route gets created correct. problem run when selecting link 'missing method in newscontroller' error message. here's i've configured: router::connect( '/news/:slug/', array('controller' => 'news', 'action' => 'view'), array( 'pass' => array('slug'), 'slug' => '[^_]+' ) ); i'm passing in slug regular expression (any string not include underscore). this link in index page: <?php echo $this->html->link( $news['news']['title'], array( 'controller' => 'news', 'action' => 'view', 'slug' => $news['news']['slug'] ) ); ?> as men

actionscript 3 - Sharing variables in OOP AS3 -

in main.as have following: package { import flash.display.movieclip; public class main extends movieclip { public var damage:number; public function main() { // constructor code var char:character = new character(); addchild(char); } } } and have package called character.as package { import flash.display.movieclip; public class character extends movieclip{ public function character() { trace(damage); } } } i need able share damage set in main.as character. there way make speed more global? why don't make damage public property of character , it'll accessible via main class : char.damage = 100; trace (char.damage); to this, add property character class : public class character extends movieclip { public var damage:number; public function character() { trace(damage); } } but given comment, take rather global

javascript - multiple instances of valums file uploader -

i'm trying multiple instances of valum file uploader working on site. works great 1 instance anytime loop on initialization code, wanting multiple buttons don't see buttons. here's code: <cfoutput query="gettopics"> <script> function createuploader(){ var uploader = new qq.fileuploader({ element: document.getelementbyid('file-uploader#reftopicid#'), action: 'components/projectbean.cfc', params: {method: 'upload', topicid: #reftopicid#, count: #evaluate("session.#reftopicabv#count")#, topicname: '#reftopicabv#' }, encoding: 'multipart' }); } // in app create uploader dom ready // don't wait window load window.onload = createuploader; </script> <div class="row" id="file-

java - Weight Conversion - How to combine various Print Methods into 1 Print Method -

i novice programmer learning java , though homework complete want make neater. wanted know if can combine following print methods 1 , @ least combine kilograms pounds , pounds kilograms methods one. note, can't use more advanced if statements , loops. because first time posting , want make sure provide answerers adequate information have uploaded weight conversion java file here: weight conversion java file . any other advice how simplify code, or following better code etiquette welcomed too. here print statements: /** * method below prints calculations calculatekg , calculatelbs */ public static void printresults1( double dresult1, double dresult2){ // prints result of pounds kilograms system.out.print(dresult1 + " pounds " + dresult2 + " kilograms."); }// end method printresults1 /** * method below prints calculations calculatekg , calculatelbs */ public static void printresults2( double dresult1, double dresult2){ // prints result of pounds k

mysql - What is wrong with this SQL for phpBB? -

updated sql: environment mysql 5.5. sql being generated through phpbb abstraction layer when see sql looks valid. select f.*, t.*, p.*, u.*, tt.mark_time topic_mark_time, ft.mark_time forum_mark_time (phpbb_posts p cross join phpbb_users u cross join phpbb_topics t) left join phpbb_forums f on (t.forum_id = f.forum_id) left join phpbb_topics_track tt on (t.topic_id = tt.topic_id , tt.user_id = 2) left join phpbb_forums_track ft on (f.forum_id = ft.forum_id , ft.user_id = 2) p.topic_id = t.topic_id , p.poster_id = u.user_id , p.post_time > 1380495918 , p.forum_id in (7, 6, 5, 3, 4, 2, 1) , p.post_approved = 1 order t.topic_last_post_time desc, p.post_time limit 18446744073709551615 error is: unknown column 't.topic_id' in 'on clause' [1054] all column names exist. tables exist. aliases exist. here's associated code: $sql_array = array( 'select' => 'f.*, t.*, p.*, u.*, tt.mark_time topic_mark_time, ft.mark_time forum_mark_t

objective c - imageWithContentsOfURL Check if image is valid -

i using following code obtain image url , display in uiimageview how can check url passing has returned valid image? (i.e image exists?) nsurl *imageurl = [nsurl urlwithstring:stringurl]; myimage.image = [uiimage imagewithcontentsofurl:imageurl]; this looks answered in: uiimageview-image-using-a-url if not sufficient take @ nice asynchronous capabilities offered afnetworking .

javascript - bootstrap3 - toggle class name by @media -

i search class toggle switches changing resolution. in case when resolution changes @screen-lg or @screen-md - class should toggle btn-lg @screen-sm (standart) <a class = "btn btn-default btn-sm">button</a> @screen-lg or @screen-md (toggle) <a class = "btn btn-default btn-lg">button</a> i think solution using jquery, need little this. please can me. or there solution more easyier? thx you can use same breakpoints bootstrap uses media queries change size of button: /*default state (btn-sm styles)*/ .btn { padding: 5px 10px; font-size: 12px; line-height: 1.5; border-radius: 3px; } /*md or lg screen (btn-lg styles)*/ @media (min-width: 992px) { .btn { padding: 10px 16px; font-size: 18px; line-height: 1.33; border-radius: 6px; } } note: example above apply behavior .btn elements, can use custom class if want limit selection demo fiddle

g++ - How to suppress warnings for 'void*' to 'foo*' conversions (reduced from errors by -fpermissive) -

i'm trying compile c code g++ (yes, on purpose). i'm getting errors (for example): error: invalid conversion 'void*' 'unsigned char*' [-fpermissive] adding -fpermissive compilation options gets me: error: invalid conversion 'void*' 'unsigned char*' [-werror=permissive] which seems error because of -werror , adding -wno-error=permissive -wno-permissive results in: error: -werror=permissive: no option -wpermissive error: unrecognized command line option "-wno-permissive" [-werror] how disable warnings (globaly) conversions void* other pointer types? you cannot "disable warnings conversions void* other pointer types" because not warning - syntax error. what's happening here using -fpermissive downgrades errors - including 1 - warnings, , therefore allows compile some non-conforming code (obviously many types of syntax errors, such missing braces, cannot downgraded warnings since compiler cannot

android - How can I save form data to a database on the sdcard? -

i have "customer information" form in application. need data filled in on form saved "transaction record" file saved on sd card. master list of transactions app has completed. how can save data growing record? below example of form. name: sue license: d1234567890 address: 742 evergreen terrace state: xy phone: 111-222-3344 i need save in kind of growing database... | transaction | name | license | address | state | phone --------------------------------------------------------------------------------------- | 4322 | joe | d4657373888 | 2200 sudderthe road |wz | 9543939124 | 4323 | kim | d0987655432 | 1st elbow street |km | 5551234444 | 4324 | sue | d1234567890 | 742 evergreen terrace |xy | 1112223344 this database accessed , edited few different areas of application. once figured out can accomplish lot overall app. eventually have app upload transaction recor

php - Replace array keys -

i have array json example .i'm trying replace numeric key ..."conn":{" 1 ":{"... string key such "node". for example want create this: { "level": [ { "main": "472321514", "main_lat": "39.1057579", "main_lon": "26.5451331", "conn": { "node": { "id": "599416249", "coords": { "lat": "39.1055889", "lon": "26.5452403" }, "distance": 0.0209442235276 },... before json encoding script is: foreach ($ways $w){ $nd=$w->nd; foreach ($nd $w2){ $nodes_array[]=(string)$w2->attributes()->ref; } for($ww=0;$ww<count($nodes_array);$ww++){ $no

Android - bottom bar overlapping SurfaceView -

Image
ok, before i've asked question, i've looked at: how remove unwanted overlapping in android tabs @ bottom overlapping list view android bottom navigation bar overlapping spinner. set spinner dropdown height / margin bottom button bar overlaps last element of listview! however haven't seen think fix particular situation. here's problem: i'm writing custom surfaceview display image on-screen. in surfaceview drawing image bottom right-hand corner. here code: import android.annotation.suppresslint; import android.app.activity; import android.content.context; import android.graphics.bitmap; import android.graphics.bitmapfactory; import android.graphics.canvas; import android.graphics.point; import android.os.build; import android.os.bundle; import android.view.display; import android.view.surfaceholder; import android.view.surfaceview; import android.view.windowmanager; public class demosf extends activity { ourview v; int measuredwidth; int

vb.net - using the split function to parse through a comma separated line -

solved on own ... int1 = cint(line.split(cchar(","))(1)) to read contents of text file, line line, using code using r streamreader = new streamreader("0trace2.txt") dim line string line = r.readline while (not line nothing) list.add(line) line = r.readline msgbox(line) loop end using however, file has 4 comma separated values, numbers. need extract each number integer. tried split method ran error dim int1 integer dim int2 integer dim int3 integer dim int4 integer using r streamreader = new streamreader("0trace2.txt") dim line string line = r.readline while (not line nothing) list.add(line) line = r.readline 'msgbox(line) int1 = cint(line.split(cchar(","))(1)) loop end using thanks assuming simple need collect integers file structure like 1,2,3,4 5,6,7