Posts

Showing posts from February, 2014

delphi - How to Increase MessageDlg width in Delphi7? -

Image
i working on delphi 7. want change messagedlg width. i mean message test long because of message displaying in 2 lines want display message in 1 line. below single line of code messagedlg('i want display in oneline want display in oneline want display in oneline want display in oneline want display in oneline',mterror,[mbok],0) and out put is: above message displaying in 2 lines want display message in 1 line. in delphi 7 messagedlg function implemented on top of createmessagedialog . can call method , have tform instance returned you. can widen form, widen label, , show form. var form: tform; label: tlabel; .... form := createmessagedialog(msg, mterror, [mbok]); try label := form.findcomponent('message'); label.width := label.width + extrawidth; form.clientwidth := form.clientwidth + extrawidth; form.position := poscreencenter; showmodal; form.free; end; all remains work out extrawidth . in implementation of createmessagedia

android - com.google.gson.JsonSyntaxException when AsyncTask with Parser is called More than once -

i'm using asynctask retrieve data backend server , parsing using gson parser. i'm getting com.google.gson.jsonsyntaxexception when execute asynctask more once this parser async public class parsetask extends asynctask<string, void, jsonobject> { public jsonobject jsonobject; string url; @override protected jsonobject doinbackground(string... arg0) { url = arg0[0]; try { url url = new url(url); httpurlconnection connection = (httpurlconnection) url.openconnection(); connection.connect(); jsonparser parser = new jsonparser(); jsonobject = parser.parse(new inputstreamreader((inputstream) connection.getcontent())).getasjsonobject(); } catch (exception e) { e.printstacktrace(); } return jsonobject; } @override protected void onpostexecute(jsonobject json) { super.onpostexecute(json); } } this main activity public class drillonefragment extends activity { private static string url = &quo

.net - Is there any connection string parser in C#? -

i have connection string , want able peek out example "data source". there parser, or have search string? yes, there's system.data.common.dbconnectionstringbuilder class. the dbconnectionstringbuilder class provides base class typed connection string builders (sqlconnectionstringbuilder, oledbconnectionstringbuilder, , on) derive. connection string builders let developers programmatically create syntactically correct connection strings, , parse , rebuild existing connection strings. the subclasses of interest are: system.data.entityclient.entityconnectionstringbuilder system.data.odbc.odbcconnectionstringbuilder system.data.oledb.oledbconnectionstringbuilder system.data.oracleclient.oracleconnectionstringbuilder system.data.sqlclient.sqlconnectionstringbuilder for example, "peek out data source" sql-server connection string, can do: var builder = new sqlconnectionstringbuilder(connectionstring); var datasource =

powershell - The server failed to authenticate the request. Verify that the certificate is valid and is associated with this subscription -

trying script automate deployement in azure on vm created on azure. dandy yesterday. did setup , ali services deploying respective subscription. there number of azure management certificates hanging around in certificates area. i've cleared them out since 1 old. re-imported latest publish settings file hoping starting beginning, happy again. and logged in today, ran 1 of deployment , said: the server failed authenticate request. verify certificate valid , associated subscription. no problem, use handy-dandy add-azureaccount, logs me in, re-run deployment , again says: set-azureservice : forbiddenerror: server failed authenticate request. verify certificate valid , associated subscription. does 1 has idea how authenticate server ? all automation doing on vm created on azure , installed teamcity on vm. when try run scripts directly on vm powershell works fine error occurs when try run teamcity configuration, fails in powershell build step. it though returns subsc

javascript - Trying to make fixed table header in HTML, scroll and visibility issues? -

i have been trying make table in html fixed header (and horizontal scrollbar when necessary). jsfiddle shows have far: html, body { margin:0; padding:0; height:100%; } .horizontalscrollcontainer { position: relative; padding-top: 37px; overflow:auto; } .verticalscrollcontainer { background:transparent; overflow-y:auto; overflow-x:visible; height: 200px; } table { border-spacing: 0; width:120%; } td + td { border-left:1px solid #eee; } td, th { border-bottom:1px solid #eee; background: #ddd; color: black; padding: 10px 25px; } th { height: 0; line-height: 0; padding-top: 0; padding-bottom: 0; color: transparent; border: none; white-space: nowrap; } th div { position: absolute; background: transparent; color: black; padding: 9px 25px; top: 0px; margin-left: -25px; line-height: normal; border-left: 1px solid #800; } th:first-child div { border: none;

wordpress - How to check if Drupal modules are up to date ? -

i using monitoring tool (sensu) execute multiple checks know if server has problems. i have written ruby script know if wordpress date, connect through ssh tunnel server, , connect wordpress database, , check table parse data. exemple if response=lastest, core date. i want same drupal, can't find useful data in drupal database says me module or core date, find version number in system table. have got idea how can check if drupal modules date, if possible server 1 drupal installed ? thanks. there module called nagios ( https://www.drupal.org/project/nagios ) allow visit "check page" , check status of number of different things can monitor. i caution if using drupal distribution, not modules updated in timely fashion, if using standard drupal installation should fine.

Kivy code working fine from the CMD python shell but not from a file saved at Desktop or any location -

Image
from kivy.app import app kivy.uix.label import label class simple(app): def build(self): return label(text = "hello world") if __name__ == "main__": simple().run() the above code works fine when written in python cmd shell , code not works when saved in file . on cmd python shell : from idle, sublime text , different text editors (the file saved on desktop): here's answer own question. issue python path. since creating file on desktop. not reading python or kivy's path correctly. solution create or save project in directory inside python's directory. worked me.

ios - How to display video link coming from API Response -

how display type video link api resopnse.i want use webview or mpmovieplayercontroller display video link <iframe width=\"100%\" height=\"100%\"\r\nsrc=\"https://www.youtube.com/embed/xgsy3_czz8k?autoplay=1\">\r\n</iframe> mpmovieplayercontroller *player = [[mpmovieplayercontroller alloc] initwithcontenturl:[nsurl fileurlwithpath:url]]; player.view.frame = cgrectmake(184, 200, 400, 300); [self.view addsubview:player.view]; [player play]; may helps you.

objective c - Keyboard appearing briefly when popping viewcontroller iOS -

i'm experimenting issue numeric pad when popping current uiviewcontroller uinavigationcontroller. in current uiviewcontroller. have few uitextfield , "save" button in uinavigationbar. expected behavior follows: when user taps "save", keyboard must hide , network operation performed. in callback, uialertview shown. when user dismisses uialertview, notification raises , current uiviewcontroller performs [self.navigationcontroller popviewcontrolleranimated:yes]; the thing is, if "save" pressed keyboard still showing, after performing popviewcontrolleranimated, keyboard appears briefly , left right (as if visible in previous uiviewcontroller). i've tried [mytextfield resignfirstresponder] when user taps "save", when user dismisses uialertview, , in viewwilldisappear method. other answers suggest using [self.view endediting:yes]; but doesn't work either. if use regular keyboard trivial override - (bool)textfi

c# - Windows phone 8.1 RT Modify control in another thread -

i have async function. in function modify control in page. detail this `async public void methodname(){ await ... dosomething; control.visibility = visibity.visible;}` and use task.run(delegate() { getdata(); }); to run function in thread (i want function run implicit). have exception this. control can't modify in thread. know should ? to update ui components separate thread, use so: await dispatcher.runasync(coredispatcherpriority.normal, () => { //update ui here }); an example can found here around line 113. code there called event of accelerometer, , separate thread. therefore code update text boxes in event wrapped in lines posted above. hope solve problem :)

ios - UITextField cursor position does not positioned to same location after changing location with magnifying glass -

Image
my application textfield width in 60 , shows clear button while editing,after entering text(more textfield size means take 15 character) , moving cursor using magnifying glass not show same position left magnifying glass because textfield size small. there other way handle that.i cannot increase textfield size. thanks i pasted screenshots got in ipad mini ios ver 7.0.3 after releasing hand

Is there a way to disable the generation and deployment of Maven sites in Maven 2.2.1? -

we in process of upgrading our build processes , infrastructure. majority of projects still stuck using maven 2.2.1 (we have hundreds of maven projects across number of environment on different hudson , jenkins servers). immediate upgrade 3.3.x most-certainly break things due number of teams affected , large amount of projects haven't been looked after, or have become obsolete. as part of migration, temporarily disable generation , deployment of maven sites. in more recent versions of maven-site-plugin there there 2 properties have come quite handy - maven.site.skip , maven.site.deploy.skip , unfortunately stuck maven 2.2.1 these versions ignored. is there way disable this? there no "clean" way possibilities exist: if don't add site section inside <distributionmanagement/> site not uploaded. see: http://maven.apache.org/pom.html#site_distribution remove section pom might in situation. another try deploy site /tmp/maven-sites specifyin

asp.net - httpContext User Identity -

i restrict user's access on website based on the user identity , used following code works fine in visual studio when publishing iis sending useridentity= null database. dim httpcontext__1 httpcontext = httpcontext.current dim winidentity system.security.principal.windowsidentity = directcast(httpcontext__1.user.identity, windowsidentity) dim useridentity string = winidentity.name hasaccess = getuserfromdb(useridentity) if hasaccess ' restrictions on else end if we need sure windows authentication enabled , anonymous authentication disabled. please see link

sql - Select Date from Excel sheet that may be in one of many formats -

in access, transferring several columns (not all) spreadsheet access table. works fine long date on excel sheet in same format access table, format being "mm/dd/yyyy". however, not of dates on excel sheets in format "mm/dd/yyyy". mon-dd-yyyy, , dd/mm/yyyy. using simple select statement put date in access table, date transfers when in correct format (mm/dd/yyyy) , leaves date column blank entry when in other format. is there way can ensure date formatted "mm/dd/yyyy" before selecting access table? the proper way format dates in mm/dd/yyyy format before loading them access table.

Batch file with "menu" for deleting files referencing path from a text file -

good day all, please pardon me if question may appear odd. not able pinpoint past examples suit ideal script wish accomplish. currently, have following script. delete files folders location listed in text file (del_location.txt). for /f "tokens=*" %%a in (del_location.txt) del \q "%%a" i did not choose use forfiles , network working on in company @ windows 2000 without ability run forfiles , due security reasons, not able install patches. there multiple location in del_location.txt , there instances users may not wish delete listed location. hence wondering how write "menu" function, reads off listed location in del_location.txt , echo selection. lets user choose selection in yes/no fashion before commencement of delete sequence? allowing user "walk off" terminal after choosing wants delete. *also, far can find online, without forfiles , not able choose delete files older n days. right state so? your , advices appreciated.

sql server - Unpivotting multiple columns - substring of column name as a new column with CROSS APPLY -

i have table following format year, month, item, req_qty1, req_qty2 , ....req_qty31 ,converted1, converted2 ....converted31 where suffix of each column day of month. i need convert following format, day_of_month numeric suffix of each column year, month, day_of_month, item, req_qty, converted i thought of using cross apply retrieve data, can't use cross apply "day of month" select a.year, a.month, a.item, b.req_qty, b.converted test cross apply (values (req_qty1, converted1), (req_qty2, converted2), (req_qty3, converted3), ...... (req_qty31, converted31) )b (req_qty, converted) the way found use nested select inner join select a.year, a.month, a.day_of_month, a.item,a.req_qty, d.converted (select year, month, item, substring(day_of_month,8,2) day_of_month, req_qty test unpivot (req_qty day_of_month in ([req_qty1],[req_qty2],[req_qty3],......[req_qty30],[req_qty31]) ) b ) inner join (select year, month, item, substring(day_o

iOS: Terminating application due to uncaught exception 'NSRangeException' -

Image
i have searched through number of these nsrangeexception error threads can't seem find answer question. here error: 2015-08-15 17:28:43.793 utk recruiting[8794:254203] * terminating app due uncaught exception 'nsrangeexception', reason: '* -[__nsarrayi objectatindex:]: index 3 beyond bounds [0 .. 2]' *** first throw call stack: here couple of bits of code. going through documents directories, getting filenames , paths, , i'm trying populate uitableview filenames cell can selected, , file can attached email. here few bits of code: parses documents directory, puts csv files in corresponding arrays. - (void) refreshtable { nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring *documentsdirectory = [paths objectatindex:0]; nsarray *documentarray = [[nsfilemanager defaultmanager] contentsofdirectoryatpath:documentsdirectory error:nil]; nsarray *csvfiles = [documentarray filter

javascript - Wordpress : ReferrenceError $ not defined -

i using wordpress , trying access code snippet .it's showing error in last line }(jquery)); (function($) { $(function () { // slideshow 3 $("#slider3").responsiveslides({ auto: true, pager:true, nav:false, speed: 500, namespace: "callbacks", before: function () { $(".events").append("<li>before event fired.</li>"); }, after: function () { $(".events").append("<li>after event fired.</li>"); } }); }); }(jquery)); it's showing referrence error : $ not defined .i have searched in stackoverflow din't found correct solution.please let me know doing wrong. note : have placed main jquery script above gets included first before other script. typically how setup javascript file using wordpress. add code either header or footer, depending on application makes difference: <script type="app

azure - How to Export AzureVM config using powershell from portal -

i trying restore vm ( http://blogs.technet.com/b/keithmayer/archive/2014/02/04/step-by-step-perform-cloud-restores-of-windows-azure-virtual-machines-using-powershell-part-2.aspx ) requires export vm config before deleting vm. now, trying achieve through runbook. export-azurevm saves config details in file in local machine using windows powershell machine. now, since running in azure portal there way save config file in azure powershell? edit: working expected in azure portal, it's getting c: drive not sure. $exportedfile = "c:\file.xml" new-item -path $exportfolder -itemtype directory $exportpath = $exportfolder + "\" + $vm.name + ".xml" $vm | export-azurevm -path $exportpath output: directory: c:\ mode lastwritetime length name pscomputername ---- --------- ------ ---- ---------- d---- 8/20/2015 2:15 pm

concurrency - Synchronized, wait and notify in Akka -

i'd ask thing. have 1 "rec" actor , more "sen actors". first 1 has list of messages must forwarded , senders actors keep sending messages receiver. something this: class rec (frw: actor) extends actor { val mylist = nil; def act = { case "start" => while(true) {/*extract first number , send frw*/} //i must use new actor if want keep reading messages case => mylist+=i; //should use "synchronize" here (i'm extracting elements other actor after all)? } } class sen (rcv: actor) extends actor { var i=100; def act = { case "start" => while(i>0) {i+=1; rcv ! i;} } } my problem rec must forward 1 message @ time, must save messages in list. there way improve rec actor? don't while(true), can't extract first number whenever receive message (messages stay in long in list). should use synchronized/wait/notify or there better akka? thank , sorr

wordpress - Getting post ID within shortcode on page template -

i using plugin called: inpost gallery. have added shortcode page template can show gallery on each page. shortcode has post_id="10" need post id change each page show images below each page, , therefore use code such get_post_id() i'm unable work.. here relevant shortcode- <?php echo do_shortcode('[inpost_gallery thumb_width="100" thumb_height="100" post_id="10" thumb_margin_left="0" thumb_margin_bottom="0" thumb_border_radius="2" thumb_shadow="0 1px 4px rgba(0, 0, 0, 0.2)" js_play_delay="3000" id="" random="0" group="0" border="" type="yoxview" show_in_popup="0" album_cover="" album_cover_width="200" album_cover_height="200" popup_width="800" popup_max_height="600" popup_title="gallery"][/inpost_gallery]'); ?> here template php incorporates shortcode-

javascript - Angularjs templateUrl vs template scope issue -

i ran strange behaviour on angular. when creating directive if use mod.directive('test', [function(){ return { restrict: 'e', templateurl: '/test/test.html', transclude: true, controller: ['$scope',function($scope){ //$scope equals containing scope of directive. why??? }] }; }]); $scope same scope (not inherited) containing scope of directive. but if create directive as mod.directive('test', [function(){ return { restrict: 'e', template: '<div><div ng-transclude /></div>', transclude: true, controller: ['$scope',function($scope){ //$scope new. inherited container scope }] }; }]); only difference template vs templateurl. "templateurl" 1 uses parent scope "template" 1 creates new scope. dont understand why. angular bug? thanks already

symfony - InvalidConfigurationException in SecurityExtension.php line 429: No authentication listener registered for firewall "secured_area" -

i'm new symfony user , follow tutorial . current task add logout script unfortunately gives me error: invalidconfigurationexception in securityextension.php line 429: no authentication listener registered firewall "secured_area". my security.yml file looks this: security: # http://symfony.com/doc/current/book/security.html#where-do-users-come-from-user-providers providers: in_memory: memory: users: ryan: password: $2a$12$lcy0mefviec3typhv9snnuzofyr2p/axigoqjeds4am4jwhnz/jli roles: 'role_user' admin: password: $2a$12$cytwee9kpq1pjqkfiwuzfucrpwvyazwm4xzmz1qpufl7/flcm3v0g roles: 'role_admin' firewalls: secured_area: # ... logout: path: /logout target: / # disables authentication assets , prof

html - SCORM packages in Moodle and case-insensitivity file system -

i'm running custom-developed scorm package on local moodle instance on windows (which case-insensitive). i've learned through couple of researches, moodle, design enforces case-sensitive file system. is there way override that? my scorm package crashing due file names inside html. , can't fix them cuz have on 500 modules. i'll appreciate given. thanks in advance

java - Spring @Value To Data Structure -

my properties file customer1.username = ""; customer1.passwword =""; customer1.integratorkey="" customer2.username = ""; customer2.passwword =""; customer2.integratorkey="" is there way can use @value annotation , load value in data structure 6 values in it java code @value annotation: @value("${customer1.username}") private string customer1username;

javascript - Getting subset of json from ElasticSearch -

i want have subset of json response elasticsearch server. new elasticsearch , javascript. please have look. json file example file here elasticsearch doc. sample: { "took" : 1, "timed_out" : false, "_shards" : { "total" : 5, "successful" : 5, "failed" : 0 }, "hits" : { "total" : 1000, "max_score" : 1.0, "hits" : [ { "_index" : "bank", "_type" : "account", "_id" : "4", "_score" : 1.0, "_source":{"account_number":4,"balance":27658,"firstname":"rodriquez","lastname":"flores","age":31,"gender":"f","address":"986 wyckoff avenue","employer":"tourmania","email":"rodriquezflores@tourmania.com","

java - Check programatically (without string-matching) whether using IPV6 or IPV4 for JVM -

i want check whether jvm options particular application (in case, matlab) have been set prefer ipv4 or if still use ipv6. i know how set jvm prefer ipv4. in case, can done adding line -djava.net.preferipv4stack=true to java.opts file within $matlabroot/bin/maci64/. i can check whether line has been added java.opts via string-matching. i've pasted current solution (a matlab script checks string-match, , adds line if not exist) @ bottom of question. i don't know how, though, check whether ipv4 or ipv6 preferred without string-matching . seems preferred. does know how check ipv4 vs. ipv6 in jvm without string-matching? here's current solution, depends on string-matching: % osx platform-specific: revert ipv4 if (computer('arch') == 'maci64') javaoptspath = fileread([matlabroot '/bin/' computer('arch') '/java.opts']); k = strfind(javaoptspath, '-djava.net.preferipv4stack=true'); if isempty(k) setenv(

postgresql - SQL query to check if a column within a table has a specific value -

so have table looks this a | type_id | b | 1 | b lot of more rows ...| ... | ... a2 | 3 | b2 what sql query can write check if type_id has value 3? can't print out table because first 3 might in 1 millionth row or somewhere don't know. what have far: select type_id billing.activity order type_id # here? you need add where clause in order not worry going through of data , displaying part relevant. select , b , type_id billing.activity type_id = 3 also, way can think of not "checking if type has value 3" but "checking what rows have type equal 3". hence, not check, more of filtering of data (displaying want see based on conditions specify).

powershell - Concat invoke-SqlCmd query string does not work -

how can concat list of parameter or string of parameter (better) sql query? below not work. $parameters = @("-serverinstance `"mymachine\sqlexpress`"", "-database %targetdbname%", "-username %sqlusername%", "-password %sqlpassword%") $row = invoke-sqlcmd -query "select field table;" $parameters i want execute later multiple queries same connection parameters , usefull reuse them in string can add query string. you on right track. sounds looking splatting . splatting method of passing collection of parameter values command unit. i don't use invoke-sqlcmd should work this: $parameters = @{ serverinstance = "mymachine\sqlexpress" database = "targetdbname" username = "sqlusername" password = "sqlpassword" query = "select field table;" } $row = invoke-sqlcmd @parameters collect parameters hashtable , splat cmdlet. if wanted

java - Spring Cloud Feign Client duplicate list values -

i have interface mapping rest client using spring cloud feign. @feignclient(url = "http://localhost:8080") public interface restclient { @requestmapping(value = "?ids={ids}", method = get) list<posicao> get(@requestparam(value = "ids") list ids); } i have list in parameters, calling client have request: restclient.get(arrays.aslist(1, 2)); http://localhost:8080/ids=1,2,1,2 it's duplicating list values! i tried using array, integer , string generic list, no success. remove ?ids={ids} @requestmapping fixes problem. path parameters need go there.

linq - What's more efficient in .Any and .Count in C# (Extension methods) -

this question has answer here: which method performs better: .any() vs .count() > 0? 7 answers public void methodname(observablecollection<datacollection> datacollection) { if (datacollection != null) { ischecked = datacollection.any(o => o.datacollectionid.equals(30)); ischecked = datacollection.where(o => o.datacollectionid.equals(30)).count() > 0; } } can explain me, efficient way use above 2 filtering? .any? or .where.count? note: consider datacollection has on 10,000 items. please advice me. thank you reviewing framework... depends. initial instincts in hypothetical-land: any() checks see if there single value. if so, returns true. o(1) operation. count() have either 1 of following: 1) access running tally of items in collection, or 2)

python - for every point in a list, compute the mean distance to all other points -

i have numpy array points of shape [n,2] contains (x,y) coordinates of n points. i'd compute mean distance of every point other points using existing function (which we'll call cmp_dist , use black box). first verbose solution in "normal" python illustrate want (written top of head) : mean_dist = [] i,(x0,y0) in enumerate(points): dist = [ j,(x1,y1) in enumerate(points): if i==j: continue dist.append(comp_dist(x0,y0,x1,y1)) mean_dist.append(np.array(dist).mean()) i found "better" solution using list comprehensions (assuming list comprehensions better) seems work fine: mean_dist = [np.array([cmp_dist(x0,y0,x1,y1) j,(x1,y1) in enumerate(points) if not i==j]).mean() i,(x0,y0) in enumerate(points)] however, i'm sure there's better solution in pure numpy, function allows operation every element using other elements. how can write code in pure numpy/scipy? i tried find myself, quit

c# - export to excel throwing System.outofmemoryexception when more than 70k rows (Closed XML) -

i using closedxml export datatable excel in asp.net. works fine if export less 50k rows throwing exception when export more rows. has 31 columns. spliting datatable 10000 rows adding datatable seperate sheet. appreciate if 1 me. below code. xlworkbook wb = new xlworkbook(); foreach (datatable dtdiv in splitdt) //to remove special characters avoid format exception(the datatable has xml content) { foreach (datarow row in dtdiv.rows) { (int = 0; < dtdiv.columns.count; i++) { if (dtdiv.columns[i].datatype == typeof(string)) { if (row[i] != system.dbnull.value) { row[i] = replacehexadecimalsymbols((string)row[i]); } } } } string newstring = "report_" + k; wb.addworksheet(dtdiv, newstring

php - Retrieve facebook user timeline feeds using facebook API -

i looking api retrieves facebook feed users timeline, tried find on google couldn't succeed. i found facebook api user profile, post link, upload photo couldn't find fetch feeds api. yes, can facebook page feeds in case need user timeline feeds. can 1 me know it's possible or not? if yes how can achieve this? thanks in advance!!! i don't understand mean "user timeline feeds". if mean user's newsfeed, no longer possible current graph api version, because facebook doesn't grant necessary oauth permission during login review anymore. if want user's own timeline (what see if go own profile on fb homepage), possible. see https://developers.facebook.com/docs/graph-api/reference/v2.4/user/feed

vbscript - Unexpected Behavior IIS 7 running classic asp -

there may 2 separate issues occurring, or may single issue. 1. when go site running classic asp. first page load no problem. when click second page "500 internal server error there problem resource looking for, , cannot displayed." when refresh page work fine (i.e loads expected). error happens when have not used site period of time (e.g. 5 24 hrs). 2. after that, of pages work out issue except 2. 2 not work have below error message. microsoft vbscript runtime error '800a004c' path not found /fclog.asp, line 153 i confused second error because of asp files in same directory. ones work , one. believe if 1 asp file works in directory of them should well. wonder if these 2 error messages related. not sure next.