Posts

Showing posts from January, 2010

firefox addon - How to get the tab Index of the right clicked inactive tab? -

firefox addon - How to get the tab Index of the right clicked inactive tab? - who tab index of right clicked tab fires tab context-menu. tab not active tab (not selectedindex )? as example. "close tabs right" in tab context menu works regardless of tab (active/not-active) tab right-clicked. how right tab index? listen for popupshown event of tabcontextmenu element. since restartless addon assume have reference chromewindow. class="lang-js prettyprint-override"> var tabcontextmenu = chromewin.document.getelementbyid("tabcontextmenu"); tabcontextmenu.addeventlistener("popupshown", function(){ var rightclickedtab = chromewin.tabcontextmenu.contexttab; // proceed wish }, false); you can add together own menu item , hear command event. in case, remember cleanup when extension gets unloaded. firefox-addon firefox-addon-restartless

java - Call getFragmentManager() without extending Fragment -

java - Call getFragmentManager() without extending Fragment - i have class handling database in android app. when database changes, i'd update fragment displaying info frogment. approach has been give fragment tag , find fragment next code: fragmentmanager manager = getfragmentmanager(); fragment fragment = manager.findfragmentbytag("schedule"); if (fragment instanceof schedulefragment){ schedulefragment fr = (schedulefragment)fragment; fr.scheduleupdated(); } however, long database class not extension of fragment, compiler refuses recognise getfragmentmanager() . me makes no sense extend fragment, database class no fragment, simple helper class manage database. possible reference fragment without extending fragment? or bad practice , should done in way? also, possible reference fragment static method? try using localbroadcast manager. when database changes laumch broadcast intent. registere in "

android - Sprite Zoom in and zoom out animation in libgdx -

android - Sprite Zoom in and zoom out animation in libgdx - i developing game in libgdx need zoom in , zoom out popup clearing every stage in game. please guide me how zoom effects in libgdx. note doing android device. kindly assist. you can zoom using property of same name of ortographiccamera. camera.zoom = 1; //normal zoom (default) camera.zoom = 2; //zoomed in camera.zoom = 0.5f; //zoomed out if mean "zooming" particular image, create bigger , smaller. android libgdx

NUnit v3 alpha in command line: Assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) -

NUnit v3 alpha in command line: Assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) - i'm trying run nunit v3 alpha command line. here's command line: [...] \nunit3\nunit-console nunitalpha3experimental.exe /framework:net-4.5 at first, got error: errors , failures not load file or assembly 'nunit.framework, version=3.0.5378.31152, culture=neutral, publickeytoken=2638cd05610744eb' or 1 of dependencies. assembly built runtime newer loaded runtime , cannot loaded. then edited nunit-console.exe.config comment .net 2.0 <startup uselegacyv2runtimeactivationpolicy="true"> <!-- comment out next line forcefulness utilize of .net 4.0 --> <!--<supportedruntime version="v2.0.50727" />--> <supportedruntime version="v4.0.30319" /> </startup> i tried these command line (with 4.0 , 4.5) [...] \nunit3\nunit-console nunitalpha3e

web services - Move laravel 4.2 from localhost to shared, or not, web hosting -

web services - Move laravel 4.2 from localhost to shared, or not, web hosting - i'm trying upload working laravel web app localhost web server, still have same problem: white page. if set phone call phpinfo index.php can see result. i've tried maintain same directory construction of original project, when navigate myhost.com/app/public see white page. i've tried move content of public upper dir, alter paths bootstrap/paths.php of public var '/..' , index.php (removing ../ require autoload.php , start.php), same problem. @ last, i've tried add together lines .htaccess rewriteengine on rewritecond %{request_uri} !^app/public rewriterule ^(.*)$ app/public/$1 [l] ...and white page. so don't know problem. the public/ directory should not within of app/ directory. if you're on shared host you're on virtual host. all should have move project, create sure host has mod_rewrite enabled , allowoverride all in apache configu

statistics - Efficient Method to do Calculations on Joint Distributions in R -

statistics - Efficient Method to do Calculations on Joint Distributions in R - if have next joint distribution top row value of y , first column on left values of x, efficient/clean way of going calculating covariance , correlation between x , y? i thinking of loading each row new variable , doing necessary calculations , running cov() , cor() functions, know there has improve way? thanks! | | 14 | 22 | 30 | 40 | 65 | |---|-----|-----|-----|-----|-----| | 1 | .02 | .05 | .10 | .03 | .01 | | 5 | .17 | .15 | .05 | .02 | .01 | | 8 | .02 | .03 | .15 | .10 | .09 | you should utilize matrix multiplication results. next not most efficient way, uses formulas in straightforward way. # input info yvec <- c(14, 22, 30, 40, 65) xvec <- c(1, 5, 8) jp <- matrix(c(.02, .05, .10, .03, .01, .17, .15, .05, .02, .01, .02, .03, .15, .10, .09), nrow=length(xvec), ncol=length(yvec), true) ex <- rowsums

ios - Facing issue in UIScrollview in Swift -

ios - Facing issue in UIScrollview in Swift - i new ios development.i working on swift programming.i trying create scrollview getting "fatal error: unexpectedly found nil while unwrapping optional value" every time. used optional value in below code. here code class viewcontroller: uiviewcontroller { var imagelist=["apple.jpeg","pears.jpeg","banana.jpeg","grapes.jpeg","mango.jpeg"] var itemnames = ["apple", "pear", "banana", "grapes", "mango"] var scrollview: uiscrollview! var ypos: float? ypos!=0 override func viewdidload() { super.viewdidload() // additional setup after loading view, typically nib. createscrollview() } func createscrollview() { scrollview = uiscrollview(frame: view.bounds) var index = 0; index < self.imagelist.count; ++index { va

html - Why is this ported JavaScript from VB.NET not executing? -

html - Why is this ported JavaScript from VB.NET not executing? - i'm taking old vb.net toy made in 2006 , trying convert html/javascript/css3, functionality can embedded in page on tumblr. however, i've managed item 99% converted vb.net form javascript form. problem is, item won't code. this below html of body of web port: <table id="jewelryjiddyapp"><tr> <td colspan="2"><div id="logofield"><p id="jiddymainlogo">jewelry jiddy's</p> <p id="jiddysublogo">wedding ring store</p></div></td> <td> <div class="fieldlabel" style="margin-top:25px;">model name</div> <form> <select id="modelbox"> <option id="heartsinlavaflow">hearts in lavaflow</option> <option id="scarofafrica">scar of africa</option> <option id="monkeysuncle">monkey's un

javascript - BackBoneJs donot Delete/Update Model to the server -

javascript - BackBoneJs donot Delete/Update Model to the server - i have application reads/create/update model , save server. presently able read , save models , database. unable delete / update model , server. views gets deleted of model not model self here jsfiddle path http://jsfiddle.net/u17xwzlh/1/ $(function() { model var modelcontact = backbone.model.extend({ defaults: function() { homecoming { id: 0, name: "", address: "" }; }, //if add together idattribute = "id" deletes value server //but unable create new model/new entry database clear: function () { // deletes model changes not posted server this.destroy(); } }); collection // runs fine var contactcollection = backbone.collection.extend({ model: modelcontact, url: 'api/contact' }); var contacts = new contactcollection; modelview var contactview = backbo

javascript - How to update all data in jQuery.dataTables with client-side data? -

javascript - How to update all data in jQuery.dataTables with client-side data? - i've been fruitlessly been trying jquery.datatables allow me update info in table using javascript. know has been discussed on before, haven't been able create of solutions i've seen work. i have parameter called data represents info display in table. passed function. i have thought way update info this: // checked new info returned $table.data() afterwards $table.data(data); // info updated, redraw table. $table.fndraw(); nothing seems happen when above code runs. doing wrong? i have no problem using fnupdate update info in individual rows, find particularly perplexing. update: after giving more careful research, found can accomplish desired result doing following: $table.fncleartable(); $table.fnadddata(data); $table.fndraw(); however, problem above user loses place in pagination , has

java - Rotating rectangle and adjust positon -

java - Rotating rectangle and adjust positon - i'm struggling rotation of rectangles. have rectangle consists of 9 little rectangles. http://i57.tinypic.com/msn8ue.jpg now rotated big rectangle accordingly affine transformation, worked pretty fine. http://i61.tinypic.com/25phlqp.jpg my problem need move rectangles, top left position of each rectangle @ point x,y. i don't know how , hope can help me out. thanks! public class mainclass { public static void main(string[] args) { jframe jf = new jframe("demo"); container cp = jf.getcontentpane(); mycanvas tl = new mycanvas(); cp.add(tl); jf.setsize(800, 800); jf.setvisible(true); } } class mycanvas extends jcomponent { private static final long serialversionuid = 5703217428905757134l; @override public void paint(graphics g) { graphics2d g2 = (graphics2d) g; g2.setrenderinghint(renderinghints.key_antialiasing, renderin

Calculate dunn index for Kernel Kmeans in r -

Calculate dunn index for Kernel Kmeans in r - i ran kmeans on info using: spherical_data <- kmeans(mydata,4) now calculate dunn index used: spherical_data <- kmeans(mydata,4) dist <- dist(mydata,method="euclidean") dunn(dist, spherical_data$cluster) here sec argument dunn function vector contains cluster memberships of points in mydata. now ran kernalized kmeans follows: kernel_kmeans <- kkmeans(mydata, centers=4, kernel = "rbfdot", kpar = "automatic") kernel_kmeans gives me next output: spectral clustering object of class "specc" cluster memberships: 3 1 3 3 3 2 3 3 2 3 2 2 3 2 1 4 3 1 2 1 3 3 4 2 2 1 1 2 3 3 2 1 4 1 2 3 3 2 3 4 2 2 3 1 1 3 2 2 3 3 1 3 3 1 1 2 1 4 4 3 3 3 3 4 3 3 3 3 3 2 1 3 1 2 3 2 4 3 1 2 3 2 4 2 3 2 1 3 3 4 2 3 2 3 1 2 3 4 2 3 2 4 1 2 1 1 2 1 2 1 1 3 3 3 3 2 3 3 1 1 1 2 1 4 1 1 3 3 2 4 3 3 1 3 1 2 1 2 1 2 3 1 1 1 3 3 4 2 1 3 1 1 3 3 3 3 3 2 2 gaussian radial basis kernel func

powershell - Why does a hash table formatting change automatically? -

powershell - Why does a hash table formatting change automatically? - i want know why removing comment tag 'nextrun' property in hash table in below code causes default formatting switch table list. $a=get-scheduledtask|sort state` $b=$a|get-scheduledtaskinfo` ($i=0; $i -lt $a.count;$i+=1)` {$props=@{'name' =$a[$i].taskname; 'description'=$a[$i].description; 'state' =$a[$i].state; #'nextrun' =$b[$i].nextruntime; 'lastrun' =$b[$i].lastruntime} $obj = new-object -typename psobject -property $props $obj}` or, there different object type prevent happening ? when outputting object properties without formatting cmdlet, powershell looks @ number of properties determine if it's going utilize table or list. in experience, 5 or more properties auto-format list, less auto-format table. in case need utilize formatting cmdlet impact output formatti

How can i draw something in C# -

How can i draw something in C# - i'm looking way draw (like racing map) in c# in illustration paint . pass info toy auto follow it. don't need write code, need suggestion of way it. i think unity might you. it's game engine free license, , can programme in c#. c#

JQuery modify an element on document.on('blur') -

JQuery modify an element on document.on('blur') - here general version of code trying accomplish (the code incomplete, give general idea): $(document).on('blur', '#idoftextbox', function(event) { function savedata(uri, stringval, success, failure) { $.ajax({ //initialize json object here }); } savedata("/myurl", "mystring", successfunction, failurefunction); function successfunction(response) { var successstring = 'valid'; $('#successmsgtextarea').text(successstring); $('#successmsgtextarea').removeattr('class', 'errormsg'); $('#successmsgtextarea').attr('class', 'successmsg'); } function failurefunction(response) { var successstring = 'invalid'; $('#successmsgtextarea').text(successstring); $('#successmsgtextarea').removeattr('class', 'successmsg'); $('

c++ - error: 'ios_base' has not been declared -

c++ - error: 'ios_base' has not been declared - i using libcurl download serialized code , bust open but, error looks fstream missing much included. looked around little on error. below error , code. did miss? compile error output g++ -g testgetprice2.cpp -o testgetprice2.o -std=gnu++11 -lcurl testgetprice2.cpp: in function 'int getdata()': testgetprice2.cpp:45:56: error: 'ios_base' has not been declared testgetprice2.cpp:45:72: error: 'ios_base' has not been declared code: #include "rapidjson/include/rapidjson/document.h" #include <iostream> #include <fstream> #include <stdio.h> #include <curl/curl.h> #include <unistd.h> #include <unordered_map> #include <string> using namespace rapidjson; struct mydata { std::fstream *file; std::string *str; }; size_t write_data(void *ptr, size_t size, size_t nmemb, mydata *data) { size_t numbytes = size * nmemb; if

How to handle authentication in hybrid ASP.NET and PHP website? -

How to handle authentication in hybrid ASP.NET and PHP website? - i taking on community website built using kentico (an asp.net-based cms). i have php/codeigniter code add together interesting functionality kentico website. example, php code allows uploading , posting of user-generated material such images, community can comment on. since i'm unfamiliar how kentico works, wonder if knows if functionality exists in (as module). if not, either would have coded in asp.net or i have hybrid website using php code, authentication kentico side have passed php side of website. any suggestions on how handle situation? you can store authenticated session in db both asp , php have access php asp.net codeigniter authentication kentico

Python pysrt index error -

Python pysrt index error - i have used pysrt befor , programs runs well; when want utilize know recieve error: traceback (most recent phone call last): file "", line 1, in subs[0].text file "c:\python27\lib\userlist.py", line 31, in getitem def getitem(self, i): homecoming self.data[i] indexerror: list index out of range my code : subs = pysrt.open(my_file_location, encoding='iso-8859-1') subs[0].text i think file not opened well. help needed. python python-2.7 encoding subtitle srt

java - Unit testing with Mockito resets a mocked class' instance variable to null -

java - Unit testing with Mockito resets a mocked class' instance variable to null - i have mocked message class follows (within testng unit test class): @beforemethod protected void setup() { message = mock(message.class); } i can assure have declared message of type message in unit test class. now, message class has instance variable called category of type string follows: public class message { private string category; public string getcategory() { homecoming category; } public void setcategory(string category) { this.category = category; } } okay, problem: within little test method, have set category of mocked message instance , utilize category task in unit test. however, after set category mocked message, reverts null again. code: public void shouldsendmessageswithcategory() { message.setcategory("f1 racing"); // set category raceresults.addsubscriber("f1 racing", clienta);

Parsing list of lists for Transition state for DFA in python -

Parsing list of lists for Transition state for DFA in python - class dfa: #q=list of strings, alphabet = list of single char strings, s = start #state, f = list of states(strings) q, delta = list of lists def __init__(self, q, alphabet, s, f, delta): self.states = q self.alphabet = alphabet self.starts = s self.finals = f self.delta = delta self.currentstate = self.starts homecoming def transition_to_nextstate(self,input_value): if ((self.currentstate + input_value) not in self.delta): self.currentstate = none homecoming self.currentstate self.currentstate = self.delta[self.currentstate] homecoming self.currentstate #go start state def isstartstate(self): self.currentstate = self.starts #print(self.starts) #check in final state def isacceptstate(self): if (self.currentstate in self.finals): print("accepted") homecoming true else: print("not accepted&q

c# - How convert ToList method to LINQ expression -

c# - How convert ToList method to LINQ expression - list<string> tolist(string[] names) { list<string> l = new list<string>(); foreach (string n in names) { l.add(n.toupper()); l.add(n.tolower()); } homecoming l; } how convert tolist method linq expression(method syntax). help much appreciated. thanks. names.selectmany(x => new[] { x.tolower(), x.toupper() }).tolist() c# linq

Amazon ec2 ubuntu installing gcc -

Amazon ec2 ubuntu installing gcc - i'm trying install gcc on ec2 instance ubuntu sudo apt-get install gcc gives me: do want continue? [y/n] err http://us-west-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main linux-libc-dev amd64 3.13.0-36.63 404 not found [ip: 91.189.88.149 80] err http://security.ubuntu.com/ubuntu/ trusty-security/main linux-libc-dev amd64 3.13.0-36.63 404 not found [ip: 91.189.92.201 80] e: failed fetch http://security.ubuntu.com/ubuntu/pool/main/l/linux/linux-libc-dev_3.13.0-36.63_amd64.deb 404 not found [ip: 91.189.92.201 80] e: unable fetch archives, maybe run apt-get update or seek --fix-missing? what missing? sudo apt-get update fixed problem. ubuntu gcc amazon-ec2

q - Implementing promise queues with native promises? -

q - Implementing promise queues with native promises? - i refer first-class article "a general theory of reactivity" @kriskowal. in it, gives next implementation of promises queue, using q conventions: function promisequeue() { var ends = promise.defer(); this.put = function (value) { var next = promise.defer(); ends.resolve({ head: value, tail: next.promise }); ends.resolve = next.resolve; }; this.get = function () { var result = ends.promise.get("head"); ends.promise = ends.promise.get("tail"); homecoming result; }; } you'll see it's using q features such defer , get . i'm trying wrap ahead around how adapt utilize native promises, experiencing massive brain freeze. (in process of working on this, came across fact chrome appears provide promise.defer method, afaik not in spec.) can help? oh wow that's cool people r

ios - Open link starting with http but not www -

ios - Open link starting with http but not www - i want open link starting www not open. code working http. please help > newer in ios.i shall highly obliged. - (bool)webview:(uiwebview *)webview shouldstartloadwithrequest:(nsurlrequest *)request navigationtype:(uiwebviewnavigationtype)navigationtype { if (navigationtype == uiwebviewnavigationtypelinkclicked) { nslog("user tapped link."); } if ([request.url.absolutestring rangeofstring:@"iosscrollposition:"].location != nsnotfound) { nsstring *positionstring=[[[request url]absolutestring] stringbyreplacingoccurrencesofstring:@"iosscrollposition:" withstring:@""]; nsarray *positionarray=[nsarray arraywitharray:[positionstring componentsseparatedbystring:@","]]; nsinteger x=[[positionarray objectatindex:0] integervalue]; nsinteger y=[[positionarray objectatindex:1] integervalue]; if (initialyposition != y || y==0) {

javascript - How to calculate interval time when same button clicked twice in java script or jquery -

javascript - How to calculate interval time when same button clicked twice in java script or jquery - there 1 button java script of j query , first time press button, after seconds 1 time again press same button. how calculate interval time between 2 presses of same button. please can help. code tried: code downwards , ip, how can calculate same button preesing var starttime, endtime; $("#bu").on('mousedown', function () { starttime = new date().gettime(); }); $("#bu").on('mouseup', function () { endtime = new date().gettime(); longpress = (endtime - starttime < 500) ? false : true; }); try this class="snippet-code-js lang-js prettyprint-override"> var starttime; $("#bu").on('click', function() { if(starttime) { alert( "time difference: " + (new date().gettime() - starttime) ); starttime = undefined; } else { startti

java - JBoss with HotSwap agent -

java - JBoss with HotSwap agent - has used jboss 7.1 dcevm , hotswap agent in production? tutorial anywhere? possible add together new packages/classes through hotswap agent, or replace existing ones? i'm sorry question vague. i'm simply researching proposed technologies. another point: have deploy exploded .war always, , replace/add .class files within it? or can deploy zipped .war , re-create additional zipped .jars alongside it? my architecture have servlet , additional components need accessible it. these components want add/replace @ runtime. in moment not possible, there open issue jboss back upwards #27: jboss 7 utilize osgi classloading , hence agent core classes not available application classloader (this not case standard classloaders parent delegation). the solution add together -djboss.modules.system.pkgs=org.hotswap.agent older agent versions (similar https://issues.jboss.org/browse/wfly-895). however hotswap agent

java - Removing session attribute in jsp portlet issue in liferay -

java - Removing session attribute in jsp portlet issue in liferay - after passing info portlet through session if want clear sessionattribute @ destination portlet doesn't work. in destination portlet session attribute , clear it, after refreshing jsp page. session attribute still there. should null . how can rid of next code not working. class="lang-jsp prettyprint-override"> <%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %> <%@page import="javax.portlet.portletsession" %> <portlet:defineobjects /> <b>newppipc</b> portlet in view mode. <% portletsession ps = renderrequest.getportletsession(); string qstring = (string)ps.getattribute("sessionvalue",portletsession.application_scope); ps.removeattribute("sessionvalue"); %> <h1><%=qstring %></h1> overloaded method uses portlet_scope search object, need specify scope applic

Get output java complie from cmd -

Get output java complie from cmd - i have project utilize command prompt complie java file,then print result in console,this mycode. public static void main(string[] args) { string line; string output = ""; seek { process p = runtime.getruntime().exec("java helloworld"); bufferedreader input = new bufferedreader(new inputstreamreader(p.getinputstream())); while ((line = input.readline()) != null) { output += (line + '\n'); } input.close(); } grab (exception ex) { ex.printstacktrace(); } system.out.print(output); } but show nothing,although work command,please help me. as 1 of commenters mentioned might result in quite complex setups running into. in case error happens in java , not see output since error messages written stderr stream instead of stdout. so there 2 options (1) take code have , seek read process'

MySQL: Group PlayerUID, Show total kills and latest coordinates of alive character -

MySQL: Group PlayerUID, Show total kills and latest coordinates of alive character - i've been wrestling while , haven't found solution. i have mysql database table contains game character data, next columns: characterid: 1 time player dies, gets new character, adds new entry. playeruid: unique each player. need grouping that. killsz: shows how many kill each character has had. worldspace: position of character. alive: character live or dead? so need sql query returns total kills player , coordinates of current character. how this? this think should be: select characterid, playeruid, sum(killsz), worldspace, live character_data worldspace in (select worldspace character_data live = 1) grouping playeruid order sum(killsz) desc; output: (11 top rows) "characterid" "playeruid" "sum(killsz)" "worldspace" "alive" "924" "76561198042033373" "88" "[128,[8438.99

Magento backend showing blank pages after login? -

Magento backend showing blank pages after login? - i have magento 1.9 version , working fine on local , demo server when move live server admin not working.it login admin , header , navigation bar shows there. tried remove cache, sessions.disabled newly installed extensions.but still same problem.my frontend working fine. please help me solve issues. this error coming due entries in table "adminnotification_inbox" . don't know why happened.i empty table , admin works fine table have entry same problem occurs, after empty table disable admin notification next location:- system->advanced->disable modules output mage_adminnotification this solved problem. magento magento-1.7 magento-1.8

python - How to print formatted string in Python3? -

python - How to print formatted string in Python3? - hey have question concerning print ("so, you're %r old, %r tall , %r heavy.") % ( age, height, weight) the line doesn't work in python 3.4 know how prepare this? you need apply formatting string, not homecoming value of print() function: print("so, you're %r old, %r tall , %r heavy." % ( age, height, weight)) note position of ) closing parentheses. if helps understand difference, assign result of formatting operation variable first: output = "so, you're %r old, %r tall , %r heavy." % (age, height, weight) print(output) python string python-3.x

javascript - Unable to parse selector? -

javascript - Unable to parse selector? - i using scrapy + splash + python in centos. have write next code extracting content here. unable extract info java script popup windows illustration "href="javascript:void(0);" 1 guide me crawl. spider code: def parse(self,response): selector = selector(response) links = [] link in selector.css('div.job_list div.cont > span.style.display:block;vertical-align: bottom;::attr(href)').extract(): yield request(urlparse.urljoin(response.url, link), callback=self.parse_listing_page, #meta={"use_splash": false} ) following error: [testtim@dpitstsvr015 samsungcom]$ scrapy crawl samsung 2014-11-11 18:05:33+0530 [scrapy] info: scrapy 0.24.4 started (bot: samsungcom) 2014-11-11 18:05:33+0530 [scrapy] info: optional features available: ssl, http11 2014-11-11 18:05:33+0530 [scrapy] info: ov

what is best way to prepare C# objects in separate methods -

what is best way to prepare C# objects in separate methods - what improve method utilize object preparation logic: a) homecoming value list<users> users = loadusers(); users = prepareusers(users); b) or void type list<users> users = loadusers(); prepareusers(users) are setting properties on existing user objects or creating new ones? if you're changing existing objects, there's no reason why you'd want homecoming them, it's redundant. worse, it's misleading - client think objects left untouched , you're creating new objects when in fact you're not. if you're creating new ones, then, need homecoming them. c#

postgresql - Rails database migration failing because of Postgres inet type -

postgresql - Rails database migration failing because of Postgres inet type - i have rails(4.1.0) app works fine on heroku. however, on local machine, rake db:migrate fails due table devise uses inet datatype , using sqlite3 testing. i have included postgres gem postgres_ext still coming error: undefined method `inet' #<activerecord::connectionadapters::table:0x00000005fae9e8>/home/app/db/migrate/20141107192501_add_devise_to_users.rb:19:in `block in up' if testing locally using postgres acceptable setup right adapters. sample database.yml : common: &common adapter: postgresql encoding: utf8 template: template0 # required utf8 encoding username: <%= env["postgres_user"] %> password: <%= env["postgres_password"] %> host: <%= env["postgres_host"] %> development: <<: *common database: 'my_app_dev' # warning: database defined "test" erased , # re-generated develo

string value does not match C# with dictionary value -

string value does not match C# with dictionary value - it weird not know, why below 2 string values not match in code : string s="textbox1.text= \"hello 1"\"; public static dictionary<string, string> dictionary = new dictionary<string, string>(); dictionary.add("button", "textbox1.text= \"hello 1"\"); dictionary.add("textbox","textbox1.text= \"hello 1"\"); foreach(keyvaluepair<string,string> pair in dictionary) { if(s==pair.value.tostring()) { // code } } really not know.. reason. here corrections, worked me, see comments numbers string s="textbox1.text= \"hello 1\""; //1 dictionary<string, string> dictionary = //2 new dictionary<string, string>(); dictionary.add("button", "textbox1.text= \"hello 1\"");//3 dictionary.add("textbox","textbox1

nginx - Web API Service Error - Cross-Origin Request Blocked -

nginx - Web API Service Error - Cross-Origin Request Blocked - my windows web api service running on linux (nginx http server) fastcgi mono server. when clients seek invoke web api service's methods, see next error message in response: cross-origin request blocked: same policy disallows reading remote resource @ http://localhost:5757/service.asmx/heartbeat?. can fixed moving resource same domain or enabling cors. my nginx virtual host config file: server { hear 5757; server_name localhost; root /var/www/webservices/myservice; access_log /var/log/nginx/myservice.access.log; location / { index index.html index.htm default.aspx default.aspx; fastcgi_index default.aspx; fastcgi_pass 127.0.0.1:9002; include /etc/nginx/fastcgi_params; } } i confused how overcome problem??? because on localhost tested methods , of them work pretty well. how enable cors , steps should take, if ca

java - How to access non-static variables & methods from a different class -

java - How to access non-static variables & methods from a different class - i'm not quite understanding utilize of "static" properly. i have class includes variables want access different class. however when seek access getter method different class error stating "non-static method getaccnumber() cannot referenced static context." so how find variables value without making static. problem if create static every instance of object overwrites previous ones value. end same business relationship number in case. let me explain in detail... i have class called account, contains variable called accountnumber. getter method called getaccnumber(). have sec class called accountlist seperate arraylist class store instances of account. want create method remove element based upon it's accountnumber. i'm searching , using getaccnumber() within accountlist class compare user parameter , removing if correct! can't utilize method without

ios - What is Aggregate in Xcode, and mainly use to do? -

ios - What is Aggregate in Xcode, and mainly use to do? - my primary questions title. since xcode 6 added dynamic framework, whether means can have 1 target created cocoa touch framework generate framework without library. whether aggregate target means if want generate universal , multiple architectures framework must utilize target? , target primary purpose? that's all. thanks. ios xcode frameworks aggregate

sql server - How to get the result table by parsing column values? -

sql server - How to get the result table by parsing column values? - i have table 1 column (datelist, varchar(4000)) contains list of date-time values strings. looks following: 2014-09-26 19:00 2014-09-27 19:00 2014-09-28 19:00 2014-09-29 19:00 how can result table same structure, datelist column should have values in range: dateitem >= mindate , dateitem <= maxdate it stored procedure. the code i've used: declare @sstring varchar(4000) declare @splitchar char(1) declare @count int declare @datelength int declare @xmlstring xml set @splitchar = ',' set @count = 1 set @datelength = 17 select @sstring = datelist t_action id = 44404 print @sstring while @count <= len(@sstring) / 17 - 1 begin set @sstring = stuff(@sstring, @datelength, 0, ',') set @datelength = 17 + @datelength + 1 set @count = @count + 1 end --use xml extract date. set @xmlstring = convert(xml,'<root><s>' + replace(@sstring,@splitchar

jquery - How can I keep this appended DIV in place after "price" changes? -

jquery - How can I keep this appended DIV in place after "price" changes? - i designing site on custom built cms, developed old job: http://dev544.webdugout.com/view/snow-removal in order me move cost div "productprice" bottom of page, used following: $(".productprice").appendto(".productpricecontainer"); i used next add together text in front end of numeric price: $( ".productprice" ).prepend( '<h2><span>4</span> total cost be</h2>'); everything looks great, though 1 time take option, changes price, div goes it's original position in code , removes text added. way can resolve jquery , without having approach programmer this? thanks! the reason elements moving top because original position in dom when page first loaded. when select item dropdown page performing postback , javascript not called again. seek using code below. should cause javascript called each time p

graphics - Find a particular color in a 2D image -

graphics - Find a particular color in a 2D image - what algorithms observe or find particular color (rgb) in image. detection purposely used marker find position of particular color used. if know color can it: c++ glm::vec3 targetcolor(1.0f,0,0);//(red,blue,green) float accepted_color_distance = 0.1f; /*how much must colors alike? distance 0 means colors must equal, there numeric precission problems. utilize 0.0001f or instead of 0.*/ bool markersfound[image.rows][image.cols]; //true means pixel y,x markers for(unsigned int = 0; < image.rows; a++) //init markersfound false { for(unsigned int b = 0; b < image.cols; b++) { bool markersfound[a][b] = false; } } for(unsigned int = 0; < image.rows; a++) { for(unsigned int b = 0; b < image.rows; b++) { glm::vec3 currentcolor = image.at(a,b); float color_distance = glm::distance(currentcolor, targetcolor); if(color_distance < accepted_color_di

java - Print fibonacci up to user entered number -

java - Print fibonacci up to user entered number - i'm trying print fibonacci series whatever number user types in. problem code ends printing amount of numbers. if user enters 100, want code stop @ 100, code prints 100 numbers. also, i'm supposed have printf , while statement. don't know how utilize printf. package l12; import java.util.scanner; public class l12 { /** * @param args command line arguments */ public static void main(string[] args) { scanner console = new scanner(system.in); system.out.println("enter integer: "); int n = console.nextint(); system.out.println("the fibonacci numbers less " + n + " are: "); for(int i=1; i<=n; i++){ system.out.print(fibonacci(i) +" "); } } public static int fibonacci(int n){ if(n == 1 || n == 2){ homecoming 1; } int f1=1; int f2=1;

JavaScript shipping timer countdown -

JavaScript shipping timer countdown - i have next javascript on site shows amount of time left order placed next day delivery. if (document.getelementbyid('countdowntimer')) { pad = function(n, len) { // leading 0's var s = n.tostring(); homecoming (new array((len - s.length + 1)).join('0')) + s; }; var timerrunning = setinterval( function countdown() { var = new date(); if ((now.getday() >= 1) && (now.getday() <= 5)) { // mon fri var target = 15; // 15:00hrs cut-off point if (now.gethours() < target) { // don't if we're past cut-off point var hrs = (target - 1) - now.gethours(); if (hrs < 0) hrs = 0; var mins = 59 - now.getminutes(); if (mins < 0) mins = 0; var secs = 59 - now.getseconds(); if (secs < 0) secs =

excel - Get part of file name and insert into Cell -

excel - Get part of file name and insert into Cell - i have setup sheet re-create 1 page, , create new workbook info , save new file name. my code saving file - newname = "hotterpgpalletdespatch - ref " & format$(date, "mmddyyyy") _ & "-" & format(cstr(now), "hhmm") & "" activeworkbook.saveas filename:=thisworkbook.path & "\new\" & newname, fileformat _ :=51, createbackup:=false i want take date/time after word ref , insert cell g2. how this? (i don't want current date/time 1 time again may alter need have specific numbers file path. assuming workbook has been saved in appropriate name format, utilize formula in g2. =trim(left(substitute(mid(cell("filename"), find("ref ",cell("filename"))+4, 99), ".", rept(" ", 99)), 99)) excel vba

ios - AFNetworking with cocoapods link error when using Xcode6 -

ios - AFNetworking with cocoapods link error when using Xcode6 - i got error when migrating project xcode5 6. undefined symbols architecture i386: "_objc_class_$_afhttprequestoperationmanager", referenced from: objc-class-ref in qcroomlistcontrollerviewcontroller.o objc-class-ref in libqcbase.a(qchttprequestadapter.o) objc-class-ref in libqcbase.a(qchttpapi.o) "_objc_class_$_afhttpresponseserializer", referenced from: objc-class-ref in qcroomlistcontrollerviewcontroller.o "_objc_class_$_afjsonresponseserializer", referenced from: objc-class-ref in libqcbase.a(qchttpapi.o) ld: symbol(s) not found architecture i386 i take cocoapods bundle manager, , project construction below: both major project , baselib using pods, @ same time project using baselib.a. i've seek combinations xcode5 ios 7.1 sdk(which working one), xcode6 ios 7.1 sdk , xcode6 ios 8.0 sdk. current conclusion whenever xcode6 involved, l

Parsing og: tags with ColdFusion regex -

Parsing og: tags with ColdFusion regex - if 1 wants extract/match open graph (og:) tags html, using regex (and coldfusion 9+), how 1 go doing it? and tricky bit is has cover both possible variations of tag formation in next examples: <meta property="og:type" content="website" /> <meta content="website" property="og:type"/> so far got this: <cfset tags = rematch('(og:)(.*?)>',html_content)> it match both of links, first type has content bit returned it. , content require. just create absolutely clear, desired output should array of og tags (they 'type,image,author,description etc.). means should flexible , not based on og:type illustration alone. of course of study if it's possible, ideal output struct first column beingness name of tag, , sec containing value (content). can achieved post processing , not of import extracting tags themselves. cheers, simon so want array

Integrating django-select2 (autocomplete) and django-dynamic-formset (dynamic formsets) -

Integrating django-select2 (autocomplete) and django-dynamic-formset (dynamic formsets) - my app looks this: forms.py: class subform(forms.modelform): myfield = greatchoices() class meta: model = sub myformset = inlineformset_factory(my, sub, extra=1, form=subform) class greatchoices(automodelselect2field): queryset = great.objects template.html <form id="great" method="post" action="{% url "great-add" %}">{% csrf_token %} {{ form }} <h3>greats</h3> <table>

java - no suitable method found for setListData(Object[]) -

java - no suitable method found for setListData(Object[]) - i have problem code, , i'm getting 1 error , 1 warning when seek compile it. error is: marcoseleccionmultiple.java:43: error: no suitable method found setlistdata(object[]) and warning is: marcoseleccionmultiple.java:13: warning: [serial] serializable class marcoselecc ionmultiple has no definition of serialversionuid i hope can help me. thanks. // pruebaseleccionmultiple.java // pruebe de marcoseleccionmultiple.java import javax.swing.jframe; public class pruebaseleccionmultiple { public static void main( string[] args ) { marcoseleccionmultiple marcoseleccionmultiple = new marcoseleccionmultiple(); marcoseleccionmultiple.setdefaultcloseoperation( jframe.exit_on_close ); marcoseleccionmultiple.setsize( 350, 140 ); // establece el tamaƱo del marco marcoseleccionmultiple.setvisible( true ); // muestra el marco } // fin de main } //

cocoa - Self-built Automator action does not work when used in Automator service or App -

cocoa - Self-built Automator action does not work when used in Automator service or App - i wrote cocoa automator action uses pod podiokit. works fine when used in automator workflow, method - (id)runwithinput:(id)input fromaction:(amaction *)anaction error:(nsdictionary **)errorinfo called , steps work. the problem occurs when seek build automator service or automator app using same action. method - (id)runwithinput:(id)input fromaction:(amaction *)anaction error:(nsdictionary **)errorinfo called, can read results nslog() calls. calls of podiokit methods ignored, weren't there. automator seems jump on calls :-/ maybe ran similar problems , found checkbox, build setting or allow automator services take care external apis/pods. or maybe tipp/ question right direction... cocoa cocoapods automator podio

html - Fill whole space of - with including a floating -

html - Fill whole space of <li> with <a> including a floating <span> - my problem: i reddish questionmark in 2nd "a" expand parent li's height. can see positioned in 3rd anchor's line usually add together display:block "a" , "a" expands across whole li, floating span makes problems. while works if span has plenty space in same line text of anchor text not expand li if span lone in new line. as anchor text not limited in length, cannot set height property li or a, can set span, not solve problem. tried alter span div, did not find solution. here jsfiddle. html: <div> <ul> <li> <a href="#">text <span> ok </span></a> </li> <li> <a href="#">long long long long text <span class="woot"> ?</span></a> </li> <li> <a href="#">short text <