Posts

Showing posts from March, 2014

php - An answer to the 'how to get Facebook shares and likes of some URL ?' questions -

i building website need retrieve facebook shares , likes of numerous links , urls different sites. the problem is, urls impossible wanted. example, when data links http://www.example.com/?a=1&b=2&c=3 wrong data http://www.example.com/?a=1 , rest of url ( &b=2&c=3 ) ignored facebook. here @ stackoverflow, lot of people looking answer , many questions unanswered. so, once did right, i'm tell how did it. p.s. : works non-facebook urls. if you're looking shares , likes counts of internal facebook link (image, video ...), won't work you. i'll using php answer question. to likes , shares counts, use fql instead of graph api (even though using graph api send query). but not enough : able so, had call rawurlencode() function on url want data about. otherwise, i'll keep getting errors. so, likes() , function using have counts : function likes($url) { $url = rawurlencode($url); $json_string = file_get_contents("http://

extjs4.2 - EXTJS 4.2 - changing the key in Property Editor -

i using extjs 4.2.1 , have requirement wherein user should have ability edit 'key' in property editor. there way this? in case should use editable grid 2 columns , hide headers. property grid solely modifying value column.

linux - Some simple system calls take milliseconds -

i'm running small number of game servers (one per cpu core). despite hardware quite powerful , no other tasks running on cores, i'm facing problems related stability of frames per second indicator. causes game server processes waiting long (sometimes 3-4 ms, unacceptable in case). strace utility shows like: 17:56:27.683580 gettimeofday({1374414987, 683587}, null) = 0 <0.000003> 17:56:27.683599 gettimeofday({1374414987, 683606}, null) = 0 <0.000003> 17:56:27.683619 gettimeofday({1374414987, 683626}, null) = 0 <0.001693> 17:56:27.685387 gettimeofday({1374414987, 685437}, null) = 0 <0.000034> 17:56:27.685492 gettimeofday({1374414987, 685550}, null) = 0 <0.000025> perhaps reason why lags (taking account gameserver process single-threaded) happen. however, question why of system calls take time? i've tried kernels various types of kernel preemtion, result still same. looking forward help. p.s. os - debian 7 64 bit linux kernel ver

c++ - Stack overflow in VS multithreading -

when try create thread this somefunc(void* param){ char currfile[500000]; char currkeyboard[24576]; char currimage[500000]; char curraddinfo[12000]; } _beginthread( somefunc, 0,null ); the program crash whith stackoverflow exception.but when this somefunc(void* param){ char currfile[500000]; char currkeyboard[24576]; char currimage[500000]; } _beginthread( somefunc, 0,null ); the program don`t crash.why? the reason second function allocates less memory on stack first. way stuff allocate. use vectors instead, they'll allocate on heap, , since manage own memory won't have to.

angularjs - Angular orderBy evaluate expression -

i orderby evaluate expression currently have: ng_repeat: "post in posts | orderby:"up_votes" i instead order {{up_votes - down_votes}} ng_repeat: "post in posts | orderby:'down_votes - up_votes'" just use single quotes wrap expression orderby or add votediff function controller , orderby:votediff

Iteration through 2d array in lua -

i'm starting lua scripting , seem stuck @ simple problem. i'm trying implement floyd-warschall algorithm compute shortest paths between each vertices of graph ( http://en.wikipedia.org/wiki/floyd –warshall_algorithm short explanation of algorithm). written in python (here's code https://gist.github.com/davidcain/4032399 ). version little different, in order make fit main code, same thing. here's commented code. every time run it, "attempt index field '?' (a nil value)" (i feel solution simple enough, can't seem put finger on it. appreciated): function adj(bodies) --returns, 1d array of vertices called "bodies", square adjacency matrix (a matrix of size number_of_vertices x number_of_vertices tells, ones, if vertices connected, or 'infs' if not connected) n = table.getn(bodies) dist = {} _,i in pairs(bodies) dist[i] = {} _,j in pairs(bodies) if == j dist[i][j] = 0

css - Align Inline Element to the Right -

how align 2 text elements, 1 left , other right, on same line. i'm aware can done using floats float less solution. i'm looking way using display:inline . html: <div class="contailner"> <div class="inlineleft">item 1</div> <div class="inlineright">item 2</div> </div> css: .container { width: 600px; border: 1px solid blue; } .inlineleft, .inlineright { display: inline; } .inlineright { ...align right... } you use position:absolute on inline elements , position:relative on container. can align inline elements way want relative container. this: .container { position: relative; width: 600px; border: 1px solid blue; } .inlineleft, .inlineright { position: absolute; display: inline; } .inlineright { right: 0; } demo

ui thread - Android UI: when can I directly modify a view? -

i have app 2 activities. main activity start secondary activity using startactivityforresult() . secondary activity returns data (in form of intent object) main activity. on main activity have method onactivityresult() handle come secondary activity. within onactivityresult() method, need update view on main activity (to reflect new data values). not explicitly spawn threads. question is: can directly modify view within onactivityresult() method, or need put event on ui queue it? more explicit: can sure onactivityresult() method on ui thread, , in case can forget ui queue? yes, can modify view in onactivityresult() . can modify activity 's views anytime after call setcontentview() in oncreate() , long running on ui thread. yes, onactivityresult() called on ui thread. true life cycle methods ( oncreate() , onresume() , etc).

php - Variables infix to prefix to postfix -

i searched on internet implementation in converting not numbers expressions variable expressions infix notation prefix , postfix. searches did weren't successful. want see if there implementation yet in php modify support more operators not (-,*,+,=). for example convert: a+b/c*(p/c) while keeping variable names, , not having enter numbers evaluate them. i have found implementation in evalmath class provided miles kaufmann here : http://www.phpclasses.org/package/2695-php-safely-evaluate-mathematical-expressions.html infix postfix code : // convert infix postfix notation function nfx($expr) { $index = 0; $stack = new evalmathstack; $output = array(); // postfix form of expression, passed pfx() $expr = trim(strtolower($expr)); $ops = array('+', '-', '*', '/', '^', '_'); $ops_r = array('+'=>0,'-'=>0,'*'=>0,'/'=>0,&

ember.js - EmberData - DIsplay belongsTo relationship in Handlebars Template -

i've got handlebars template displaying list of articles. each article has 2 prompts associated through belongsto relationship. information correctly coming server json: {"article":[{"id":7,"prompt_one":{"content":"thing1"},"prompt_two":{"content":"thing2"}]} now i'm able render other data article okay, haven't been able data 1 of prompts render in handlebars template. thought simple as: <p>{{prompt_one.content}}</p> but nothing shows , no errors displayed. what's proper way render associated models content? you can 2 things: embedded records. if prompt objects embedded article's json need define them embedded ( ember-data not support embedded objects ). ds.restadapter.map('app.article',{ prompt:{ embedded:'always' } }) app.article = ds.model.extend({ prompt: ds.belongsto(app.prompt,{embedded:'always'}), }

sql - Database character limit on the end of word? -

ok, know can limit size of characters of table field while fetching, of times split comes in middle of word: select id, title, left(contents, 300) contents posts now, possible make split come after word (at space)? thank you if using sql server, can like: select id, title, left(contents, (case when charindex(contents, ' ', 300) > 0 charindex(contents, ' ', 300) else 300 end) ) contents posts; in mysql: select id, title, left(contents, (case when locate(' ', contents, 300) > 0 locate(' ', contents, 300) else 300 end) ) contents posts; other databases have similar functions.

Visual C# 2008 Express designer not working -

this problem arose after took break work. when went click on designer 1 of forms, message box shown this: i'm not allowed images yet describe: form title states: microsoft visual c# 2008 express edition in main body there error icon , paragraph of text saying: method not found: 'int32 microsoft.visualstudio.shell.interop.ivsrunningdoctableevents2.onaft erattributechangeex(uint32, uint32, microsoft.visualstudio.shell.interop.ivshierachy, uint32, system.string, microsoft.visualstudio.shell.interop.ivshierachy, uint32, system.string)'. now after restarting ide several times , trying again still throws error. not find on google covers issue. please tell me how fix issue? this bug occurs within visual studio , has nothing user. solution : reinstall visual studio... unfortunately.

Efficient way to search List of String Arrays in C# -

i have structure this, string[] variable1= new string["abc", "fss" , "fsfs", "gdgdds"]; string[] variable2= new string["sa", "gs" , "qe", "hf"]; static list<string[]> alllist = new list<string[]>();; alllist .add(variable1); alllist .add(variable2); when string provided want search alllist , provide result array if found . any archiving in efficient way? both provided solutions run in linear time, way slow if have lots of words , make lots of queries. you can use dictionary. dictionary uses hash table internally , much, faster. to put strings in dictionary, can do: dictionary<string, string[]> dict = new dictionary<string, string[]>(); foreach(string[] arr in alllist) foreach(string str in arr) dict[str] = arr; and can search it: string s = "abc"; if(dict.containskey(s)) // result dict[s] else // string not in array h

android - Recommended View Types for UI -

this question has answer here: android facebook style slide 25 answers i new android dev , looking implement app operates similar facebook app (i.e. menu on left). if menu item tapped, view slides in right. have read, appear need use: a horizontal scrollview containing menu view (master) , selected view (detail) the menu view , selected view should list views would right approach achieve ui, or there better approach? this called navigation drawer . android training site has guide creating navigation drawer using supplied drawerlayout , hard work you.

amazon ec2 - nodetool status in cassandra giving previous IP of nodes -

i trying expand 2 node cassandra cluster 4 node cluster 4 amazon ec2 instances. have created 4 nodes , made following changes in cassandra.yaml file. listen_address = 10.30.143.145 seeds = 10.30.143.145,10.159.58.234,10.170.31.252,10.158.52.84 endpoint_snitch: ec2snitch num_tokens: 256 i have replicated these changes across 4 nodes. had expanded single node cluster double node cluster following procedure. however, after configuring 4 node cluster, when ./nodetool status on first node, following output: ubuntu@ip-10-170-31-252:~/viq-cloud/software/apache-cassandra-1.2.5/bin$ ./nodetool status datacenter: us-east =================== status=up/down |/ state=normal/leaving/joining/moving -- address load tokens owns host id rack un 10.30.143.145 927.14 kb 256 16.1% 34d0424a-fe07-4047-a2a5-f45b9a0049d6 1a un 10.159.58.234 135.2 kb 256 15.7% 00308009-8755-4bce-906f-4eda53a31fc6 1a un 10.170.31.252 20.94 gb 256

ruby - no method error for nginx chef recipe -

i'm trying use recipe nginx chef opscode website, http://community.opscode.com/cookbooks/nginx when run recipe, it's triggering no method error traces line of code source.rb. line 28 referred in trace. nginx_url = node['nginx']['source']['url'] || "http://nginx.org/download/nginx-#{node['nginx']['source']['version']}.tar.gz" can explain problem might be? i'm following along railscast http://railscasts.com/episodes/339-chef-solo-basics?view=asciicast recipe (an older version obviously) working ryan. nomethoderror: undefined method `[]' nil:nilclass /var/chef/cookbooks/nginx/recipes/source.rb:28:in `from_file' /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/mixin/from_file.rb:30:in `instance_eval' /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/mixin/from_file.rb:30:in `from_file' /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/cookbook_

html - Targetting specific nested UL list with css -

i'm trying target list of capabilities. in css have: .skills .about { width: 490px; text-align: justify; line-height: 20px; /*letter-spacing: 0px;*/ } .skills .about ul li { display: none; } i don't know how target specific ul list. need change line-height of list match line-height of .skills .about class. how this? <div id="about"> <div class="abouttext"> <h1>who's sam jarvis?</h1> <div class="skills"> <span class="h2span"><h2>bio</h2></span> <p class="about"> i’m freelance designer working out of holland landing, ontario. on last 3 years i’ve spent time graphic design student @ seneca@york honing skills , creating many of works in portfolio. creative field strive , though paid design dabble in photography, illustration, playing guitar , <strong>whee

iphone - Tableview bounce back to content offset -

i have tableview pull-to-refresh style textview offset 50px above table. when drag tableview down, textview becomes visible. want make happen when pull far enough, upon releasing, tableview animates position textview visible. essentially, want animate content offset of -50. when try adding: [self.tableview setcontentoffset:cgpointmake(0, -50) animated:yes]; - (void)scrollviewdidenddragging:(uiscrollview *)scrollview willdecelerate:(bool)decelerate delegate method, table seems jump before returning it's original content offset of 0,0. know how can fix this? thanks,

Connect to SQL Server with Management Studio using Windows Authentication -

i working management studio , want log in databases located on server in domain. login have such windows credentials. i want able log in via management studio on local pc. have found way using command similar to: runas /netonly /user:domain\username "c:\progr...\ide\ssms.exe" while works, isn't easiest or nicest way. there better way? way can within management studio? the elegant ways connect sql server in domain still use windows authentication are: what you're doing: runas /netonly connecting via remote desktop , opening ssms locally on remote server

wso2 esb service endpoint in request -

i getting service endpoint input soap request wso2 esb, based on need send payload data endpoint , response client. please advise how send payload endpoint. tried header mediator no luck. following soap xml request coming esb has service endpoint reference, under property element. <soapenv:envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"> <soapenv:body> <resources> <resource> <properties> <property name="location" value="http://localhost:8280/services/echo.echohttpsoap11endpoint"/> </properties> </resource> </resources> </soapenv:body> </soapenv:envelope> first retrieve address value using expression "//properties/property/@value". set address of header mediator , send message. <property name="address" expression="//properties/property/@value"/> <header name

Build array from select inputs using class with JQuery -

i have multiple selects in jquery mobile. go through these , build array based on option value. code should check each select in class specific option value , place partial id name in array can populate textbox each select chosen "no". textbox show "1,3" if select sel1 , sel3 has no selected. fire off of button click. <select id="sel1" data-role="slider" class="check"> <option value="0">no</option> <option value="1">yes</option> </select> <select id="sel2" data-role="slider" class="check"> <option value="0">no</option> <option value="1">yes</option> </select> <select id="sel3" data-role="slider" class="check"> <option value="0">no</option> <option value="1">yes</option> </select> $('#

sms - How to send a Ctrl-Z in Perl -

i'm trying send ctrl-z command in string, i'm doing: $command = "prueba de código\26"; $port->write($command); $answer = $port->read(255); where "command" string want send trough "port" (device::serialport), , i'm trying capture response "answer", problem i'm think \26 (ctrl-z) not working. port cell phone connected , objective send sms wich "prueba de código" trough phone. need ctrl-z sended because interpreted end of text. the \nnn notation treats numeric arguments octal digits, sending chr(22) (ctrl+v?) $ perl -e 'print ord("\26")' 22 character 26 can expressed in of these ways (and few others) chr(26) "\032" "\x1a" "\cz"

postgresql - Django 1.3 - BooleanField to DateTimeField Migration Fails -

working django 1.3 on postgres 9.1. i've been tasked migrating 2 old bool fields pulled , mail_report timestamps. in attempting migrate following error, i'm not sure how around outside of manually removing non-null constraint in database allow me cast of records null. django.db.utils.databaseerror: column "pulled" cannot cast type timestamp time zone any insight getting around doesn't involve me manually tinkering our live database appreciated. model declaration changes: # reporting checked flags # pulled => object has been processed through order_picklist - pulled = models.booleanfield(default=false) + pulled = models.datetimefield(blank=true, null=true, default=none) # mail_report => object has been processed through report_mailing_list - mail_report = models.booleanfield(default=false) + mail_report = models.datetimefield(blank=true, null=true, default=none) you should read the data migration section in

python - zip variable empty after first use -

python 3.2.3, using idle, python shell t = (1,2,3) t2 = (5,6,7) z = zip(t,t2) x in z : print(x) result : (1,5) (2,6) (3,7) putting in same loop code display z in loop again, after (doing nothing between above , next part) : for x in z : print(x) result : (blank, in no result) z still exists, z results in <zip object @ 0xa8d48ec> i can reassign t,t2 zipped again, works once , once, again. is how supposed work? theres no mention in docs http://docs.python.org/3.2/library/functions.html#zip this. that's how works in python 3.x. in python2.x, zip returned list of tuples, python3.x, zip behaves itertools.izip behaved in python2.x. regain python2.x behavior, construct list zip 's output: z = list(zip(t,t2)) note in python3.x, lot of builtin functions return iterators rather lists ( map , zip , filter )

java - JButton Layout set -

Image
in code, okbutton in bad appear, large , long, how fix problem? public class d7table extends jframe { public jtable table; public jbutton okbutton; public d7table() { table = new jtable(mytablemodel(res)); okbutton = new jbutton("ok"); add(new jscrollpane(table), borderlayout.center); add(okbutton, borderlayout.page_end); this.setdefaultcloseoperation(jframe.exit_on_close); this.setsize(800, 600); this.setlocation(300, 60); this.setvisible(true); } public static void main(string[] args) { swingutilities.invokelater(new runnable() { @override public void run() { new d7table(); } }); } } i remove irrelevant codes. you've added button south position of bordrlayout . default behaviour of borderlayout . it fix it, create jpanel , add button it, add panel south position instead take at a visual guide layouts using layout managers the approach mentioned above

regex - Storing Numerical Data in a Variable through matching in Perl -

i beginner @ perl , want store data file format variable. specifically, each line of file has format following: atom 575 cb asp 2 72 -2.80100 -7.45000 -2.09400 c_3 4 0 -0.28000 0 0 i able use matching line wanted (with code below). if ($line =~ /^atom\s+\d+\s+(cb+)\s+$residue_name+\s+\d+\s+$residue_number/) { } however, want store 3 coordinate values variables or in hash. possible use matching store coordinate values rather having use substring. in instance split each record array , verify identifying fields. coordinate values can extracted array if line has been found relevant. like this use strict; use warnings; $residue_name = 'asp'; $residue_number = 72; while (<data>) { @fields = split; next unless $fields[0] eq 'atom' , $fields[2] eq 'cb' , $fields[3] eq $residue_name , $fields[5] == $residue_number; @coords = @fields[6, 7, 8]; print "@coords\n"; } __data__ atom

php - In Smarty products with the same ID adding together -

do have chance in smarty list items same id (product id) count (add)? {$order_value} {$qty_value} {$id_value} {$title_value} instead of this: order: 004, quantity: 3, product id: 001, title: fish order: 005, quantity: 1, product id: 001, title: fish something this: quantity: 4, product id: 001, title: fish

asp.net mvc 4 - Doing a webrequest to self, periodically, to prevent IIS from killing the app -

why isn't working? iis kills app anyway after 20 mins protected void application_start() { task.factory.startnew(() => daemonstuff()); } private void daemonstuff() { // ping self mywebrequest selfrequest = new mywebrequest(myurl, "get"); selfrequest.getresponse(); // sleep thread.sleep(1000 * 60 * 5); } what i'm doing here visiting own site (with webrequest) every 5 minutes. this way, iis shouldnt think site idle, because getting visits, kills app anyway. so: possible fake visits own site every 5 minutes doesn't killed? the problem asp.net doesn’t know work done on background thread spawned using timer or task. knows work associated request. asp.net don't know work you’re doing , not prevent iis/asp.net turn off web site. a more robust solution use iregisteredobject explanained here . at last, sure myurl correct ? check iis logs this. at last², maybe best

Need to import a txt file to Python and use it with this code (Convert input line to list, append it, and return value) -

i have been writing code hour , can't final step. need modify code below. i've tried , read, it's somewhere in first 3 lines (but whole code may need modified). need convert each input line list, append board list, , return sudoku board @ end. the output @ end should enter file initial s board ==> ; enter board3.txt (included @ end of post) , diagram made in code. def read_board(fn): board = [] line in open(fn,'r'): # fixme def print_board( board ): r in range(0,9): if r%3 == 0: print '-'*25 print '|', c in range(0,9): print board[r][c], if c==2 or c==5: print '|', elif c==8: print '|' print '-'*25 def ok_to_add(row,col,num,board): return true if __name__ == "__main__": name = raw_input("enter file initial s board ==> ").strip() board = read_board(name

css - Aligning different font sizes on the same line of text so it looks nice? -

basically, want have h1 , p element on same line, alignment off lot (meaning h1 higher p , looks crappy) , i've never had css before! i've thrown jsfiddle accompany this, here code: <h1 style="float:left;display:inline;">"hi!</h1><p style="float:left;display:inline;">i'm james, , <strong>love</strong> building clean, fast , (most importantly) effective websites. oh, , know thing or 2 computers.</p><h1 style="float:left;display:inline">"</h1> http://jsfiddle.net/9h8xe/ thanks! some advice before answer: p tag meant create new paaragraph, if not need use span tag instead. try avoid inline styles, use css selectors. http://jsfiddle.net/9h8xe/1/ try , let me know if works html: <h1 >"hi!</h1><p>i'm james, , <strong>love</strong> building clean, fast , (most importantly) effective websites. oh, , know thing or 2 computer

java - Database clear each time my application runs -

does know how reset database everytime application executes in real device ? i have code not work... public void dodbcheck() { try{ file file = new file(context.getexternalfilesdir(null).getabsolutepath()); file.delete(); }catch(exception ex) { } } any solutions ? public void cleardatabase() { sqlitedatabase db = helper.getwritabledatabase(); db.delete({tablename},null,null) // write line each table in db. }

jquery - Change css properties of 3 divs on scroll javascript -

just wanting find out if possible before try hacking code. i have site built on twitter bootstrap fixed-nav @ top. in nav have image .css property set of height , width, , margin set on navbar of 155px, , body padding of 180px compensate big fixed nav. followed carousel (bootstrap feature). the question is, possible resize nav, changing 3 css properties of 3 divs user scrolls past carousel. nav go 180px down 30 px , stay fixed top of page once user scrolls past carousel. use less page real estate. kicker using responsive sizing, affect people viewing on devices larger 979px wide. appreciated. you need scroll function here is demo implement class on menu , style element according http://jsfiddle.net/hushme/3t6lt/2/ $(window).scroll(function () { var sc = $(window).scrolltop() if (sc > 50) { $("#menu").addclass('small') } else { $("#menu").removeclass('small') } });

Batch requests for Google Places (Javascript v3) -

is there way batch requests places library in javascript? i've seen this page , i've gathered it's possible, @ least, i'm not sure how it'd work places api. i need run request every place find on google maps (this leads lot of over_query_limit exceptions). i've given thought queuing requests , running them second apart, if user gets several hundred places queued up, fair amount of results going go missing if user closes page preemptively. i'd rather not defer processing server in case if possible. well, here solution in javascript: var intid = setinterval(function() { try { service.getdetails(place, getmoreplacedetails); clearinterval(intid); } catch(e) { console.info("could not detailed information "+place.name+"; retrying in 3..."); } }, 3000); every place threw exception when tried more details retried in 3 seconds.

php - Can we find out which statement in an IF statement with multiple ORs was being passed? -

if have if-statement such as `<?php if($data[1][0][1] == "aaa" || $data[2][0][1] == "bbb" || $data[1][0][2] == "ccc" || $data[2][0][2] == "ddd") { $return_value = {the index array value being passed above}; echo "which portion in if statement or passed? , return value" . $return_value; }?>` can find out value being passed in or if-statement? in if-statement, can not find out part true. here more detail short-circuit evaluation

inheritance - Why collections classes in C# (like ArrayList) inherit from multiple interfaces if one of these interfaces inherits from the remaining? -

when press f12 on arraylist keyword go metadata generated vs2008, found generated class declaration follows public class arraylist : ilist, icollection, ienumerable, icloneable i know ilist inherits icollection , ienumerable, why arraylist redundantly inherit these interfaces? ok, i've done research. if create following hierarchy: public interface 1 { void doit(); } public interface 2 : 1 { void doitmore(); } public class magic : 2 { public void doitmore() { throw new notimplementedexception(); } public void doit() { throw new notimplementedexception(); } } and compile it, reference dll in different solution, type magic , press f12, following: public class magic : two, 1 { public magic(); public void doit(); public void doitmore(); } you see interface hierarchy flattened, or compiler adding interface

ios - RestKit Testing mapping issue -

i using restkit 0.20.3 , trying setup simple test scenario: i have simple model contains static method return mapping: @interface tktag : nsobject @property (nonatomic) int _id; @property (strong, nonatomic) nsstring *name; + (rkobjectmapping *)objectmapping; @end @implementation tktag + (rkobjectmapping *)objectmapping { rkobjectmapping *mapping = [rkobjectmapping mappingforclass:[tktag class]]; [mapping addattributemappingsfromdictionary:@{ @"tag_id": @"_id", @"tag": @"name" }]; return mapping; } @end and here test: - (void)testobjectmapping { nsbundle *testtargetbundle = [nsbundle bundlewithidentifier:@"here.is.my.bundeidtests"]; [rktestfixture setfixturebundle:testtargetbundle]; tktag *tag = [tktag new]; id parsedjson = [rktestfixture parsedobjectwithcontentsoffixture:@"tag.json"]; rkmappingtest *test = [rkmappingtest testformapping:[tktag objectmapping] sourceo

android - Xamarin Colors Causing Build Errors -

i have android application built xamarin studio. added file named colors.xml resources/values folder. contents were: <resources> <color name="viewbackgroundcolor">#ffffff</color> </resources> to that, following this approach define , use it; however, trying apply view's root element (found resource elsewhere on so, don't have exact link). applied view adding android:background="@color/viewbackgroundcolor" attribute root element. however, generates build error @color/viewbackgroundcolor isn't value. else having issue , there resolution? to reference color, must use lowercase letters. so android:background="@color/viewbackgroundcolor" this because xamarin tools lowercases names compliant rules android has resource names.

node.js - Forever stop server.js returns "server.js is not a valid index for a forever process." -

i inherited server , i'm having odd issue. having problem when running forever start server.js in didn't return message, , forever list didn't show forever processes running. after digging found people suggested running forever sudo . after ran sudo forever start server.js seemed fire fine, , forever list shows server.js running. however, cannot stop process. running kill removes node list displayed @ top , forever still views server.js running. running sudo forever stop server.js returns error "server.js not valid index forever process." running sudo forever stopall or sudo forever list returns node.js:63 throw e; ^ typeerror: cannot call method 'replace' of undefined @ argv (/usr/local/lib/node/.npm/optimist/0.1.2/package/lib/optimist.js:38:33) @ object.<anonymous> (/usr/local/lib/node/.npm/forever/0.3.0/package/bin/forever:81:26) @ module._compile (node.js:462:23) @ module._loadscriptsync (node.js:469:10)

c++ - OpenGL Textures rendering upside down, and blurred -

i developing game earlier , came across bit of issue! had started game single images. each texture had it's own file. bit realized how of idiot that, , tried switch on using 1 picture contains textures ( they're quite small anyway ). now, problem arose. when larger image original texture ( 10 x 10 ) loaded in, it's if it's not being displayed nearest neighbor sizing algorithm. blurred image. it's flipped... why either of these issues happening? code , images below. here first showing sprite sheet containing text , symbols. (it's quite small, 100 x 100 ) http://imgur.com/hu5zeao.jpg this when program run. http://i.imgur.com/hevpdpy.jpg here main.cpp file #include <gl/glew.h> #include <gl/glut.h> #include "spritesheet_class.h" #include "load_img.h" gluint textsheet; spritesheet test; void loadfiles() { gluint textsheet = loadtexture( "davetica.png", 100, 100, 0 ); test.settex( textsheet, 100, 100

go - Golang syntax error: unexpected EOF while writing to a file -

getting syntax error: unexpected eof on last line of code bracket. has file io because json code worked before added in b, err := json.marshal(gfjson) if err != nil { panic(err) filename := ".gfjson" f, err := os.create(filename) if err != nil { panic(err) } // close file on exit , check returned error defer func() { if err := f.close(); err != nil { panic(err) } }() if _, err := f.write(b); err != nil { panic(err) } fmt.fprintf(os.stdout, "gfjson file created.\n") } you missing closing bracket on line 4 after panic. if err != nil { panic(err) } your code compiles fine me, because have random closing brace @ end balancing out. assume indentations close brace @ end end of function , panic should part of if statement.

How do I count distinctly in Access? -

i need have query count number of records , put count beside record represents. example: turkey france turkey united states italy italy turkey france united states france italy italy turns into: country numberofvisits turkey 4 france 3 united states 2 italy 4 i can't seem countries show on own line in post you need use group by in sql statement, e.g.: select country, count(*) numberofvisits countrytable group country

java - Open Android Navigation Drawer from an activity class -

i working on android navigation drawer , through documentation looks like, drawer can extend fragment activity, open drawer activities, need make activities fragment, not feasible solution. is there way can open drawer extends fragmentactivity activity? when try extend drawer activity activity class, , activity open drawer extending draweractivity class (here slidemenuactivity), app crashes giving nullpointerexception. below code opening drawer layout once first activity launches, unable access drawer. app crashing on syncstate point in onpostcreate method @override protected void onpostcreate(bundle savedinstancestate) { // todo auto-generated method stub super.onpostcreate(savedinstancestate); getactiondrawertoggle().syncstate(); } public class slidemenuactivity extends fragmentactivity implements onitemclicklistener { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentvi

checkbox - Extjs 4.1 - CheckboxModel within checkcolumn in grid Fail? -

Image
i try work checkboxmodel , checkcolumn in http://jsfiddle.net/veb7q/ . found bug. that when click checkboxmodel after click checkcolumn see no row selected when click button selected, have ? here button selection ext.create('ext.button', { text: 'click me', visible: false, renderto: ext.getbody(), handler: function() { //alert('you clicked button!'); var s = grid.getselectionmodel().getselection(); ext.each(s, function (item) { alert(item.data.name); }); } }); follow step see bug step 1: click checkboxmodel , see below step 2: click active column , see below step 3: click button "click me" , see bug (no selection here? ). how fix bug. thanks found it.. just add "stopselection : false" in checkcolumn xtype @trungkien , { xtype: 'checkcolumn', text: 'active',

hibernate - How to put envers annotations into XML Mapping Metadata(orm.xml) file -

in application, using xml mapping metadata alternative annotation. worked fine jpa annotations far. auditing, using hibernate envers. declaring @audited @audittable("loan_applicant_audit") problem how put these annotations in xml mapping metadata form. there requirement user should specify list of tables, needs audited. plus should able configure name of audit tables according needs. last step particular column names inside table needs audited should configurable. currently that's not possible. envers works annotating pojos only. there jira ticket enable xml config, doesn't feature come anytime soon: https://hibernate.atlassian.net/browse/hhh-3887 anyway, if want use envers, you'll have go annotations.

java - Information about _JAVA_OPTIONS -

can explain java when _java_options environment variable defined & when application launched on windows machine? you can use _java_options pass default options any jvm process started on system. for example, set _java_options=-dsun.java2d.noddraw=true when jvm starts, parses value of _java_options if parameters @ command line of java. can see passed parameters via jvisualvm. for more information, read blog post: what discovered while trying pass default jvm parameters

ruby api has_many syntax # sign -

in ruby api, examples has_many associations example: firm class declares has_many :clients, add: firm#clients (similar clients.find :all, :conditions => ["firm_id = ?", id]) firm#clients<< firm#clients.delete firm#clients= firm#client_ids why arn't methods firm.clients, firm.clients<< etc.. # sign mean? if written firm.clients , mean it's method call on firm , not on instances of it. if there particular instance firm on want call method, can write firm.clients . 1 purpose of api show methods available on instance of class. firm#clients means method call of clients on arbitrary instance of firm . # used in way not part of ruby syntax, established convention.

uiview - Animate sine wave -

i'm trying animate sine wave in small frame, have searched lot on , on web, goal able reach it's draw static sine wave translate 1 side side, doens't want translation want animation draw of sinewave repetedaly animate in frame. can me? now: wave.h @interface wave : uiview @end wave.m @implementation wave - (id)initwithframe:(cgrect)frame { self = [super initwithframe:frame]; if (self) { // initialization code self.backgroundcolor = [uicolor clearcolor]; } return self; } - (void)drawrect:(cgrect)rect { [[uicolor colorwithred:0 green:192/255.0 blue:255/255.0 alpha:1] set]; cgcontextref context = uigraphicsgetcurrentcontext(); cgcontextsetlinewidth(context, 1); cgcontextsetlinejoin(context, kcglinejoinround); float width = rect.size.width; const cgfloat amplitude = 30 / 4; for(cgfloat x = 0; x < width; x += 0.5) { cgfloat y = amplitude * sinf(2 * m_pi * (x / width) * 5) + 30; if(x == 0) cgcontextmovetopoint(context, x, y); else

css - Make total area of div a link -

what correct way make total area of div link? i have multiple div 's small tiles , want total area of div link. should anchor tag wrap span on inside or best way this? <div class="l-box"> <h3>service 1</h3> <p>service description</p> </div> <div class="l-box"> <h3>service 2</h3> <p>service description<</p> </div> wrap div <a href="#"></a> , give display: block; a

vertical bar showing values in javascript -

i have issue , need help. have realtime graph vertical bar moves cursor , want show value of graph (d.time , d.value) when cursor points to. http://jsfiddle.net/qbdgb/54/ have 2 series of data (data1s , data2s) generated randomly , put time in data generated in "time" variable can see: now = new date(date.now() - duration); var data1 = initialise(); var data2 = initialise(); //make stacked data var data1s = data1; var data2s = []; for(var = 0; < data1s.length; i++){ data2s.push({ value: data1s[i].value + data2[i].value, time: data2[i].time } )}; function initialise() { var arr = []; (var = 0; < n; i++) { var obj = { time: date.now(), value: math.floor(math.random() * 100) }; arr.push(obj); } return arr; } when hover around graph want tooltip show time , value not recognize , show "undefined" since not know how pass datasets (data1s , data2s) "mouseover function can recognize data show! how tooltip functions made , c

javascript - Getting rid of the double click effect -

here's fiddle . can see i've defined simple click event handler: $('#traveller > a').click(function(e) { e.preventdefault(); var $ul = $('#traveller ul'); if($(this).hasclass('handle-next')) { if(math.abs($ul.position().top - parentpadding) < totalheight - itemheight) { $ul.animate({top: '-=' + itemheight}); } } else { if($ul.position().top - parentpadding < 0) { $ul.animate({top: '+=' + itemheight}); } } }); i've noticed when make few double clicks quickly, pressing a.handle-next / a.handle-prev , ul position changes unexpectedly. howcome avoid behavior? just check if $ul animated: if($ul.is(':animated')) return; demo

opencv - drawContours differences between linux and windows -

i find out differences in drawcontour behaviour between windows , linux : following code prints filled contour on windows expect : drawcontours( imin, contours, -1, color, cv_filled, 8 ); however on linux, contour drawn not filled. not using same version of opencv ( 2.4.5 on windows, 2.4.0 on linux), has seen similar ? thank you. actually, list of points in countours differents : repeated 1 time (why don't know). same inputs, drawcontours results indeed same.

vb.net - Database connections analysis in code - MySQL -

i'm analyzing few vb.net applications connect mysql database, since i'm not person programmed them, there few doubts in analysis in terms of when db connection opened or closed. by looking @ administration panel mysql appears not opened connections closed i'd know if there tool capable of analyzing source-code , detect when connection opened , if/when it's closed. does know of such tool?

Android add OnTouchListener to EditText in LinearLayout -

i have layout constructed in xml multiple edittext fields among other stuff. here's part of layout: <scrollview xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/scrollview01" android:layout_width="fill_parent" android:layout_height="fill_parent" android:splitmotionevents="false" android:scrollbars="vertical" > <linearlayout android:layout_width="fill_parent" android:id="@+id/linearlayout01" android:layout_height="wrap_content" android:orientation="vertical" > <linearlayout android:layout_width="match_parent" android:layout_height="20dp" android:layout_marginbottom="5dp" android:background="#808080" android:gravity="center_vertical|center_horizontal" android:orientation="horizontal" > <textview

memory - c - cheak readable bytes -

need little form guys i wanna cheak if byte readable or not, have search sulution not find hope me i have code need if tag cheak if byte readable #include <windows.h> #include <iostream> #include <cstdlib> #include <stdio.h> void main() { float ramsize; char *ch; unsigned int j=128,readbyte; long i; memorystatusex statex; statex.dwlength = sizeof (statex); globalmemorystatusex (&statex); ramsize = statex.ulltotalphys; for(i=0;i<ramsize;i = i+1) { ch = (char*) i; readbyte = *ch; // if readbyte readable printf("you have readable byte in address: %x , contain in binary:",&readbyte); for(i=0;i<8;i++) { if(readbyte&j) printf("1"); else printf("0"); j=j>>1; } putchar('\n'); // if readbyte not readable printf("sorry: cant read byte

c# - Process.arguments in createprocess? -

the following works fine in process.start situation. private string path() { registrykey key = registry.localmachine.opensubkey("software\\wizet\\"); registrykey location = key.opensubkey("maplestory"); return location.getvalue("execpath").tostring(); } public bool launch() { maplestory = new processstartinfo(); maplestory.filename = path() + @"\maplestory.exe"; maplestory.arguments = "webstart"; maplestory = process.start(maplestory); } where place '.arguments' if use createprocess , place create_suspended well? createprocess(appname, intptr.zero, intptr.zero, intptr.zero, false, 0, intptr.zero, null, ref si, out pi); in second argument can put command line options. , in sixth can put creation options create_suspended. createprocess(appname, "webstart", intptr.zero, intptr.zero, false, cre

android - Which is safer for Algorithm implementation? -

i've data processing algorithm apply 1 of android application. algorithm can implemented via java or native code c. safer algorithm implementation java or c far know android dex file can reversed engineered. applicable c? code safety maximum when in c(native) java. "so far know android dex file can reversed engineered. applicable c?" doing in java by making code-pakages library can make java codes safe. if reverse engineerd or apk breaked code not visible, encrypted format. change algorithm package library , add project assets folder , buildpath. doing in c and if doing in c sure 1 breaks apk cant see c code. sometime visible not in readble format. if implementing via c, make process more faster in java , allocated more memory process. heap memory not limitation code. thing is, because of using jni chances of getting errors more , difficult trackdown errors in runtime. note :since hacking can done in many ways.. cant give compleate assuranc