Posts

Showing posts from April, 2011

java - How to resize image to maximize their dimensions into a panel without changing aspect ratio -

i want draw images panel, need images conserves aspect ratio biggest dimensions drawn on panel. given panel dimensions must create java code maximize dimensions. ideas had needed solve linear programming, , don´t know how in java. wich should easiest way need? you can use darryl's stretch icon . dynamically resize icon fill space available label.

iOS7 MPMusicPlayerController Music Fade-In/Fade-Out Effect -

i've been using mpmusicplayercontroller play music within app, has no volume slider available user. there instances have fade music in , out. far i've been using volume property mpmusicplayercontroller within loop that. after ios7, volume property deprecated. apple wants devs use mpvolumeview . have no use volume slider, need fade music @ occasions. there way ios7? thanks in advance

c++ - How to open a file in boost -

i relatively new using boost library c++ , wondering how open file using this. aim read json file not know how open file. in c++, can this int main () { ofstream myfile; myfile.open ("example.txt"); myfile << "writing file.\n"; myfile.close(); return 0; } but how can using boost? you can use boost::ifstream (which works boost::filesystem::path instance) or use std::ifstream read file. the actual code depends lot on concrete use-case.

r - Assign Colour to each line in ggplot2 -

Image
hello people, trying use geom_line function create line graphs in r. want assign specific colours each line , unable so. when try manually assign colours colour names variables , in legend arranged alphabetically. if don't don't colours @ all. looked around on web , noticed there should grouping variable colours can assigned. unfortunately, in dataset here, each column corresponds different variable. not sure transposing dataset work because trying plot these variables against >2000 values on x-axis. think missing simple here. ggplot(data=data, aes(xvar))+ geom_line(aes(y=var1))+ geom_line(aes(y=var2))+ geom_line(aes(y=var3))+ geom_line(aes(y=var4)) please feel free redirect section if has been answered before. appreciated. i able manually without using ggplot2 function code follows: plot(data$wavelength,data$var1,col="green") par(new=t) plot(data$wavelength,data$var2,col="red") par(new=t) plot(data$wavelength,data$var3,col=&quo

angularjs - jsonp call not returning data in angular? -

i trying return data through jsonp call angular application. tried workaround: angular $resource jsonp not working . did replacing webapi link , callback 'blaat' not triggered? fiddle: http://jsfiddle.net/qc4wk/5/ fragment of code: $http({ method: "jsonp", params: { callback: "blaat" }, url: "http://localhost:7234/api/person", isarray: true }) my apicontroller looks like: public class personcontroller : apicontroller { public list<person> get() { person person1 = new person() { name = "mark", id = 1 }; person person2 = new person() { name = "ed", id = 2 }; person person3 = new person() { name = "fred", id = 3 }; list<person> lijst = new list<person>(); lijst.add(person1); lijst.add(person2); lijst.add(person3);

unzip the file in perl -

my script : #!/usr/local/bin/perl use posix qw(strftime); use strict; use warnings; use getopt::long; ($artifact, $package_id) = @argv; print $artifact; print $package_id; if($artifact =~ /\.zip$/i) { chdir("/apps/checkout/artifactory/xxkintana/$package_id"); unzip $artifact; } run : ./script.pl test-1.0.zip 4370177 error : can't locate object method "unzip" via package "test-1.0.zip" (perhaps forgot load "test-1.0.zip"?) @ ./script.pl line 16. please me -thanks use module archive::zip pull files zip archive. the module contains examples directory including 1 named extract.pl

doctrine2 - Generating joins from tables in entities in Zend Framework 2 + Doctrine 2 -

using following command can generate classes tables: ./vendor/doctrine/doctrine-module/bin/doctrine-module orm:convert-mapping --namespace="application\\entity\\" --force --from-database annotation ./module/application/src using command, can generate getters/setters: ./vendor/doctrine/doctrine-module//bin/doctrine-module orm:generate-entities ./module/application/src/ --generate-annotations=true is possible generate joins based on foreign keys setup in database? thanks.

sublimetext - In sublime text3 I want a 2 column layout with code on one side and the browser display on the other -

Image
i've seen tutorials code in 1 column , display in other in attached image. the image textwrangler , chrome, not maximized. can place cursor @ edge of window, click , drag resize desired layout.

html - Load an xhtml file to a div element using CORS and javascript -

i want load page domain div element in page. i'm using cors , works since shows file loaded in console log cannot manage add div. here's code make more clear: <script type="text/javascript"> function createcorsrequest(method, url){ var xhr = new xmlhttprequest(); if ("withcredentials" in xhr){ xhr.open(method, url, true); } else if (typeof xdomainrequest !== "undefined"){ xhr = new xdomainrequest(); xhr.open(method, url); } else { xhr = null; } return xhr; } var request = createcorsrequest("get", "http://localhost:8080/test/header.xhtml"); if (request){ request.onreadystatechange = function() { if (request.readystate === 4) { if (request.status >= 200 && request.status < 400) { var hpage = request.responsetext; docum

jquery - Regex match javascript/php function name in str -

i'm trying highlight code (and sanitize html) regex not matching function name , params. no @ regex, kinda boggles me begin with. when try use .replace() on matched result sanitize html , add <pre> brackets, gives me error uncaught typeerror: undefined not function guessing because it's not returning basic string? var content = $('#content'), html = content.html(), result = html.replace(/\s.*\(.*\)\s/gi, "<pre>$&</pre>"); // when trying add <pre> tags in last line of code // , use sanitize html.match() error // escapedres = result.replace(/&/g, "&amp;") // .replace(/</g, "&lt;") // .replace(/>/g, "&gt;") // .replace(/"/g, "&quot;") // .replace(/'/g, "&#039;"); // uncaught typeerror: undefined not function content.html(result); jsfiddle example broke

delphi - Why would a class need an empty method to be called to register it? -

i'm evaluating existing dependency injection library delphi, , settled on delphidicontainer because of simplicity - needs single unit file ! however, there 1 thing don't understand — in this example file @ bottom: initialization //with lines linked include actual code services tcsvdataservice.register; tpaddeddataservice.register; these register methods empty, but, if comment out 2 lines in initialization section, dicontainer.get('dataservice') tdataservice fail. why? these empty methods for? the delphi compiler smart , try eliminate unused code when compiling/linking code, compiler's point of view, implementation classes (eg, tcsvdataservice ) in example not used anywhere in program , eliminated, these empty method callings there prevent happening.

python - To retrieve data from django database and display in table -

i trying retrieve data db in django. want display in table. getting error as:\ coercing unicode: need string or buffer, transtype found there 2 models in models.py file: class transtype(models.model): name = models.textfield() created = models.datetimefield(auto_now_add = true) updated = models.datetimefield(auto_now = true) def __unicode__(self): return self.name class trans(models.model): transtype = models.foreignkey(transtype) script = models.charfield(max_length=200) created = models.datetimefield(auto_now_add = true) updated = models.datetimefield(auto_now = true) class meta: unique_together = (("transtype", "script"),) def __unicode__(self): return self.transtype` my views.py file def updatetrans(request): json_data=open('/home/ttt/ali/a.json').read() data = json.loads(json_data) pk, pv in data.iteritems(): k,v in pv.iteritems(): try: trans_type =

actionscript 3 - I must be crazy.... Simple drawing issues.! -

hello amazing stack overflow members need :( i've drawn 3 shapes stage using rectangle tool. (flash cs6). without making these movie clips or naming them, how move them individually!? cheers , love work. put them on separate layers, use shape tweens.

programmatically removing a drawable Tilemode: android:tileMode="disabled" -

i need programmatically disable tilemode of drawable may have arbitrarily set tilemode.clamp , tilemode.mirror or tilemode.repeat . in xml, can use android:tilemode="disabled" , value=-1, achieve this. however, programmatically when calling bitmapdrawable.settilemodexy need use shader.tilemode enum member, has clamp , mirror or repeat disabled absent. how can this?

How does C struct ignore inner order, for a compiler? -

for example, have 2 struct: struct type1 { int t; char c; }; struct type2 { char c; int t; }; in stage can c compiler ignore difference in order , settle them same struct? , how? in stage can c compiler ignore difference in order , settle them same struct? , how? compiler not ignore order in struct members declared. in fact, structure guarantees members laid out in memory in same order declared in, notwithstanding padding bits inserted when necessary struct alignment. therefore, compiler treat struct type1 , struct type2 different types.

python - Entry widget: avoid more than one searchbar -

in code there 2 buttons - when click on first, program writes window "home", second writes window "search" , under "search" create searchbar. problem is, when click on search button twice (or more times) searchbar created more times too. how can fix it? (i want there 1 searchbar). from tkinter import * class app(): def __init__(self): self.window = tk() self.text=label(self.window, text="some text") self.text.pack() button_home = button(self.window, text='home',command= self.home) button_home.pack() button_search = button(self.window, text='search', command=self.search) button_search.pack() def home(self): self.text['text'] = 'home' def search(self): self.text["text"] = 'search' meno = stringvar() m = entry(self.window, textvariable=meno).pack() all have here add variable rep

sql - The multi-part identifier could not be bound error on a function with cursor inside -

i have function takes student id input , returns average grade of student. i'm not sure why i'm getting bound error. because of fetch next command? the courseenrollment table has 2 columns, studentid, courseid , finalgrade create function dbo.personalaverage ( @studentid varchar(20) ) returns decimal begin declare @averagegrade decimal(5,2) declare @totalmarks int declare @numberofcourses int set @averagegrade=0 set @totalmarks=0 set @numberofcourses=0 declare calculateaverage cursor select finalgrade courseenrollment @studentid=dbo.courseenrollment.studentid open calculateaverage while @@fetch_status=0 begin set @numberofcourses = @numberofcourses + 1 set @totalmarks = @totalmarks + dbo.courseenrollment.finalgrade fetch next calculateaverage @totalmarks end if @numberofcourses>

Programmatically redefine Eclipse Help file location -

adding eclipse plugin simple 2 files : plugin.xml <extension point="org.eclipse.help.toc"> <toc file="helptoc.xml" primary="true"> </toc> </extension> helptoc.xml <?xml version="1.0" encoding="utf-8"?> <?nls type="org.eclipse.help.toc"?> <toc label="enide maven readme" topic=".readme.md.html"> </toc> then .html created gfmv plugin in .md file : is there way redefine .html file file location programmatically? the goal enable taking content generated @ runtime docs (e.g. javadocs .htmls) i haven't dug much, have checked out tocprovider attribute of org.eclipse.help.toc extension point?

c# - How to get value of table instead of Id -

i have asp.net project try data asp:repeater. in moment value using <%# eval("categoryid") %> , need instead of company.categoryid company.category.categoryid , how can in asp.net? in mvc i'm using displayfor(x => x.company.category.categoryid) , here have smth similar? this next part of https://stackoverflow.com/questions/23193852/how-to-display-value-in-asprepeater you can evaluates object properties below, <%# ((company)(container.dataitem)).category.categoryid %>

node.js - How to Load test with Node JS and Mongo DB -

how load test nodejs , mongodb using jmeter? need evaluate nodejs , mongo db performance? as web application can loadtest nodejs application via web services or urls. can use jmeter test script recorder record requests , services of nodejs app. if need java script specific can use phanos or loadtest . load test mongo db, since jmeter 2.9 there mongodb sampler.

java fetching DataBase Column Comment -

i using jdbc want databse column comment, way fetch database column comment using resultsetmetadata not show option you can info resultset metadata. see resultsetmetadata e.g. resultset rs = stmt.executequery("select a, b, c table2"); resultsetmetadata rsmd = rs.getmetadata(); string name = rsmd.getcolumnname(1); and can column name there. if do select x y table then rsmd.getcolumnlabel() retrieved label name too. hope ....

visual studio 2012 - "Failed to start project" error by SSIS project in VS2012 -

i have vs2012 solution several different projects, , @ last added 1 ssis project solution. project simple, consist 1 packagethat contains execute sql task, , when build complete project, build succeeded, when debug package, got error: failed start project error starting debugging.(microsoft.datatransformationservices.vsintegration) execute sql task execute 2 lines of code, delete rows , reseed identity, , works in vs2010 shell, in vs2012 not. connection database created successfully, because tested it. old question ran same issue morning. answer question solved me. answering here since first google result query. helps else down road! isvisualstudio2012proinstalled() method not found error when running ssis package vs2012

c - Programmatic access to MathProg solutions in GLPK -

i have problem expressed in mathprog doesn't seem describable using c api. specifically, have constraints between variables. i've generated mathprog file , passed glpk. finds correct solution, don't see how access solution programmatically. returned glp_prob struct has no rows or columns. parse solution printed solver, i'm hoping there's better way. alternatively, if it's possible express constraints between variables using c api, suspect solve problem. mathprog code below. param t := 200; set b, dimen 3; set c, dimen 2; set s, dimen 2; set q := setof{(i,j,c) in b : j == 1} i; set := setof{(i,s) in s} i; set e := setof{(i,j) in q cross i} (i, j); var x{(i,j) in e}, >=0, <=1, binary; var y{i}, >=0, <=1, binary; maximize obj : sum{(i,j,c) in b} x[i,j] * c; s.t. q1c: sum{(i,s) in s} x[1,i] <= 1; s.t. q2c: sum{(i,s) in s} x[2,i] <= 1; s.t. size : sum{(i,c) in c} c * y[i] <= t; s.t. c111avail : x[1,1] <= y[1]; s.t.

Android - ArcGIS for MapView in Android Studio -

i'm trying use arcgis displaying map in application. i'm getting following exception. 04-21 09:47:39.140 12766-12766/com.compo.consumer e/androidruntime﹕ fatal exception: main process: com.compo.consumer, pid: 12766 java.lang.runtimeexception: unable start activity componentinfo{com.compo.consumer/com.compo.consumer.activity.mainactivity}: android.view.inflateexception: binary xml file line #7: error inflating class com.esri.android.map.mapview @ android.app.activitythread.performlaunchactivity(activitythread.java:2195) @ android.app.activitythread.handlelaunchactivity(activitythread.java:2245) @ android.app.activitythread.access$800(activitythread.java:135) @ android.app.activitythread$h.handlemessage(activitythread.java:1196) @ android.os.handler.dispatchmessage(handler.java:102) @ android.os.looper.loop(looper.java:136) @ android.app.activitythread.main(activitythread.java:5017) @ java.lang.reflect.method

javascript - AngularJS : Directive transcluded scope lost -

i’m building directive, i’m calling ‘requires-authorization’ wrap ng-if directive. i’d use follows: <requires-authorization role='superuser'> <!— super secret user stuff goes here, within scope of view's controller —> </requires-authorization> i’ve gotten far as: angular.module('myapp').directive('requiresauthorization', function() { return { template: '<div ng-if=\'iaminrole\' ng-transclude></div>', restrict: 'e', transclude: true, scope: { role: '@' }, controller: function($scope, userservice) { $scope.iaminrole = (usersservice.myroles.indexof($scope.role) !== -1); } }; }); this works, content contained within directive loses scope, scope of controller of view it's found within. overlooking? jsfiddle reference: http://jsfiddle.net/hbamg/8/ notice how auth value isn't displayed inside directive, available outside directive

javascript - DropDown Menu Filtering for Large Categories -

i'm working on website job , been tasked creating dropdown menu filters webpage of table rows based on categories (listed classes). have working using jquery following guide, html , jquery knowledge beginner-ish. here jquery function sample , want figure out how make loop change function 1000+ repetitive lines small 1 page thing that's easy edit. function filtercontent() { var user = document.getelementbyid("mydropdown").value; if(user=="all") { jquery(".cat1,.cat2,.cat3,.") .css("display","block"); } else if (user=="cat1") { jquery(".cat2") .css("display","none"); jquery(".cat3") .css("display","none"); jquery(".cat1") .css("display","block"); else if (user=="cat2

glsl - How does OpenGL interpolate varying variables on the fragment shader even if they are only set three times on the vertex shader? -

since vertex shader run once per vertex (that mean in triangle 3 times), how varying variable gets computed every fragment, if it's assigned (as in example) 3 times? fragment shader: precision mediump float; varying vec4 v_color; void main() { gl_fragcolor = v_color; } vertex shader: attribute vec4 a_position; attribute vec4 a_color; varying vec4 v_color; void main() { v_color = a_color; gl_position = a_position; } so, question is, how system behind know, how compute variable v_color @ every fragment, since shader assigns v_color 3 times (in triangle). all outputs of vertex shader per vertex. when set v_color in vertex shader, sets on current vertex. when fragment shader runs, reads v_color value each vertex in primitive , interpolates between them based on fragment's location.

javascript - Receiving "decodeAudioData error null" in Chrome -

hello web audio developers, i receiving "decodeaudiodata error null" in chrome , "decodeaudiodata error undefined" in firebug. firebug says "the buffer passed decodeaudiodata contains unknown content type." is there wrong code or there else needs worked out "web audio api"? <!doctype html> <html lang="en-us"> <head> <meta charset="utf-8"> <title>together 2 </title> </head> <body> <script type="text/javascript"> window.onload = init; var context; var bufferloader; function init() { window.audiocontext = window.audiocontext || window.webkitaudiocontext; context = new audiocontext(); bufferloader = new bufferloader(context, [ '../web-audio/path/chrono.mp3' ], finishedloading ); bufferloader.load(); } function finishedloading(bufferlist) { var source1 = context.createbuffersource(); source1

json - Azure Mobile Services (Windows Phone) - store complex object -

i playing around azure mobile services. right trying store object of custom class in table. here snippet class represent object want store in azure. public class customitem : inotifypropertychanged { public event propertychangedeventhandler propertychanged; public string id { get; set; } [jsonproperty(propertyname = "categorie")] public categorieobject categorie { get; set; } [jsonproperty(propertyname = "subcategorie")] public subcategorieobject subcategorie { get; set; } [jsonproperty(propertyname = "name")] public string name { get; set; } ... } my question how store custom types categorieobject or subcategorieobject. these classes contain string name , many other properties, need store name of categorie , subcategorieobject. maybe can give me hint, solve problem. thanks! the post @ http://blogs.msdn.com/b/carlosfigueira/archive/2012/09/06/supporting-arbitrary-types-in-azure-mobile-services-mana

coldfusion - unable to understand the createdatetime usage -

i have timestamp in linux epoch format. going through existing code , found following: <cfset timestampval = 1337197600 /> <cfset newtimestampval = dateadd("s", timestampval, createdatetime(1970, 1, 1, 0, 0, 0))/> looked @ coldfusion documentation dateadd , syntax dateadd("datepart", number, "date") so in case, have s second, date in linux epoch format in place of number , don't quite understand why createdatetime(1970, 1, 1, 0, 0, 0)) required. understand linux epoch timestampformat time in seconds elapsed since jan 1, 1970. unable understand above part. which part not understand? seem state reason. cf date not start @ jan 1, 1970. therefore, need add x seconds start date. you may use createdate() instead , ignore time. <cfset timestampval = 1337197600> <cfset newtimestampval = dateadd("s", timestampval, createdate(1970, 1, 1))> see: why coldfusion's epoch time dec 30, 1899?

c++ - Converting a byte into bit and writing the binary data to file -

suppose have character array, char a[8] containing 10101010. if store data in .txt file, file has 8 bytes size. asking how can convert data binary format , save in file 8 bits (and not 8 bytes) file size 1 byte. also, once convert these 8 bytes single byte, file format should save output in? .txt or .dat or .bin? i working on huffman encoding of text files. have converted text format binary, i.e. 0's , 1's, when store output data on file, each digit(1 or 0) takes byte instead of bit. want solution such each digit takes bit. char buf[100]; void build_code(node n, char *s, int len) { static char *out = buf; if (n->c) { s[len] = 0; strcpy(out, s); code[n->c] = out; out += len + 1; return; } s[len] = '0'; build_code(n->left, s, len + 1); s[len] = '1'; build_code(n->right, s, len + 1); } this how build code tree of huffman tree. , void encode(const char *s, char *out) { while (*s) { strcpy(out, code[*s]); ou

javascript - How do I redirect to different port on same host in Meteor? -

i integrating ghost blog runs on port 2368 meteor application runs on port 3000. ghost separate instance. in below template file, hyperlink in meteor app pointing separate instance ghost blog. <template name="header"> <header class="navbar"> <div class="navbar-inner"> <div class="top-nav"> <div> <a href="{{pathfor 'home'}}">home</a> - <a href="http://localhost:2368">blog</a> - </div> </div> </div> </header> </template> it works on local machine, meaning correctly redirects blogging system. didn't work when deployed production, still pointed localhost. what best way detect host name regardless on local or production? there way make work thr

How do I remove the percentage complete label from a Kendo Upload control? -

Image
we upgrading our old telerik upload control kendo upload. 1 additional functionality provided in new control percentage completion number. have decided progress bar sufficient indicator status bar. hence plan remove percentage number displayed(right corner in screenshot). how can removed? function onprogress(ev) { var progress = ev.percentcomplete; } the above property gives number. not sure how disable entirely! fyi - without having onprogress function, percentage gettign dispalyed default try hiding overriding style of <span> contains progress percentage using: .k-upload-pct { visibility:hidden; display:none; }

sql server - T-SQL : UNION ALL view not updatable because a partitioning column was not found -

how can insert in view date constraints? here tables resulted after clicking on script create table : table 1 : create table [dbo].[tbl_zaua_1_17]( [id] [int] not null, [date] [datetime] null, constraint [pk_tbl_zaua_1_17] primary key clustered ( [id] asc )with (pad_index = off, statistics_norecompute = off, ignore_dup_key = off, allow_row_locks = on, allow_page_locks = on) on [primary] ) on [primary] go set ansi_padding off go alter table [dbo].[tbl_zaua_1_17] check add constraint [ck_tbl_zaua_1_17] check (([date]<'2014-01-18 00:00:00.000' , [date]>'2014-01-16 00:00:00.000')) go alter table [dbo].[tbl_zaua_1_17] check constraint [ck_tbl_zaua_1_17] go` table 2 : create table [dbo].[tbl_zaua_1_11]( [id] [int] not null, [date] [datetime] null, constraint [pk_tbl_zaua_1_11] primary key clustered ( [id] asc )with (pad_index = off, statistics_norecompute = off, ignore_dup_key = off, allow_row_locks = on, allow_pag

javascript - Remove '=' character from a string -

this question has answer here: how replace occurrences of string in javascript? 34 answers i have string follows: var string = "=09e8d76c-c54c-32e1-a98e-7e654d32ec1f"; how remove '=' character this? i've tried couple of different ways '=' character seems causing conflict if it's first character work... var string = "=09e8d76c-c54c-32e1-a98e-7e654d32ec1f".substring(1); if it's not first character work... var string = "=09e8d76c-c54c-32e1-a98e-7e654d32ec1f".replace("=", ""); if it's in there more once work... var string = "=09e8d76c-c54c-32e1-a98e-7e654d32ec1f".split("=").join("");

wordpress - Read more link returns blank page -

i've created custom theme , i'm using template blog page. in template have code calls specific posts according category. far good, problem when post contains "read more". link active when click on empty page instead of whole article. this code: <?php $args = array( 'category_name' => 'blog', 'post_type' => 'post', 'posts_per_page' => 10, ); query_posts($args); while (have_posts()) : the_post();?> <?php global $more; $more = 0; ?> <?php echo '<p class="date"><i class="fa fa-calendar"></i> '; echo get_the_date(); echo '</p>'; echo '<h2>'; echo '<a class="permalink" href="';

compiler construction - Apache FIPS support issue -

i have compiled openssl fips library cd openssl-fips-2.0.1 ./config make make install cd openssl-1.0.1c ./config fips shared make depend make make install it has installed in /usr/local/ssl $sudo /usr/local/ssl/bin/openssl version openssl 1.0.1c-fips 10 may 2012 compile apache fips supported openssl cd httpd-2.2.27 ./configure --prefix=/usr/local/httpd-fips --with-ssl=/usr/local/ssl --enable-so make make install added following option in apache sslfips on , got following error $sudo /usr/local/httpd-fips/bin/apachectl -t syntax error on line 38 of /usr/local/httpd-fips/conf/extra/httpd-ssl.conf: invalid command 'sslfips', perhaps misspelled or defined module not included in server configuration

android 4.x with facebook SDK and action bar -

i'm starting develop app android 4.0 uses facebook login. to develop app facebook sdk minimum required sdk it's 2.2 need action bar uses minimum required sdk 3, should develop app facebook sdk , action bar? use appcompat support library google: http://developer.android.com/tools/support-library/features.html#v7-appcompat

c# - Accessing a Mailbox Within An Outlook Account -

i writing application automate sending of e-mails specific mailbox within account available on outlook. able accounts available doing: outlook.application application = new outlook.application(); outlook.accounts accounts = application.session.accounts; i can iterate through available accounts doing: foreach (outlook.account account in accounts) { console.writeline(account.displayname); } my question is: how access mailboxes within exchange account in list. lets first element in accounts list. i have read few other questions on accessing inbox folder contents of mailbox, looking send email item later create using chosen mailbox in "from" field. thanks help.

ios - UICollectionView reload Failure -

Image
whenever tries reloaddata uicollectionview ends following error. sure not releasing variable. nsmutablearray data not released. 1 faced similar issues? can provide me work around? 2014-04-22 22:28:55.010 salesapp[6901:19d03] *** -[uiviewanimationcontext completionhandler]: message sent deallocated instance 0xa4475f0 the nszombie gives me nothing useful..:-( in advance

javascript - What is forcing inline styles in my markup? -

Image
i know totally gonna downvoted, because although think legitimate concern , i'm sure other people have them, it's "codeless" question. :) answer before gets on hold. i make sure not use unnecessary inline styles. today noticed, there script forcing inline styles in markup , can't smoke out. provide website link @ request (i don't wanna come off i'm fishing traffic), way can see happens website loads fine, after hover or click on element, inline style magically appears. here's visual aid thank you so, whenever use jquery apply styles, applies them inline, style="" attribute. check jquery "mystery styles" having trouble with. grep command friend. good luck!

c - kill a specific thread in GDB -

i want kill specific thread in gdb. how attach program gdb. (gdb) r ./bin/myprog arg1 arg2 i current running threads by (gdb) info threads 3 thread 0x7ffff61fe700 (lwp 28549) 0x000000323b6db7ad in foo () /lib64/libc.so.6 * 2 thread 0x7ffff6bff700 (lwp 28548) bar () @ ./src/myprog.c:229 1 thread 0x7ffff7506740 (lwp 28547) 0x000000323be0822d in pthread_join () /lib64/libpthread.so.0 this how tried kill thread (say thread 3) (gdb)t 3 [switching thread 3 (thread 0x7ffff61fe700 (lwp 28549))]#0 foo () @ ./src/myprog.c:288 (gdb)call raise(3,0) here assumed signature of raise raise(threadid displayed in gdb, signo 0) but thread not getting killed. should use different signo or thread id wrong? note: read this question in did not me signal handling in multithreaded apps complicated. thus, makes more sense switch thread, make sure not holding resources (such locked mutexes) , invoke pthread_exit() on behalf if exited on own accord.

android - Can't display dynamically made grid layout -

here code create dynamic text views , create grid layout. grid layout not showing tablerow[] tr = new tablerow[arry1.length]; final textview[] tx = new textview[arry1.length]; gridlayout tl = (gridlayout) findviewbyid(r.id.tablelayout1); tl.setrowcount(arry1.length*2); tl.setcolumncount(1); final button = new button(s1.this); b.settext("hi"); gridlayout[] gl = new gridlayout[arry1.length]; (i = 0; < arry1.length; i++) { final string cat = arry1[i].tostring(); tx[i] = new textview(s1.this); tx[i].setlayoutparams(new tablerow.layoutparams(layoutparams.wrap_content,layoutparams.wrap_content)); tx[i].setallcaps(true); tx[i].settextsize(15); tx[i].settext(cat); gl[i] = new gridlayout(s1.this); gl[i].setlayoutparams(new layoutparams(layoutparams.wrap_content,layoutparams.wrap_content)); gl[i].setvisibility(view.visible); tr[i] = new tablerow(s1.this); tr[i].setlayoutparams(new layoutparams(layoutparams.wrap_content,layoutparams.wrap_content)); tr[i].addview(tx[i],ne

Aligning multiline Java strings in Eclipse -

i'm little new eclipse formatter system. given assignment string on couple of lines this: string cypher = "optional match (update:update {name: {name}})," + "(update)-[:installed_in]->(installation)<-[:current]-(computer:computer {name: {computername}})" + "return update, installation, computer"; i wish have eclipse format when hitting ctrl + shift + f , produce following, + signs aligning nicely under = : string cypher = "optional match (update:update {name: {name}})," + "(update)-[:installed_in]->(installation)<-[:current]-(computer:computer {name: {computername}})" + "return update, installation, computer"; how can achieve that? i'm using formatter.xml file i've imported eclipse: http://pastebin.com/ithw8lub maybe tweak here needed? i played around formatter settings in eclipse, , not able achieve exactly looking for. suspect not

git - How to keep/maintain public and private code in the same repository? (at repository hostings) -

i'm working on own project has 2 parts: a. kernel/generic code (public part) b. code works proprietary protocol etc (private part, available me , few authorized persons) i want repository hosting (maybe github, assembla, ...) allows working in public , private branches in same repository. i don't want 2 repositories because i'm actively working on both parts , want avoid diverged repositories. which solution available me? which allows working in public , private branches in same repository. that doesn't seem compatible how git works: if have access repo, can clone all content (including branches). a git hosting service bitbucket or gitlab allows protect branch (meaning cannot push back). still able see content. gitolite doesn't prevent read-access @ branch level . so 2 separate repos still best approach, repo (kernel) declared submodule of repo b.

html - javascript: get height of pseudo :before element -

i need height of pseudo :before element. sounds no-brainer, cannot work. have tried: $('.test:before').height() // --> null and jsfiddle suggestions wrong ? update: height of .test depends on content. need is, when height gets bigger pseudo element, need add padding right of element. however, because height of pseudo element set css don't know in program super-late reply, but: can use vanilla javascript pseudo-element dimensions using getcomputedstyle method: var testbox = document.queryselector('.test'); // or jquery: testbox = $('.test').get(0); - want js element, without jquery wrapper var pseudobeforeheight = window.getcomputedstyle(testbox, ':before').height; // returns (string) "70px" this return string of pixel value, regardless of css declaration (e.g. 4.375rem = 70px , 10vh = 70px , calc(8vh + 1rem) = 70px , number (in pixels) can do: var pseudoheightnum = parseint(pseudobeforeheight); with rega

layout - Counter-clockwise iOS CircleLayout -

Image
i'm using modified version of apple's circlelayout wwdc found here: https://github.com/mpospese/circlelayout . my current code draws first element @ top , lays out rest in clockwise fashion. how can use code layout starts first element @ top , draws next elements counter-clockwise along path? trigonometry bit rusty. i believe portion of code needs changing is: - (uicollectionviewlayoutattributes *)layoutattributesforitematindexpath:(nsindexpath *)path { uicollectionviewlayoutattributes* attributes = [uicollectionviewlayoutattributes layoutattributesforcellwithindexpath:path]; attributes.size = cgsizemake(item_size, item_size); attributes.center = cgpointmake(_center.x + _radius * cosf(2 * path.item * m_pi / _cellcount - m_pi / 2), _center.y + _radius * sinf(2 * path.item * m_pi / _cellcount - m_pi / 2)); return attributes; } current: desired: replacing angle negative value changes orientation. in cas

php - Facebook events graph not working -

i'm trying facebook page events. i've checked app id , app secret correct , still keep getting error. <?php ini_set('display_startup_errors',1); ini_set('display_errors',1); error_reporting(-1); ob_start(); require 'facebook/src/facebook.php'; $fb = new facebook(array( 'appid'=>'appid', 'secret'=>'appsecret' ) ); $page_events = $fb->api('/pageid/events?fields=description,location,name,owner,cover,start_time,end_time', 'get'); printf ('<pre>%s</pre>', $page_events); ?> the error message: uncaught oauthexception: invalid oauth access token signature. thrown in i'm not sure you've implemented or not code missing- user login/authentication the code not authenticating user. after creating $fb object; use this- $user_id = $fb->getuser(); if($user_id) { try { // proceed api calls - user authenticated @ po

Passive Monitoring with Nagios / Icinga - How to monitor external hosts correctly? -

good morning, our goal monitor many external clients open source monitoring solution icinga or nagios.. because of our customers have multiple devices 1 dynamic public ip, still looking 1 solution works of our clients. amount of clients , networks high can use vpn connect them icinga. fit if clients send check reports icinga host. many other monitoring solutions, such gfi max let clients report through tcp 443 or tcp 80 (failover). if interval has been interrupted, monitoring server mark client critical failure. here more information our internal infrastructure: - icinga core 1.11.1 / nagios - static ip monitoring server - endian firewall at client side: - windows devices nsclient++ - no static ip - nat , firewall configurable based on information can suggest solution let clients send information icinga server, please? besides possible realize scenario without vpn, static ip or dynamic dns? thank helping me out! ok found solution. nsca it's not big deal mak

linux - How to run a bash function() in a remote host? in Ubuntu -

this question has answer here: shell script: run function script on ssh 2 answers i running bash script, when try run functions on remote machine, says bash: keyconfig: command not found here script: keyconfig() { sed -i.bak -r "/^$1/s/([^']+')([^']+)('.*)/\1$2\3/" $3 } remoteexecution() { ssh ppuser@10.101.5.91 " keyconfig $1 $2 $4 " } remoteexecution resone error: when ssh ppuser@10.101.5.91 " keyconfig $1 $2 $4 " you trying execute command keyconfig on remote machine 10.101.5.91 not there: 2 solution problem 1) make script on remotehost contains keyconfig code same name or 2) execute following instead of function ssh ppuser@10.101.5.91 "sed -i.bak -r "/^$1/s/([^']+')([^']+)('.*)/\1$2\3/" $3" please note may have add few escape depending

php - How can I get the amount of memory that remains for Redis -

with redis command info can current memory usage: for example: 'used_memory' => int 600832 'used_memory_human' => string '586.75k' (length=7) 'used_memory_rss' => int 1998848 'used_memory_peak' => int 845056 'used_memory_peak_human' => string '825.25k' (length=7) 'used_memory_lua' => int 31744 and want check how memory left redis . way see check cat /proc/meminfo , compare it. there other way it? there no built-in functionality in redis supply information. the available memory machine-wide. parsing /proc/meminfo indeed way info. see here python example: nagios plugins check_memory we use similar script on our dedicated redis machines (which run several redis-server instances piece), send alerts our in-house exception handling portal when our memory limit reached. kind regards, tw

jquery - my website is a disaster on IE 9 and less -

i have been developping website works on browsers, including ie 11, tried on ie 8 , 9, turned ugly unbelievable caos, css doesn't work, (at least of it) , javascript works terribly. here website: http://dev.ux-pm.com as can imagine, terrified fact, right before deadline website, please if give me headlines of how fix thankful. i using css3, html5 , jquery 1.11.0 it looks need doctype http://validator.w3.org/check?uri=http%3a%2f%2fdev.ux-pm.com%2f&charset=%28detect+automatically%29&doctype=inline&group=0 this clear quite few issues things looking wrong on older versions of ie won't fix everything. validating not cure find more compliant code less bugs occur.

32bit 64bit - Strtol implementation different behaviour on 32 and 64 bit machine -

#include <ctype.h> #include <string.h> #include <stdio.h> #include <tgmath.h> #include <limits.h> #include <stdbool.h> #include <errno.h> #define negative -1 #define positive 1 #define octal 8 #define decimal 10 #define hexadecimal 16 #define base_min 2 #define base_max 36 long int strtol (const char * str, char ** endptr, int base) { if(base < 0 || base == 1 || base > base_max) { errno = einval; return 0l; } else { bool conversion = true; int = 0, sign = positive, save; while(isspace(*(str + i))) i++; if(*(str + i) == '\0') { conversion = false; save = i; } if(*(str + i) == '-') { sign = negative; i++; } else if(*(str + i) == '+') i++; if(base == 0) // find out base { if(*(str + i) == '0')

c# - Is it possible to use Task<bool> in if conditions? -

in windows phone 8 have method public async task<bool> authentication() . return type of function bool when tried use returned value in if condition error says can not convert task<bool> bool . public async task<bool> authentication() { var pairs = new list<keyvaluepair<string, string>> { new keyvaluepair<string, string> ("user", _username), new keyvaluepair<string, string> ("password", _password) }; var serverdata = serverconnection.connect("login.php", pairs); rootobject json = jsonconvert.deserializeobject<rootobject>(await serverdata); if (json.logined != "false") { _firsname = json.data.firsname; _lastname = json.data.lastname; _id = json.data.id; _phone = json.data.phone; _profilepic = json.data.profilepic; _thumbnail = json.data.thumbnail; _email = json.data.email; return tr

c# - Indexing through an Object -

so have datagrid. when row doubleclicked value passed mvvm. list implementation: private list<object> _allqueries { get; set; } public list<object> allqueries { { return _allqueries; } set { _allqueries = value; this.notifyofpropertychange(() => allqueries); } } datagrid implementation: <telerik:radgridview selecteditem="{binding selecteditem}" itemssource="{binding allqueries, mode=twoway, updatesourcetrigger=propertychanged}" autogeneratecolumns="true"> implementation of selecteditem public object selecteditem { get; set; } when put breakpoint selecteditem used it's working perfectly, values being brought. question how interact columns or properties using (var ctx = db.get()) = ctx.interactions.find(selecteditem2); examples of selecteditem be: id = 200 date = 4/24/2014 name = "billy bob" is there way index through properties of object selecteditem[0] give me id number. for generic ob