Posts

Showing posts from July, 2013

java - Android Bug? : String.substring(5).replace(“”, “”) // empty string -

here code: string str = "just_a_string"; system.out.println("]" + str + "["); system.out.println("]" + str.replace("", "") + "["); system.out.println("]" + str.substring(5) + "["); system.out.println("]" + str.substring(5).replace("", "") + "["); system.out.println("]" + str.substring(3, 8) + "["); system.out.println("]" + str.substring(3, 8).replace("", "") + "["); system.out.println("]" + "sdajndan".substring(5).replace("", "") + "["); and here output 05-09 19:09:20.570: i/system.out(23801): ]just_a_string[ 05-09 19:09:20.570: i/system.out(23801): ]just_a_string[ 05-09 19:09:20.570: i/system.out(23801): ]a_string[ 05-09 19:09:20.570: i/system.out(23801): ]a_s[ ** 05-09 19:09:20.570: i/system.out(23801): ]t_a_s[ 05-09 19:09:20.570: i/...

Drupal fails to redirect -

so i'm having bit of problem drupal site. set on localhost , working fine. upload server. , of page works fine, redirects fails. when i'm registered , press logout goes mypage/logout, there remains blank page. same think happens when try search. loads blank page. if go mypagae/node/search-term works. idea may try? if it's here site: http://staging.bringler.com/ . btw. tryied turning on error reporting adding error_reporting(e_all); ini_set('display_errors', true); ini_set('display_startup_errors', true); in index.php no effect. edit: checked error logs in apache found nothing unusual... edit2: notice there problem that: warning: cannot modify header information - headers sent (output started @ /var/www/bringler/modules/menu/menu.module:1) in /var/www/bringler/includes/common.inc on line 153. i offten see warnings that... wow found solution! the problem didnt have ;output_buffering = on uncommented on server. added <?php ...

vsto - Outlook AddIn: How can I call InvokeRequired? -

in outlook 2013 vsto addin, have code: private sub thisaddin_startup(byval sender object, byval e system.eventargs) handles me.startup task.run(sub() dostuff()) end sub private sub dostuff() ' long task stuff call stuffdone() end sub private sub stuffdone() if ????.invokerequired ????.invoke(new methodinvoker(addressof stuffdone)) exit sub end if dim f new form1 f.show() end sub but don't know how call invokerequired since there's no mainform?? thanks why feel need call invokerequired? what i'm doing in case include windows form in vsto project. pass outlook application reference add-in windows form , windows form may spawn 1 or more threads may receive , access outlook application (after locking on reference). windows form methods threads call update gui have invokerequired check mentioned. can't guarantee microsoft recommended approach can been working me error-free on year in case. if prefe...

dependency injection - Ninject ASP.NET MVC without default constructor -

i've come across issue ninject not work unless there blank default constructor in controller. register bindings in ninjectwebcommon.cs in app_start follows: private static void registerservices(ikernel kernel) { kernel.bind<iservices.iaccountprovider>().to<providers.account.service.accountprovider>(); kernel.bind<iservices.icontractprovider>().to<providers.contract.contractprovider>(); kernel.bind<iservices.iproductprovider>().to<providers.product.productprovider>(); kernel.bind<iservices.ichannelprovider>().to<providers.channel.channelprovider>(); kernel.bind<iservices.itaskprovider>().to<providers.task.taskprovider>(); kernel.bind<iservices.iexportprovider>().to<providers.export.exportprovider>(); kernel.bind<iservices.iimportprovider>().to<providers.import.importprovider>(); kernel.bind...

java - Getting Applet not initialized error -

is right in programme?? when run screen appears says applet not initialized import java.applet.applet; import java.awt.*; import javax.swing.*; public class jobseekerlogin extends frame { public void createframe(){ frame frame = new frame("frame in java swing"); frame.setsize(400, 400); frame.setvisible(true); label lb = new label("username"); add("east",lb); add("west",new textarea("")); label lb1 = new label("password"); add("east",lb1); add("west",new textarea("")); } public static void main(string []args){ jobseekerlogin obj = new jobseekerlogin(); obj.createframe(); } } this not applet. think need check out life cycle of applet here: http://docs.oracle.com/javase/tutorial/deployment/applet/lifecycle.html

sql - Creating a union in access with multiple tables and field on one table being the same as multiple fields on others -

Image
here current query screenshot of form: select * jdsubs inner join amipartnumbers on amipartnumbers.oemitem = jdsubs.oempartnumber ((([txtenternumber]) in ([jdsubs].[oemsubnumber],[jdsubs].[oempartnumber]))); union select * ihsubs inner join amipartnumbers on amipartnumbers.oemitem = ihsubs.oempartnumber ((([txtenternumber]) in ([ihsubs].[oemsubnumber],[ihsubs].[oempartnumber]))); union select * mfsubs inner join amipartnumbers on amipartnumbers.oemitem =mfsubs.oempartnumber ((([txtenternumber]) in ([mfsubs].[oemsubnumber],[mfsubs].[oempartnumber]))); can simplify union on 1 query on query can compare txtenternumber oemsubnumber , oempartnumber? i feel 1 query doing work. or doing right? i'm searching millions records want make sure efficient possible you'll have run is. assuming oemitem , oempartnumber , & oemsubnumber indexed, should be. if union first, try compare part numbers, you'll doing against un-indexed qu...

php - Basic Form Validation Check Number? -

in script checking if fields not empty , email address syntactically correct. how add text input @ bottom of form basic sum question, e.g. (2+5)= want add validation element current script check if equals 7. if (empty($name) || empty($phone) || empty($email) || empty($enquiry)) { echo " * sorry fields required."; } elseif(!preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/", $email)) { print "<p>sorry email address entered looks it's invalid.</p>"; } else { mail($to, $sub, $mes, $headers); print "<p>thank ".$name." contacting us.<br /><br />we in touch shortly.</p>"; } if wanting validate static sum, e.g. know going ( 2 + 5 ) = 7 then write simple function check posted value. // being posted value; $validate = 7; function sumcheck($value){ if ( 2 + 5 == $value ){ return true; } else{ return fal...

android - Google maps api v2 get directions -

i using google maps api v2 in android . have placed marker. how can directions between current location , marker.any great. take @ code provided here in 1 of posts creating polyline google direction api, can change class gets data if want other source how it. create class responsible getting direction , parsing: public class gmapv2direction { public final static string mode_driving = "driving"; public final static string mode_walking = "walking"; public gmapv2direction() { } public document getdocument(latlng start, latlng end, string mode) { string url = "http://maps.googleapis.com/maps/api/directions/xml?" + "origin=" + start.latitude + "," + start.longitude + "&destination=" + end.latitude + "," + end.longitude + "&sensor=false&units=metric&mode="+ mode; try { httpclient httpclient = new defaulthttpclient(); ...

sitecore6 - How to render in a Sitecore sublayout the content of some field in a parameter template and make it page editable? -

i have sublayout want able use on multiple pages. need show title bar @ top of sublayout , created parameters template contains title field. want display title in sc:text or sc:fieldrenderer control, able page edit value. how do this? on ascx can have <%= title %> in codebehind can declare this: public string title { get; set; } and in page_load: string rawparameters = attributes["sc_parameters"]; namevaluecollection parameters = sitecore.web.webutil.parseurlparameters(rawparameters); title = parameters["title"]; assuming of course you're doing code on ascx file. although doesn't let edit in page editor. this article read on [edit] figured i'd add code i'm using myself: i have helperclass does: public paramhelper(system.web.ui.usercontrol control) { _sublayout = control.parent sitecore.web.ui.webcontrols.sublayout; if (_sublayout != null) { _params = sitecore.web.webutil.parseurlparamet...

java - XML Serialization with Simple Framework -

i using framework called simple, helpful serializing , deser. xml content. not able serialize xml file object. output object should filled information, null pointer exception. here java code: inputstream = getresources().openrawresource(r.xml.startingdata); serializer ser = new persister(); data data = ser.read(data.class, is); i have file in res/xml/ called startingdata.xml. trying serilize data "data" object. getting nullpointerexception related data object. here startingdata.xml: <data> <categories> <category>inbox</category> <category>private</category> <category>work</category> <category>business</category> </categories> <todos> <todo> <id>1</id> <text>explore app!</text> </todo> <todo> <id>2</id> <text>add more todos!</text> <date>201...

extjs - Play Video in Sencha Touch 2 -

{ xtype:'panel', flex:1, layout:'vbox', items: [ { xtype: 'video', id:'videoplayer', enablecontrols: true, url: filepath, loop: false, flex:1, posterurl: thumbpath, }, { xtype:'panel', cls: 'side_detail_bottom_title', html: 'video title: '+title, } ] } i trying play remote video server. problem play mp4 videos. doesn't play avi , other video formats. is there restrictions on file formats? or wrong code or xtype:video? btw trying in chrome. the video element officialy supports mp4, webm , ogg. http://www.w3schools.com/html/html5_video.asp if provide urls these 3 formats browser use format supports automatically. for example, ios supports mp4 , android supports webm. provide urls these formats , ios automatically pl...

Load images to server from mobile site -

i developing mobile site using asp.net , jquery. no plugin. simple jquery. i using <input type="file"/> of html5. so few questions big picture: 1 .can load files without jquery plugin , simple jquery ? picking file, send using ajax , catch on server side? 2 . have noticed request.files attribute of request object. filled post of whole page or can files there using ajax? 3 .in case answer in 2 "no!", how exclude files data on server side? thanks this solution have found: js: <script type="text/javascript"> $(document).ready(function () { $('#inputfile').on('change', function () { var file = this.files[0]; var name = file.name; var size = file.size; var type = file.type; var formdata = new formdata(); formdata.append(file.name, file) $.ajax({ url: 'ajaxpage.aspx', ...

php - Change the RequestFormat globally for every routes in Symfony 2 application -

is there way change default html requestformat routes in application? this might work, need set each individual route: article_show: pattern: /articles/{culture}/{year}/{title}.{_format} defaults: { _controller: acmedemobundle:article:show, _format: %global_format% }

javascript - I am trying to make a text box only be able to have 4 Digits within it -

i trying make text box allow maximum of 4 digits within , make alert message box if there less 4. have managed using code. <tr> <td id="examnumber">examnumber </td> <td> <input type="text" name="examnumber" maxlength="4" <font size="1">(maximum characters: 4)</font> </td> </tr> if (document.examentry.examnumber.value.length!=4) { msg+="you must enter @ least 4 numbers in examination number \n"; document.examentry.examnumber.focus(); document.getelementbyid('examnumber').style.color="red"; result = false; } however textbox has shrunk in size , looks odd compared other text boxes in code , not digits there still letters , symbols allowed within text field. please , thank in advance. full list of code below if helps: <head> <title>exam entry form</title> <script language = "javascript...

How should I handle this HTTPS request in Python? -

i trying use strava api v3 in python, , afraid missing something. docs say: this base url used strava api requests: https://api.strava.com $ curl -i https://api.strava.com http/1.1 200 ok content-type: application/json status: 200 ok x-ratelimit-limit: 5000 x-ratelimit-remaining: 4999 content-length: 2 responses in json format , gzipped. i doing this: import urllib print urllib.urlopen('https://api.strava.com').read() and gettin this: traceback (most recent call last): file "stravaapiv3.py", line 3, in <module> print urllib.urlopen('https://api.strava.com').read() file "c:\python27\lib\urllib.py", line 86, in urlopen return opener.open(url) file "c:\python27\lib\urllib.py", line 207, in open return getattr(self, name)(url) file "c:\python27\lib\urllib.py", line 436, in open_https h.endheaders(data) file "c:\python27\lib\httplib.p...

physics - ActionScript platformer hitTest -

i making 2d side scroller in actionscript , first ever project using actionscript need little help. need able test if there collision , is. example if player hit object on right side of bounding box stop going right , if player jumped on top of object stop falling still able go right because there no collision right of player. here coding have far player. other object interacts called "plat" http://pastebin.com/0p30ned2 hey should paste code on page helps others in future if need read post. can use hittest task: example: mymovieclip1.hittestobject(mymovieclip2); you can use hittestpoint aswell: working tutorials can found here: http://sierakowski.eu/list-of-tips/39-collision-detection-methods-hittest-and-hittestobject-alternatives.html

asp.net mvc - Any issue with posting a form to a controller using JQuery's serialize method -

i using ajax post form view controller , using $("#formid").serialize() serialize form values. there security issues or performance issues in serializing form prior posting it? would make sensitive data such ssn on form vulnerable kind of security risk ? if going posting social security numbers on site, highly recommend having certificate installed communication encrypted.

jquery - Selecting values on click of button if checkbox is checked -

<div class="tbs_icontainer" style="height: 415px;"> <table class=tbs_table cellspacing=0 cellpadding=0> <thead class=tbs_head> </thead> <tbody class=tbs_body> <tr style="background-color: #ffffff" class=tbs_tr jquery1368094469282="11"> <td style="width: 20px" class=tbs_td><input class=search value=0 type=checkbox name=search jquery1368094469282="12"></td> **<td class=tbs_td>00-0227101-</td> <td class=tbs_td>1</td>** <td class=tbs_td>&nbsp;</td> <td class=tbs_td>medak</td> <td class=tbs_td>02/27/2013</td> <td style="border-right: medium none" class=tbs_td>02/01/2013</td></tr> <tr style="background-color: #ebf4fa" class=tbs_tr jquery1368094469282="13"> <td style="width: 20px" class=tbs_td><input class=search value=1 type=checkbox name=se...

What's wrong with == operator on java string -

this question has answer here: how compare strings in java? 23 answers i have, string str1 = "stringa"; string str2 = "stringa"; now, do (str1 == str2) sometimes doesn't match strings , returns false but str1.equals(str2) returns true what i'm missing here? cannot use equals string can null also. thanks! == compares references not content to compare strings need use string#equals : .equals(); //if consider case .equalsignorecase(); //if not consider case

How to get lost data to mysql replication slave -

i'm having master-slave mysql replication setup. suddenly slave crashed. , master worked without problem. started slave again. , working fine. data sync happening ok. but problem is, data not there on slave @ time when slave down. (new tables , rows of tables). i did change master master_log_file='mysql-bin.xxxxxx', master_log_pos=xxxxx with latest position of master. lost tables , rows not coming slave.(row counts lesser master on tables;) note: current data syncing working. problem can't lost data. is there way data without restarting master database , without going through whole process again ? thanks this how when slave gets out of sync.... on master... # mysqldump -u user -p --all_databases --master-data > all_mysql_data.sql then on slave... # mysql -u user -p -e 'slave stop;' # mysql -u user -p < all_mysql_data.sql # mysql -u user -p -e 'slave start;' # mysql -u user -p -e 'show slave status\g;...

iis - Error opening project from Source Control -

Image
i had bound website in iis d:\project\ortund\ later decided move d:\web\ortund\ reasons. i copied project files new location , changed binding in iis. whenever open solution source control (dynamsoft sourceanywhere), visual studio gives following error: it's generic i'm not sure problem here. has seen before or got clue how fix it? restarting visual studio recommended doesn't help. try use file->source control->change source control update source control binding info. to move project location on local disk, it's recommended use file->source control->open source control , retrieve project new location. way, binding info updated automatically.

Insert rows into tables using OData POST -

what standard method insert data table, update table, delete rows in table using odata? front end sap ui5 , tables stored on hana system. have use post request , use odata.create ? i have of exposed table through xsodata file , used method http request display records. in knowledge, not yet supported insert, update, , delete operation. odata service read-only laid out here . can of course create workaround writing server-side javascript issues sql query request this example.

javascript - Remove attribute multiple from chosen -

i have 2 select: method , list , when method value 1,list have multiple choice when method value 2, don't have multiple choices, this de code: $method.chosen().change(function() { if($method.val() == '1') { $list.attr('multiple'); } else { $list.removeattr('multiple'); } $list.trigger("liszt:updated"); }); and didn't work remove attribute multiple, when don't use chosen plugins works, thanks! using $list.attr('multiple'); return value of attribute multiple . what want set value, try : $list.attr('multiple', true);

Android application crashing when adding button in -

right i'm stuck, , puzzled. have created app , works fine in every other way, having issues buttons in couple of pages. i have copied java , xml pages know work. doesn't solve issue. if take buttons out of java file compiles , runs , loads page. however if put button text (that works every other page) in doesn't load page when start activity this error log 05-09 13:19:33.724: d/androidruntime(896): shutting down vm 05-09 13:19:33.724: w/dalvikvm(896): threadid=1: thread exiting uncaught exception (group=0x2bc9a300) 05-09 13:19:33.735: e/androidruntime(896): fatal exception: main 05-09 13:19:33.735: e/androidruntime(896): android.content.activitynotfoundexception: unable find explicit activity class {com.british.sheep/com.british.sheep.mix}; have declared activity in androidmanifest.xml? 05-09 13:19:33.735: e/androidruntime(896): @ android.app.instrumentation.checkstartactivityresult(instrumentation.java:1541) 05-09 13:19:33.735: e/androidruntime(896...

jquery: numeric input only, but also restrict number of characters -

i using following jquery function allow numeric input. works fine, client wants limit input 8 numeric values. there away, using code below restrict number of characters? $(document).ready(function () { $('input.numberinput').bind('keypress', function (e) { return !(e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57) && e.which != 46); }); });​ thank in advance. try this $(document).ready(function () { $('input.numberinput').bind('keypress', function (e) { if(this.value.length>= 8) { alert('maximum limit 8'); return false; } return !(e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57) && e.which != 46); }); });​

Remove image after loading screen with animation, Android -

i'm trying show splash screen between activities. i'm using handler loads imageview sets visibility gone after amount of time. i wanted make bit more fancy , animate loadanimation. problem i'm running once handler ends animation stops not remove loading image screen. instead placed background whole activity. i know how remove splash image after handler stops. below code: private static final long splashtime = 3000; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main) imageview splash = (imageview)findviewbyid(r.id.splashscreen); final animation = animationutils.loadanimation(getbasecontext(),r.anim.progress_anim); a.setduration(1000); splash.startanimation(a); new handler().postdelayed(new runnable(){ @override public void run() { a.cancel(); splash.setvisibility(view.gone); } ...

mysql - Order by desc and group by on cross table query -

i've tried few options i've seen getting group , order work together...but can't right results. feeding_types table id type quantity feeding_id feedings table id data_entry_id the basic part of query returns following: id type feeding_id 15236 dried_comm 13499 15237 dried_comm 13500 15286 dried_comm 13543 15287 dried_comm 13544 15294 tinned_comm 13550 15295 dried_comm 13551 15296 dried_comm 13552 what want use group latest dried_comm , tinned_comm records these results, , filter out rest. i've tried this: select ft . * , max( ft.id ) id feeding_types ft inner join feeding_types ft2 on ft2.id = ft.id join feedings f1 on ft.feeding_id = f1.id f1.data_entry_id = 15758 group ft.type order i...

c# - The DELETE statement conflicted with the SAME TABLE REFERENCE constraint with Entity Framework -

i have table self reference parentid fk id (pk). using ef (code-first), i've set relationship follows: this.hasoptional(t => t.parentvalue) .withmany(t => t.childvalues) .hasforeignkey(t => t.parentid); when try delete children , parent, delete commands ef issues database not in order expected them go - attempts delete parent record first. i realize have couple of options here (neither of like): delete child records first, full save/commit, , delete parent record. complexity of model , logic maintains it, isn't option - can't issue multiple commit commands whenever want. dissolve relationship before deleting anything. seems more sensible solution, again, have issue separate commit update statement before deletes. want avoid multiple save/commit calls. use trigger delete children prior deleting parent record. i'd avoid triggers , problematic nature as possible. so question is.. there way enforce deletion of children before parent ...

Calling shell script from PHP is not working as expected -

i trying open remote machine browser machine. have setup password less connection ( considering fact both systems in same n/w , trusted). i able run below script launch browser, takes 3 arguments a). username b). ip address of remote machine c). url open in firefox if run script in bash shell, able open browser without issues. if call inside php, not able launch browser on remote machine...it shows debug prints fails open browser. pointers helpful. below shell script open browser on remote machine. #!/bin/bash if test $# != 3; echo " $0 command line script used launch, browser remotely. need pass 3 arguments script. need pass 3 argumemts script, example , \$> sh $0 \"<usernameofremotesystem>\" \"<remotesystemip>\" \"<webpageaddress>\" \$> sh $0 \"uname\" \"172.17.64.94\" \"mail.google.com\" \n"; exit 1 fi echo ...

c# - why do{ }while() loop doesn't work in body of a button_Click( ) method -

this code works correctly in console application, when use in windows forms application doesn't work correctly. never stops , produces no output. i use in console aplication , works : static void main(string[] args) { console.writeline("enter boolean query"); do{ string query = console.readline(); list<int> lst = processquery(query); count = 0; if (lst!=null) { foreach (int in lst) { if (a == 1) { console.writeline(documentcontentlist[count]); } count++; } } else { console.writeline("no search result found"); } } while(1==1); } i try use above code on button_click method in windows forms application, doesn't work. think wrong while(1==1)...

How to get a form to not submit if there are any errors in Javascript -

i don't want form submit if there errors. still want user able click submit button check errors. @ moment submitting , telling user errors or made. showing error error report directly tied submit button. do? here javascript: function validateusername() { var u = document.forms["newuser"]["user"].value var ulength = u.length; var illegalchars = /\w/; // allow letters, numbers, , underscores if (u == null || u == "") { $("#erroruser").text("you left username field emptyyy"); return false; } else if (ulength <4 || ulength > 11) { $("#erroruser").text("the username must between 4 , 11 characters"); return false; } else if (illegalchars.test(u)) { $("#erroruser").text("the username contains illegal charectors men!"); return false; } else { return true; } } function va...

how to get height of band using autoheight powerbuilder -

i have datawindows 2 groups, set 1 of groups header band autoheight , check , set 1 of columns on header band autoheight column also. i want make vertical line 'grew' height column 'grew' autoheight on it. posible in datawindow? or must done using powerscript? you can make of datawindow expressions. let's suppose have column name of "test" , want line has same height "test" column, click on line object on datawindow want verticaly resize click on position tabpage there small box @ end of line 'y1' click on it in popup window put in expression field: integer(describe("test.y")) , click ok there small box @ end of line 'y2' click on it in popup window put in expression field: integer(describe("test.y")) + integer(describe("test.height")) , click ok and magic! feel free ask! regards gábor ps.: here full syntax of datawindow. lets try create , test it: release 12.5; dat...