Posts

Showing posts from January, 2014

android - Listview not working properly -

i have listview in application. works fine when number of elements increases on scrolling down , selecting view,it shows force close. why so? code segment given as: lv1 = (listview) findviewbyid(r.id.listview); lv1.setadapter(new arrayadapter<string>(this,r.layout.list_item,surveyname)); // lv1 = getlistview(); lv1.setonitemclicklistener(new onitemclicklistener() { public void onitemclick(adapterview<?> arg0, view arg1, int arg2, long arg3) { listview lv = (listview) arg0; textview tv = (textview) lv.getchildat(arg2); string s = tv.gettext().tostring(); for(int i=0;i<ss;i++){ if(surveyname[i].equals(s)){ id=surveyid[i]; } } intent j=new intent(surveytool.this,survey.class); bundle d=new bundle(); d.putstring("surveyid", id); ...

jquery - Vertically center image if height less than parent.height, else limit height to 100% -

i'm using html5-fullscreen mode full-screen parent div, in want vertically center image, if image smaller parent div (ie. screen size). want limit image max-height = 100% of parent, avoid zooming in if image larger screen. i can center image 2 divs (one display:table , , other display:table-cell ), cannot @ same time set image max-height not more parent div. can latter using position:absolute; max-height:100%; centering doesn't work on smaller images. example markup: <div id="fullscreen-container"> <div id="fullscreen-img-wrapper"> <img id="fullscreen-img" src="/images/test-6000x4000.png" /> </div> </div> any ideas how can accomplished appreciated! <style> #fullscreen-img-wrapper { display: table-cell; margin-left: auto; margin-right: auto; vertical-align: middle; width: 100%; } #fullscreen-img { width:100%; } </style> <div id="fulls...

c# - in Mvc3 how could I disable validation on an input field when display:none? -

in jquery can disable validation input field client side (using ignore) , need same in mvc3 [displayname("title")] [required] public string title { get; set; } [displayname("othertitle")] [required] public string othertitle{ get; set; } in .cshtml <div class="editor-label"> <span> @html.labelfor(x => x.title) </span> @html.dropdownlistfornums(m => m.title, new selectlist(new string[] { "mr", "ms", "mrs", "dr", "professor", "other" }, "title"), "title") </div> <div id="alttitle" class="editor-label"> <span> @html.labelfor(x => x.othertitle) </span> @html.textboxfor(x => x.othertitle, new { @class = "othertitle" }) </div> how disable validation on input field othertitle on client side, when "other...

ios - HTML5 Audio iPAD, Cannot play audio file ? -

i got little issue i'm trying play audio files on webview html5 on ipad simulator, got code this: <audio controls="controls" format="mp3 ogg"> <source src="test.ogg" /> <source src="test.mp3" /> </audio> but got "cannot play audio file" on black bar on control :/ someone idea why ? of course test.mp3 , test.ogg added in xcode project , in same directory thanks format attribute in audio doesn't makes sense. should use type attribute in source tag. see example: <source src="test.ogg" type="audio/ogg" /> <source src="test.mp3" type="audio/mpeg" /> this working in ipad.

How to clone jquery datepicker? -

i need clone (to inherite) datepicker jquery object , override _generatedhtml method. code: $.fn.datepickerext = $.fn.datepicker; var datepickeroldhtml = $.datepicker._generatehtml; var datepickerext = $.extend($.datepicker, { _generatehtml: function(inst) { var generatedhtml = datepickeroldhtml.apply(this, arguments); return "<div style='text-align:center'>header</div>"+generatedhtml; } }) but not sure have different objects $.fn.datepicker , $.fn.datepickerext.. link jsfiddle: http://jsfiddle.net/konstantin/9rjna/ in case header need added datepickerext... i come across same problem , after gone through suggested solution, got way out. $('#actions').append($new_row); $('#actions').find('input.datepicker').removeclass("hasdatepicker").removeattr('id'); $('#actions').find('button.ui-datepicker-trigger').remove(); $('#actions').find('input.d...

perl - Can't locate object method "***" via package "Apache2::RequestRec" -

i'm trying mod_perl working on apache installation in order use perlhandler. i first tryied in subdirectory of domain virtual host <virtualhost *:80> serveradmin webmaster@localhost servername ***.fr.cr documentroot /var/www/aw <directory /var/www/aw/> allowoverride none order allow,deny allow </directory> perlmodule test2::rules2 alias /perl2/ /usr/lib/perl5/test2/ <location /perl2/> order allow,deny allow sethandler perl-script perlhandler test2::rules2 </location> errorlog ${apache_log_dir}/aw.error.log # possible values include: debug, info, notice, warn, error, crit, # alert, emerg. loglevel warn customlog ${apache_log_dir}/aw.access.log combined </virtualhost> and here, working fine when go * .fr.cr/perl2/ but, when try directoly root of domain, virtualhost : <virtualhost *:80> ...

php - How to know user's language? -

possible duplicate: javascript detecting browser language preference detect browser language in php what's best method detect language? i have created website in world can visit. so, need way know approximately user's language without asking them. obviously, there link sets language via cookie. you can use accept-language http request header sent every browser. i found function parse it: function getpreferredlanguage() { $langs = array(); if (isset($_server['http_accept_language'])) { // break string pieces (languages , q factors) preg_match_all('/([a-z]{1,8}(-[a-z]{1,8})?)\s*(;\s*q\s*=\s*(1|0\.[0-9]+))?/i', $_server['http_accept_language'], $lang_parse); if (count($lang_parse[1])) { // create list "en" => 0.8 $langs = array_combine($lang_parse[1], $lang_parse[4]); // set default 1 without q factor foreach ...

git pass different variable to smudge filter according to the project it is invoked from -

i want modify configuration strings in git version controlled php script, according environment using code in repository. i want set smudge/clean filter modify configuration string in code according platform, checking out (dev/testing). scripts in ~/scripts , want add config file ~/scripts/config set values used script i have different projects (in different repos) same files in should modified differently, script needs know repository invoked. is there way set project id maybe in .gitattributes file passed environment variable filter script? example: content of .gitattributes : project_id = "projectx" content of smudge script (pseudo code): host = getconfigvaluefromfile(projectxhost) if $project_id == "projectx" print 'host=$host' you can set arbitrary values in repository configuration. example, can set variable this: $ git config mytool.myvariable myvalue and retrieve this: $ git config mytool.myvariable myvalue ...

php - Inserting spaces between UTF8 words - what is wrong with my 2 simple regexes? -

i have a web page users can leave comments in russian language (utf-8), one: Хорошо, четко , уверено!Удачи!(БОРИС) some users "abuse" fun purposes leaving out spaces between words НеСпитьсяЖукуНиЗимою,НиЛетом,лучшеПитатьсяСолнечнымСветом, лучшеСидетьЗаИгорнымСтолом,иНаслаждатьсяКаждымВистом, лучшеНоситьЗолотыеОдежды,искритьсяВсегда,неТеряяНадежды,лучшеПустьДругОстаетсяБезВзятки,ведьНевозможноЖукуЖитьБезЛапки! which results in wide html-table rows, breaking layout. i'm trying counter users trying find comments on 60 non-space characters , inserting single space char after punctuation chars (like commas) - piece of php-code: if (preg_match('/\s{60,}/u', $about) == 1) { error_log('splitting comment: ' . $about); $about = preg_replace('/(\p{p}+\s*)/u', '$1 ', $about); error_log('===result comment: ' . $about); } however doesn't wor...

android - Get the status of one application from another application -

i have 2 applications such activity , service . start service activity . when exit activity stops not getting stopped, running in background(could see in settings->manageapplications menu). used android.os.process.killprocess(android.os.process.mypid()) in ondestroy () function terminates application. issue stops service since started activity.i tried using below lines, activitymanager activitymanager = (activitymanager)this.getsystemservice(context.activity_service); activitymanager.killbackgroundprocesses(this.getapplication().getpackagename()); but still stops service since stop associate processes said in document.my question how can terminate activity without killing service. thanx in advance. scenario assume there 2 applications 'a' & 'b'. stop application 'a' using finish() call, 'a' closes successfully. check status of 'a' 'b' using runningprocessinfo call , still find application 'a' ru...

What are some good programmable barcode scanners? -

essentially, i'm looking 1d bar-code scanner can program, either through provided software or sort of programming language, read bar-code , format resulting string. i have tried datalogic gryphon gd 4130 scanner , didn't work needed do, , thought software provided hard use. price isn't issue either. recommendations great. the honeywell voyager 9520/40 line worked me. scanner programmable scanning "program barcodes" provided. but needed program able detect barcode scans if wasn't "active" window. , did not want create global keyboard hook check if keyboard input barcode scan. i found honeywell offered free drivers convert scanner's output "serial port" input on pc - though usb scanner. programming because it's cinch read serial port data in programming languages, , have been rough me create native code read usb port data. when researching found scanners had capability emulate serial port input recommend out fe...

php - write and download csv after posting using jquery -

i posting html table data json server side using jquery $.post writing whole table data csv file. not outputting csv downloadable user. i want pop csv file (which happens when download file. know save or open box csv) client side code //selecteddata having data json $.post('ajax/csv_download.php', { selecteddata: json.stringify(selecteddata) }, function(html){ }); server side code global $fh; $fh = @fopen( 'php://output', 'w' ); $post_data = json_decode($_post['selecteddata']); foreach ($post_data $arr) { $val1 = $arr->val1 ; $val2 = $arr->val2 ; $val3 = $arr->val3 ; $val4 = $arr->val4 ; $val5 = $arr->val5 ; $out = array($val1,$val2,$val3,$val4,$val5); fputcsv($fh, $out); } sounds want write contents of csv file browser after setting 'content-type' 'text/plain' in php. depending how web browser configured, prompt user save/open file...

string formatting - printing and formatted list in python -

i using following code print "line 1 line2" h, m in zip(human_score, machine_score): print "{:5.1f} {:5.3f}".format(h,m) but might not practice use spaces between "line 1" , "line 2" in header. , i'm not sure how add variable amount of spaces before each row can fit "mean" , "std" @ bottom, , have 2 numbers in line list above it. for example, printed this: line 1 line 2 -6.0 7.200 -5.0 6.377 -10.0 14.688 -5.0 2.580 -8.0 8.421 -3.0 2.876 -6.0 9.812 -8.0 6.218 -8.0 15.873 7.5 -2.805 mean: -0.026 7.26 std: 2.918 6.3 what's pythonic way of doing this? simply use larger field sizes, e.g., header use: print "{:>17} {:>17s}".format('line1', 'line2') and numbers: print "{:>17.1f} ...

jsf 2 - f:param to composite components -

in jsf2.1 composite component if try pass f:param composite component (command button) , recieve in component editablevalueholder ,it doesn't seems working, any ideas? <mycomp id="button" outcome="newpage" > <f:param name="foo" outcome="bar" for="button"/> </mycomp> compositecomponent.... <cc:interface> <cc:attribute name="action" targets="commandlink" required="true" /> </cc:interface> <cc:implementation> <h:commandlink id="commandlink" action="#{cc.attrs.action}"> </h:commandlink> </cc:implementation> use <cc:insertchildren> . <h:commandlink ...> <cc:insertchildren /> </h:commandlink>

iphone - How to Call an Instance Method From a Variable Name -

possible duplicate: object name of string i want call code below, able change "iteminstance" stringe variable. possible? uiimage *image = [iteminstance getimage:itemnumber]; edit: read nsselectorfromstring method appears need use, have no idea how it's supposed implemented. ideas? not exactly. simplest way effect build nsdictionary strings keys , matching instances values. becomes like: uiimage *image = [[dict objectforkey:instancename] getimage:itemnumber];

ios - Added, then deleted a ~ipad.xib. Now NSInternalInconsistencyException when running on iPad -

Image
in attempt convert iphone app universal app, added myviewcontroller~ipad.xib project. set targeted device family iphone/ipad. attempted undo changes--deleted myviewcontroller~ipad.xib , set targeted device family iphone only. now, can run on iphone (as always), not on ipad (which before). crash following error: "'nsinternalinconsistencyexception', reason: '-[uiviewcontroller _loadviewfromnibnamed:bundle:] loaded "myviewcontroller" nib view outlet not set.'" the view outlet in myviewcontroller.xib set: and file's owner class set: so had... iphone-only app run on ipad (but in smaller iphone view). appreciated! be aware if remove files project, files not deleted device when re-installing (through build&run), , ios still see old files there. may need manually remove app device, re-install. another option rename file, old files not bother you. also, cleaning project, or cleaning build folder (keep alt pressed , se...

asp.net mvc - Need a Javascript searchable/filtrable combobox with remote json datasource -

i need combobox (open source preferred) functionality: remote datasource json format filtrable/searchable data value/display value integrated asp.net mvc client side validation (no extjs) i'm searching , testing many days not found anything... see jquery ui autocomplete combobox example it uses underlying html <select> element, assume should work client side validation. the example uses pre-defined list of options, can modify use ajax call instead. see other autocomplete examples.

c# - Formatting Text in a ListView? -

i'm creating little app read, parse, , format contents of lua script - specifically, savedvariables file world of warcraft created "elephant" chat logging add-on. prototype have in mind generate array of listviewitem instances, showing timestamp, player name, channel message posted into, , message posted. i'd have chat message rendered in game: game colors names of "talking" in chat after character's class (e.g. rogue's name yellow, mages' names light blue), when comes listviewitem , listviewsubitem , coloring text there seems all-or-nothing deal. would possible add functionality listview apply formatting (or color) text in listviewitem or listviewsubitem based on markup in text property? edit: i'm asking if it's possible add text formatting listviewitem through magic of inheritance/polymorphism in derived class, , if so, what's best way (amount of effort, code security, etc)? speaking windows forms usage v...

resource available output parent resource rails 3.2 -

i have in routes.rb resources :users, :path => "/", :only => [:show] resources :collections, :controller => 'users/collections' end why can access collections resources from: http://localhost:3000/en/collections if resouce inside users? i want collection resource enable inside: http://localhost:3000/en/users/collections this routes: user_collections (/:locale)/:user_id/collections(.:format) users/collections#index post (/:locale)/:user_id/collections(.:format) users/collections#create new_user_collection (/:locale)/:user_id/collections/new(.:format) users/collections#new edit_user_collection (/:locale)/:user_id/collections/:id/edit(.:format) users/collections#edit user_collection (/:locale)/:user_id/collections/:id(.:format) users/collections#show put (/:locale)/:user_id/collections/:id(.:format) users/collections#update...

console - How do I simulate blocking on StringInputStream readLine in Dart? -

i found answer being able read console here: is possible read console in dart? . however, want block further execution in program until string typed in (think simple console interaction user). however, i'm not seeing way control execution flow simple interaction. realize dart i/o intended asynchronous, i'm struggling figure out how should accomplish seemingly simple task. i'm trying use dart not intended do? #import("dart:io"); void main() { var yourname; var yourage; var console = new stringinputstream(stdin); print("please enter name? "); console.online = () { yourname = console.readline(); print("hello $yourname"); }; // rest of doesn't work... print("please enter age? "); console.online = () { yourage = console.readline(); print("you $yourage years old"); }; print("hello $yourname, $yourage years old today!"); } i hope in future, io done via fu...

asp.net mvc 3 - MVC3 EF Ninject Generic Repository -

i'm working on generic repository using entity framework/mvc3/ninject.mvc3. interface looks this. public interface irepository<tentity> tentity : class { iqueryable<tentity> query { get; } void add(tentity entity); void edit(tentity entity); void delete(tentity entity); } my concrete implementation looks this. public class efrepository<t> : irepository<t> t : class { private efdbcontext context = new efdbcontext(); public iqueryable<t> query { { return context.set<t>().asqueryable(); } } public void add(t entity) { context.set<t>().add(entity); context.savechanges(); } public void edit(t entity) { context.entry<t>(entity).state = system.data.entitystate.modified; context.savechanges(); } public void delete(t entity) { context.set<t>().remove(entity); context.savechanges(); } }...

delphi - RichEdit and WM_VSCROLL message -

when number of lines not large no problem wm_vscroll message. when richedit has large number of lines (in case ~130k lines average 150 chars) not works. richedit1.perform(wm_vscroll, makewparam(sb_thumbposition, n), 0); scroll top (n > 5) or more should (n <= 5). can vertical scroll in other way ? p.s. testing can used this code written sertac akyuz. i can't think of way adapt code linked in question able work rich edit version 2.0 reason mentioned in comment question. luckily might not necessary.. for windows xp sp1 , later rich edit version 3.0 included os. see ' about rich edit controls ' on msdn. don't have use version 3.0, class names of version 2.0 , 3.0 same. if version 3.0 'riched20.dll' deployed on system, vcl gets use it. interestingly there no problem wm_vscroll . message still use word sized scroll position, rich edit control adapts itself: scroll range of @ 65535. about problem em_posfromchar , version 3.0 rich edit cont...

qt - What's the QMetaCallEvent for and how to access its details? -

i have event filter , noticed when click expand/collapse tree branch qevent::metacall . thinking using roll own expand/collapse code, don't know how information, such index of item. is there available metacall event type? i found had asked same question on site, without answer, here: http://www.qtcentre.org/threads/37525-how-to-filter-qevent-metacall what event typically used for? the biggest question are: what trying do? qt class received events? far i'm concerned, you're trying things hard way, why bother? the qmetacallevent event representing slot call whenever queued connection used invoke slot. might due signal firing connected slot, or due use qmetaobject::invoke or qmetaobject::invokemethod . queued connection bit important part! queued connections not used default, since have event queue management overhead, unless either of 2 conditions below holds true: you provide qt::queuedconnection argument qobject::connect or qmetaobject::invoke...

jquery - Invalid dates in Highcharts with data loaded by JSON -

i cannot seem xaxis in highcharts display date data loaded via json. also, when hover on data point, label says "invalid date." here php code used generate data: function fetchlinechart() { $fetchdata = $this->db->query("select download, upload, date speed_entries order date desc"); while ($data = $fetchdata->fetch()) { $date = date("y, m, d", strtotime($data['date'])); $downloaddata[] = array('date.utc(' . $date . ')', (float)$data['download']); $uploaddata[] = array('date.utc(' . $date . ')', (float)$data['upload']); } $result = array('download' => $downloaddata, 'upload' => $uploaddata); echo json_encode($result); } and here jquery chart $(document).ready(function() { var options = { chart: { renderto: 'linechart', type: ...

unicode - Encoding fails when marshalling string via COM Interop in C# (double UTF8 encoding?) -

i'm writing plugin autodesk navisworks, trying pass c# unicode string property on com object. however, string encoded incorrectly somewhere in process. var property = ...; property.name = "中文"; // becomes "??" property.value = "中文"; // ok "中文" comes out "??" in user interface, whereas strings limited ascii work fine (e.g. "abcd"). furthermore, setting value-property (a variant) on same object works fine, not name. further exploration leads me try encoding string "ä" utf-8: c3 a4 and somehow "encoding" (unicode) string: property.name = "\u00c3\u00a4"; // shows "ä" surprisingly seemed work. this led me try following: var bytes = encoding.utf8.getbytes("中文abcd"); char[] chars = new char[bytes.length]; for(int = 0; < chars.length; i++) chars[i] = (char)bytes[i]; string s = new string(chars); however, when use trying encode "中文abcd" fir...

EF Migrations - how to manage during dev and deployment? -

we're considering using ef 4.3.1 code-based migrations, aren't clear how integrate migrations our present dev/deployment methodology... the app in-question desktop wpf app, each desktop having own sql server instance (each 4 separate databases). deployed "field" environment 0 local support. database migration must done using sql scripts executed installer (probably installshield). there not available can run command @ pmc prompt upgrade db when deployed/upgraded @ field location. ultimate "output" ef migrations must set of sql scripts, installer selectively apply. also, have multiple developers making concurrent database changes.. there no dba. each developer checks-in code (model) changes tfs, , next time get-latest, changes model automatically cause new database created on dev system. how can have each developer perform own local migrations (rather deleting/recreating local databases), , manage/consolidate/combine migrations? , collisions? duri...

javascript - CSS position fixed. Div wrapper must be fixed vertically but must be varying in horizontally -

i have div , this #footer { position:fixed; left:40px; top:0px; } the position fixed when scroll vertically or horizontally. want div fixed when user scrolls scroll bar vertically should varying when user scrolls scroll-bar horizontally. i have seen of forums , posts found jquery script.i want know if there way in css? fixed position in 1 direction read post did not understand jquery script. kindly let me know way in css or better way jquery.thanks seems impossible "look fine" css/html. mentioned ruup or fixed position in 1 direction , layering on js it, option. fortunately, found way work somehow (not beautiful): http://jsfiddle.net/mkebw/5/ html (inside body-tag): <div id="simulated-html"> <div id="footer"> <span> <!-- footer text here --> </span> </div> <div id="simulated-body"> <!-- website here -...

c# - Socket sync send outperform async beginsend/endsend? -

i writing tcp server supports lot of(50,000+) connection, , found out this. the sync send performed @ least 3 times better async one. programs identical besides these 2 lines: m_socket.send(sendingbuffer, length, socketflags.none); and m_socket.beginsend(sendingbuffer, 0, length, 0, new asynccallback(sendcallback), this); in sendcallback call endsend, nothing else. where huge performance difference coming from? aren't async methods supposed perform better? async methods slower sync methods (due involving added overhead in implementation), overall "faster" if need while executing - if waiting them finish, unnecessary.

android - stretch imagebuttons in linearlayout to use available space -

i've been playing xml in order achieve following; first row banner (works fine). then; have 3 buttons on each row. want buttons take horizontal space (so; screen width diveded 3). also, images on buttons should resize width, without changing aspect ratio!. how can done? next; if add rows of imagebuttons, how should 'shell' linearlayouts in scrollview maintain width distribution 3 buttons? thnx <?xml version="1.0" encoding="utf-8"?> <linearlayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_centerhorizontal="true" android:orientation="vertical" > <imageview android:id="@+id/blogbanner" android:layout_width="fill_parent" android:layout_height="wrap_content" android:scaletype="fitxy" android:src="@drawable/test_banner_ad" /> <l...

c++ - error use of enum without previous declaration? -

i'm learning c++ book , following example doesn't work in codeblocks. compiler gives error: use of enum 'days' without previous declaration can enlight me here? #include <iostream> using namespace std; int main() // main routine { int a; enum days (zo,ma,di,wo,do,vr,za); // <error here> : use of enum 'days' without previous declaration days today; today = ma; if (today == zo || today == za) cout << "weekend \n" else cout << "ohno workday \n"; return 0; } you're using enum incorrectly. parentheses should braces: enum days {zo,ma,di,wo,do,vr,za}; now zo equal 0, since didn't explicitly define value, , each thereafter 1 more last. also notice (easily, due syntax highlighting) do conflicts do keyword reserved do...while statements.

Rails: Devise: post-confirmation error -

i trying send email event administrator, after user confirms. see: rails: devise: sending email after user comfirms registration i wrote eventmailer class follows: class eventmailer < actionmailer::base @user = user @host_name = "localhost:3000" if rails.env.development? @host_name = "test.com" if rails.env.test? @host_name = "production.com" if rails.env.production? def self.send_email_to_admin @@smtp_settings = { #override default smtp settings since i'm using difference sender :address => "smtp.gmail.com", :port => 587, :domain => @host_name, :authentication => "plain", :enable_starttls_auto_=> true, :user_name => env["org_from"], :password => env["org_from_pwd"], :to => admin_recipients #admin_recipients defined elsewhere } mail(:subject => "invite request received " + @user.first.to_s + "...

java - If conditions using regex -

what regex satisfy following situation: if (string starts letter (one or more)) must followed . or _ (not both) else no match example (imagine have list of values matched, being tested): public static boolean matches(string k) { (final string key : protectedkeys) { final string optional_separator = "[\\._]?"; final string optional_characters = "(?:[a-za-z]+)?"; final string or = "|"; final string separated = optional_characters + optional_separator + key + optional_separator + optional_characters; string pattern = "(" + key + or + separated + ")"; if (k.matches(pattern)) { return true; } } return false; } this code matches of below system.out.println(matches("usr")); system.out.println(matches("_usr")); system.out.println(matches("system_usr")); system.ou...

scripting - Special Characters in Powershell -

i trying work powershell , have output copyright character ms word document. example, code listed below trying use , not working. $summarypara.range.text = "© " $summarypara.range.text = "get-date -format yyyy" $summarypara.range.text = " - name of org here " $summarypara.range.insertparagraphafter() do need use alt+0169 sequence somehow? not sure doing wrong since following code seems work: $selection.typeparagraph() $selection.typetext("© ") $selection.typetext((get-date -format yyyy)) $selection.typetext(" - name of org here ") $selection.typeparagraph() any appreciate making work both copyright character , other similar special characters. there few problems here. i'll list , address each: 1) can character need casting unicode representation char. in case [char]0x00a9 2) assign new value $summarypara.range.text 3 times. so, overwriting previous value each time, instead of concatenating ('+...

css - jQuery Progress Bar (Canvas load time) -

so i'm using jquery plugin: http://p.ar2oor.pl/cprogress/ i won't post code cause there way much. basically, if go site see how progress bar loads. have set mine working in exact same fashion, different images. delays half second , appears. why doing it, , can prevent this? your slider showing slower because image loading slow. are pulling images different server? - put images server. is slider visible on page load or shown, after action? in case, preload image right after document / page load. when slider shown, image in browsers cache. all in all, facing optimization problems, , without full code, cannot you. there must multiple factors, slowing down load.

javascript - Not all Loops processed, only 5655 out of 13200 -

i have 2 javascript loops, 1 nested in other, ajax call serverside. loops generate pair of numbers (latlng coordinates), passed server via .getjson() inserted mysql table. problem: script runs 6 minute, total of 13200 ajax calls. in chrome's webdeveloper tools, says 5656/13646 requests 536.20kb/2.15mb . when check tables inserted entries, see 5655 rows! happened rest? js code for(var = 0; < 110; i++) { var lat_current = lat_start + lat_increment * i; for(var j = 0; j < 120; j++) { // calculations // more code here... // insert latlng database $.getjson(base_url + 'insert_latlng_to_crawl', { lat: lat_current, lng: lng_current }, function(json){ }); } } you should create javascript object, pass server , process server-side var coords=array();//create array store calculations for(var = 0; < 110; i++) { var l...

c# - How do I translate from typeName strings to generics? -

the context of question mvc app takes strings , converts them types , hands them off generic code. i have string representation of type input. i can't seem ever put type variable inside <> generic method. does mean have manually spell out possible cases , generic method calls? right way this? it cool if modelbinder figure out type somehow have generic type parameter action method public actionresult something<t>() . don't know if possible. example public actionresult dosomething(string typename, int? id) { var type = type.gettype(typename); if (type == typeof(apple)) dosomethingelse<apple>(id); if (type == typeof(orange)) dosomethingelse<orange>(id); //if etc ... infinity } if have type you'd have via reflection. assuming "dosomethingelse" method in current class: public actionresult dosomething(string typename, int? id) { type thistype = this.gettype(); // current class type var ...

in Oracle ADF, I want to make an af:query component submit search on each keystroke -

i have af:query component correctly querying table when enter values, , hit search button. i automatically search when key pressed whenever cursor in 1 of query fields. eg behaving autocomplete in list of values. any suggestions on how this? i experimenting af:clientlistener, not have visibility of key presses within af:query component. i doubt result in decent performance - , might annoying end user query in form populated on each keystroke. in case, don't think can query component - maybe should building own search screen this. if interested in having lov query fields might help: https://blogs.oracle.com/shay/entry/dependent_lovs_in_an_afquery_c https://blogs.oracle.com/shay/entry/adf_query_with_parameters_and_1

adobe - Updating a PDF Barcode Field -

Image
i have existing pdf template have edit. know pretty nothing messing pdfs (fair warning). there standard barcode customer wants changed data matrix barcode. what in pdf template right now: so far, have following: open pdf template (opens in adobe acrobat pro) go tools > forms > edit in designer. opens pdf in livecycle designer. right click on on barcode , go palettes > object. opens object tab barcode. now, looks there drop down edit barcode type. it's disabled, , don't know why. the option right click on barcode , select change object type disabled. does know how edit barcode type data matrix? update not want have re-create barcode. want edit there. not add , remove. ok, managed find solution. @ top of livecycle, had 2 tabs. if right click on gray space next tabs, can choose "xml source", makes new tab appear. in "design view" tab, clicked on bar code wanted change (so selected). clicked on "xml sourc...

android - after update: "SQLiteException: unable to open database file" -

why wouldn't there exist sqlite database after app updated new version ? how possible database no longer present though did exist earlier. (using android 2.3.3) error log why sqliteopenhelper.getwritabledatabase() cause exception? surely clever enough realize "oooh db doesn't exist, let's create it! note new sqliteopenhelper(context) worked ok far can tell. however, not know whether oncreate() or onupgrade() triggered. 06-04 18:21:01.706 d/androidruntime( 1280): shutting down vm 06-04 18:21:01.706 w/dalvikvm( 1280): threadid=1: thread exiting uncaught exception (group=0x40015560) 06-04 18:21:01.745 e/androidruntime( 1280): fatal exception: main 06-04 18:21:01.745 e/androidruntime( 1280): java.lang.exceptionininitializererror 06-04 18:21:01.745 e/androidruntime( 1280): @ myapp.com.myactivity.oncreate(myactivity.java:131) 06-04 18:21:01.745 e/androidruntime( 1280): @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1047) 06-04...

c# - Find intersection group of sorted integer arrays -

let's have integer short sorted arrays , need find intersection equal or more predefined constant. here code , demonstrates want better can explain in words. problem speed. code working slow. takes 15 sec on 2000 elements array(on slow machine). ofcourse can implement own intersection method , parallize code give limited improvement. execution time growing n^2 or , 500k arrays takes very long time. how can rewrite algorithm better perfomance? not limited c# language maybe cpu or gpu has special instructions such job. example: input: 1,3,7,8 2,3,8,10 3,10,11,12,13,14 minsupport = 1 output: 1 , 2: 2, 8 1 , 3: 3 2 , 3: 3, 10 var minsupport = 2; var random = new random(datetime.now.millisecond); // numbers each array unique var sortedarrays = enumerable.range(0,2000) .select(x => enumerable.range(0,30).select(t => random.next(1000)).distinct() .tolist()).tolist(); var result = new list<int[]>(); var resultintersection = new li...

android - How to manage UI in java code? -

once set contentview layout, how can manage ui via java? also, if start new activity, reset contentview? contentview in 1 activity. assuming in extends activity have do, after setting content view, access views. have button in layout: button homebutton = (button) findviewbyid(r.id.homebutton); homebutton.settext(); homebutton.setonclicklistener() etc if you're in dialog, or need access views in specific circumstances, or you're in intent , need access stuff in main activity's layout: button secondbutton = (button) getactivity().findviewbyid(r.id.secondbutton); //other methods on button edits-- well images, add imageview layout: <imageview android:id="@+id/logoimageview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/logo" android:contentdescription="@string/app_name" android:layout_gravity="center_horizontal"/...

android - While loops in ondraw -

in on draw made game. zombie comes , have click on him go start , not make house. wanted add pause game though wrap in while loop... when tried when app opens opens black screen. here of code. @override protected void ondraw(canvas canvas) { super.ondraw(canvas); try { thread.sleep(speed); } catch (interruptedexception e) { // todo auto-generated catch block e.printstacktrace(); } text.settextsize(50); white.setcolor(color.white); nightgreen.setcolor(color.parsecolor("#003300")); daygreen.setcolor(color.parsecolor("#339900")); clear.setargb(0, 0, 0, 0); grass.set(0, canvas.getheight()/2, canvas.getwidth(), canvas.getheight()); androiddudehitbox.set((int) androidx, (int) androidy, (int) androidx + androiddude.getwidth(),(int) androidy + androiddude.getheight()); doorhitbox.set(canvas.getwidth()/2 + 360, canvas.getheight()/2 - house.getheight()/2, canvas.getwidth()/2 + 300 + house.getwid...

Changing an object's type after it has been instantiated in PHP -

we have system have reason instantiate object before know specific type is. example, wish instantiate class "media" before know whether final class "book" or "cd". here doing. instantiate "media" object, , once know type of media is, instantiate "book", passing in media object. class book extends media { public function __construct( $parent ) { $vars = get_object_vars( $parent ); foreach( $vars $key => $value ) $this->$key = $value; } } //elsewhere $item = new media(); $item->setprice( $price ); //other code, figure out item type $item = new book( $item ); is there better way this? dynamic polymorphism? in case u can't determine type of object can recommend u factory pattern. pattern u has 1 entry point , helps u yr code simpler , readable. short example: class objectfactory { public static function factory($object, $objecttype) { ...