Posts

Showing posts from April, 2011

Appcelerator Studio 4.5 running error in ubuntu 64 -

i'm trying run appceleratorstudio executable file appcelerator_studio downloaded folder, show 2 error sudo and without sudo . i'm using ubuntu 15.05 x64. sudo ./appceleratorstudio error: "ooops! cannot run using sudo. please re-run using nan account." ./appceleratorstudio error: "an error has occurred. see log file null." screenshot (build 4.5.0.1446607552) [error] ooops! cannot run using sudo. please re-run using nan account. org.eclipse.core.runtime.coreexception: ooops! cannot run using sudo. please re-run using nan account. @ com.appcelerator.titanium.rcp.handlers.titaniumsplashhandler$6.run(titaniumsplashhandler.java:455)

sql - How to insert date in a table column with a trigger. (ORACLE) -

essentially wish create trigger keeps track , edits date_created column of specific row after every insert or update. these columns in table: | customer_id | store_id | quantity | date_created | the customer_id , store_id primary key of table what have far: create or replace trigger date_trig before insert on customer_table each row declare begin -- assume date set or edited end; i brand new pl/sql struggling actual body of trigger. also, have structure of trigger correctly formed? use default sysdate on colum date_created suggested if insist use trigger, write :new.date_created := sysdate;

osx - Oh My ZSH & Vim Insert Cursor -

currently using oh zsh, however, when using vim in insert mode, @ end of line, when using arrows navigate, insert mode ends when hit end of line, making impossible delete last character on line, following theme file, can me out this? https://github.com/andrew8088/oh-my-zsh/blob/master/themes/doubleend.zsh-theme thanks! afaik it's not recommended move around in insert mode @ all. if want delete last character on line, hit $x in normal mode. delete last character on line , go insert mode, use $s . in cases should move faster in normal mode usign w , e , ^ , like, using arrows in insert mode. why use vim if use notepad application? hope helps

CSS Selectors - change width if last image id is X -

i try several hours figure out how change width of class if there image id before element. currently code looks that <blockquote> <img id="bp_avatar" src="..."> <p>text</p> </blockquote the problem image been dynamicly inserted, in cases there in other wont. tried wrap image inside text, fit blockquote p needs width of 90%. so here issue, should 90% if it's there , 100% if not there. use css instead of jquery, found on w3 documents level 4 selectors , tried use them, goal apply style if #bp_avatar there. so tried ways #bp_avatar ~ #bluepostq blockquote p { width: 90%!important; } #bluepostq blockquote p! > #bp_avatar{ width: 90%!important; } none of them worked yust nothing happens, think missunderstood , hope tell me have done wrong. using ~ correct, need use bit differently: p { width: 100%; } #bp_avatar ~ p { width: 90%; } this make p 100% width if preceded #bp_avatar 90%. if at...

arm - GIC v2 Virtualization Supported System -

i'm trying implement kind of interrupt routine. it's related virtualization gic v2 h/w support. my question : when catch interrupt number, hypervisor should distingush if it's own or guests ran on hypervisor. how check it? if it's hyp or guest? it's question. please let me know if correct or not. need more backgrounds. thank replay before. the simplest way fiq interrupt assigned secure world , irq normal world. there trustzone register ( scr or secure configuration registers) route irq/fiq monitor or straight os in current world . gic allows interrupt either fiq or irq (i think documentation calls type 0 , type 1 ). can route monitor or can dynamically switch (on world switch) interrupt routed. world | normal | secure ------+--------+-------- fiq | monitor| through irq | through| monitor the monitor trap require saving lot of registers (a world switch save registers). can trust secure interrupt handler somewhat, bets shou...

javascript - Is it possible to pass the result of a promise as an argument to IIFE -

i have been refactoring old code uses iife fetch , initiate set of values. var exampleinitiate = (function exampleinitiate(){ ..call backend service })(); now, per new requirement, have call same iife argument, , argument result of promise invoked later. understand iife invoked, , if result of promise, able call iife again? understands iifes run once only. i thinking best not use iife here not fit here in case. correct, or there indeed way call iife passing argument value promise? you can have couple of options if understand correct. first can pass argument iife this: var mypromise = getpromise(); var exampleinitiate = (function exampleinitiate(promise){ promise.then(function() { ... }); ..call backend service })(mypromise); but wouldn't call way clear. suggest erase iife , use promises do: getsomebackendresponse().then(function (data) { ... }) edit: if iife returns promise yes, think can't pass in result of function again, since iife invoked o...

java - Interactive Graph for android applicaiton -

Image
how create graph similar miband ui, i'm new android ui development. slide/scroll graph horizontally , values bound in x-axis must move along. thing i'm looking forward highlight bar when pointed value pointer on x-axis.

javascript - How to retrieve multiple property values from JSON string -

i have json string: x = '{"userid":"foo","traits":{"email":"foo@foobar.com"},"type":"identify"}' that want values from. tried regex: so far have anonid = x.match(/\"anonymous_id\"\:(.*?)/)?[1] email = x.match(/\"email\"\:\"(.*?)\"/)?[1] userid = x.match(/\"userid\"\:\"(.*?)\"/)?[1] type = x.match(/\"type\"\:\"(.*?)\"/)?[1] which ugly , inefficient, when attempt combine them: [_, a, b, c, d] = x.match(/\"anonymous_id\"\:(.*?)|\"userid\"\:(.*?)|\"email\"\:(.*?)|\"type\"\:(.*?)/g) the results returned entire group, instead of matched parts. i want a,b,c,d equal value of keys, instead get: wanted: **>> ["foo","foo@foobar.com","identify"]** actual results: >> ["userid":"foo","email":"foo@foobar.com",...

Listview doesn't appear in fragment -

i'm trying show listview in table. had lot of different problems now, there no error message anymore, don't know do. the listview not shown. please me, i'm beginner , first listview. maybe wrong. watched tutorial how add static things fragment , i,m trying adapt listview. thank much. here code listview fragment: import android.app.listfragment; import android.os.bundle; import android.support.annotation.nullable; import android.support.v4.app.fragment; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.adapterview; import android.widget.arrayadapter; import android.widget.listadapter; import android.widget.listview; import android.widget.toast; import android.support.v4.app.fragment; public class fragment3 extends android.support.v4.app.listfragment implements adapterview.onitemclicklistener { listview lview; view v; string[] values = {"test","test2","test3"}; @nullab...

c++ - Deriving from templatized base class -

i've buil small database of different kinds type of objects. idea have base templatized class, let's call database , let derive other classes that. for example: template< typename record, size_t record_size, char record_sep = '!', char record_param_sep = ',', char record_field_sep = '~', size_t max_records_per_query = 5000, size_t min_record_count = 15000 > class database { public: typedef record record_t; typedef std::vector< unsigned char > querybuffer; database( const std::string& basepath, const std::string& recordpath, const std::string tablefilename ); enum class queryresult { ok, no_data, overflow, future_date, future_range, error }; void add( void add( const record_t& r ) { lock lock( mmutex ); // ... lots of stuff here } queryresult query(q...

css3 - Responsive CSS nav behaving strangely -

i've been working on responsive theme wordpress site time now. using media queries determine screen size , adjust layout accordingly. problem i'm facing right in header. working expected until screen between 638 pixels wide , 1023 pixels wide... that's when nav unexpectedly pops on side of screen (it's supposed centered). strange thing not have media query 638-1023. below essential code can see of on website ( digitalbrent.com ). if tell me why happening (and i've tried on multiple devices, know it's not screen) i'd appreciate it. i'm not quite sure causing nav pop on need fix it. css: /******************************** medium screen styles */ @media screen , (min-width: 481px) , (max-width: 1023px){ #titlebox { margin-top: 38px; width: 45%; margin-left: 5%; } #sitetitle { margin-top: 4px; font-size: 28px; width: 130px; } #tagline{ color:#ffffff; font-family: g...

html - DropDown menu has repeat issue on dropdown -

http://jsfiddle.net/just1end/btlxs/ if @ link above see drop down weird. first item of every drop down highlighted image.... , when hover on items (in dropdown) given image. can me figure out how can make dropdown peice remains red color , changes lighter red on hover. dont want image appear on first item. weird. first attempt @ drop down menu , help. thanks code: <html> <head> <script src='http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js'> </script> <style> #cssmenu ul { list-style-type: none; position: relative; display: block; font-size: 12px; background: url(http://minecraft-serverlist.org/e-scape/bg.png) repeat-x top left; font-family: verdana, helvetica, arial, sans-serif; border: 1px solid #000; margin: 0; padding: 0; width: auto; } #cssmenu li { display: inline-block; margin: 0; padding: 0; } #cssmenu li ul { position: absolute; display: none; } #cssmenu li ul li { ...

Queue of tasks for parallel computing in R -

the outline of want follows: #function run 6k times, doesn't return somefunction <- function(integer,string) {...} #parameters passed params <- data.frame(ints=1:6000, strings=...) #number of cores system has numcores <- detectcores() count <- 1; #run while there still tasks run , there free core while(count <= 6000 && <# of running tasks < numcores>) { count <- count + 1; <assign somefunction(params$ints[count],params$strings[count]) free core> } the 2 pieces of code in <> brackets not sure how proceed. on ubuntu system, can use multicore package. i suspect may need integer keep track of how many cores being used , when process finishes, subtracts 1 integer , new process adds one, or maybe array of length numcores keep 0 or 1 if it's being used or not. you should use either multicore or snow packages. snow, can accomplish after pretty simply: clust<-makecluster(detectcores()) clusterexport(clust,...

html - Setting Table Headers and populating Data; Rails and SLIM -

i very, new rails , slim. i trying create summary table using h2 trading history table.table-striped.table-bordered#analysis thead tbody - @stock_summary[:stocks].each |key2, value| - value.each |key2, value2| tr th = key2 td = value2 unfortunately, output forcing data 2 columns so: name lennar corporatio revenue -7320.0 tax_liability -0.55 capital_at_risk 0.0 returns -1.28 average_holding_period 2.0 capital_invested_percentage 0.0 name general electric revenue 2688.89 tax_liability 0.17 capital_at_risk 0.0 returns 2.05 average_holding_period 2.7777777777777777 capital_invested_percentage 0.0 i summary table use info (name, revenue, tax_liability, capital_at_risk, returns, average_holding_period, capital_invested_p...

.net - Sorting selected elements (autocad) -

please me out here. i'm trying change order of selection (which exists out of elements: lines, polylines , arcs). elements of selection attached 1 another. code needs create new list in elements sorted ending entity other ending entity. my code: public sub reorder() dim document document = autodesk.autocad.applicationservices.application.documentmanager.mdiactivedocument dim ed editor = document.editor dim db database = document.database dim fillist typedvalue() = new typedvalue(0) {new typedvalue(cint(dxfcode.start), "lwpolyline,arc,line")} dim filter new selectionfilter(fillist) dim opts new promptselectionoptions() try opts.messageforadding = ("select items: ") dim res promptselectionresult = ed.getselection(opts, filter) if res.status <> promptstatus.ok exit sub end if dim selset selectionset = res.value dim idarray objectid() = selset.getobjectids() ...

sql - How to use two statements in a trigger -

i'm writing trigger on sql server 2012 table. trigger working correctly except when add statement send email after updating table trigger else statement highlighted error incorrect syntax near else i might have syntax error can't point out. i've tried add ";" @ end of line 10 , 11 it's not doing trick. commenting line 11 make whole trigger work correctly what best method have 2 statement/action after if ? 1 create trigger dbo.membersnametocategories on dbo.members 2 after update 3 4 5 begin 6 declare @oldname nvarchar(150) = (select name deleted) 7 declare @newname nvarchar(150) = (select name inserted) 8 declare @bodytxt nvarchar(max) = 'customer: ' + @oldname + ' has been modified new name : ' +@newname + '.' 9 if exists (select null categories c c.name = @oldname) 10 update categories set name = @newname name = @oldname , categorytype = 7 11 exec msdb.dbo.sp_send_dbmail @profile_name = 'mypr...

jquery - AngularJS link not working, but manual page refresh works fine -

i'm working on site in angularjs. i'm having issue when click on nav links ( tag href), url changing, page content not getting updated. if click on 'about' link, url gets modified #/about, not content. however, if manually refresh page now, content loads. see site at: www.arunmahendrakar.com/nsm/ the links 'outside' angular , i'm not sure need add $apply function, if @ all. the nsm.controller.js has routing , controller details, nsm.services.js has service gets data server , nsm.directives.js used highlight current link. the index.html page uses bootstrap 3.0. please let me know how can fix issue. there's flicker on page when navigate, angular noticing change , trying update page. the problem looks directives.js adds listener on $location.path() scope.$watch('location.path()', function (newpath) {...}); according discussion here , want use $scope.$watch(function() {return location.path()}, function(path) {...}); p...

ruby - In-Memory Sqlite DB in Rails with Rspec -

i have rails 4 application i'm attempting test in rspec using in-memory sqlite database. when run rake tells me have 66 pending migrations. run `rake db:migrate` update database try again. spec_helper.rb env["rails_env"] ||= 'test' require file.expand_path("../../config/environment", __file__) require 'rspec/rails' require 'capybara/rails' require 'capybara/rspec' require 'rspec/autorun' require 'capybara/poltergeist' require 'faker' require 'rake' load_schema = lambda { load "#{rails.root.to_s}/db/schema.rb" } load_schema[] ... why getting error? why need run migrations when i'm loading schema file? correct way test using sqlite in-memory db? update when running rake -t appears rake attempting run migrations ** invoke default (first_time) ** invoke spec (first_time) ** invoke test:prepare (first_time) ** invoke db:test:prepare (first_time) ** invoke db:load_...

compiler construction - dynamically allocating a c++ object without using the new operator -

(c++/win32) consider following call: object obj = new object(a,b); other allocating virtual memory needed instance of object , else going on under hood there? compiler places explicit call constructor of object ? is there way initialize c++ object dynamically without use of keyword new ? if want initialize object in given memory zone, consider placement new (see this ) btw, ordinary object* n = new object(123) expression equivalent (see operator ::new ) void* p = malloc(sizeof(object)); if (!p) throw std::bad_alloc; object* n = new (p) object(123); // placement new @ p, // invokes constructor but implementation use non- malloc compatible allocator, don't mix new , free !

c++ - check variadic templates parameters for uniqueness -

i want variadic template parameters must unique. know when multi inheritance, identical classes inheritance not allowed. struct a{}; struct b: a, a{}; // error using rule, made little code. #include <type_traits> template< class t> struct id{}; template< class ...t> struct base_all : id<t> ... {}; template< class ... t> struct is_unique { template< class ... u> static constexpr bool test( base_all<u...> * ) noexcept { return true; } template< class ... u> static constexpr bool test( ... ) noexcept { return false;} static constexpr bool value = test<t...>(0); }; int main() { constexpr bool b = is_unique<int, float, double>::value; // false -- why? constexpr bool c = is_unique< int, char, int>::value; // false static_assert( b == true && c == false , "!");// failed. } but program not worked expected. what's wrong? //update: //thanks, fix error: // // #in...

javascript - Using UI-Router to make views change separately -

it's possible set ui-router change 1 view without changing other? for example: when navigating on app, actions pointed 1 view : view a . however, user can click on 1 link pointed other view in application: view b . need change view b letting view a on same state user choosed before clicking on link changes view b . someone please can me one? edit: here's plunkr close behavior: http://plnkr.co/edit/wjxx9r the documentation shows how have state configuration target specific views on page. loading content views independently of state navigation not part of api, in upcoming version.

php - Loop all Magento Cookies & Delete -

i have magento site location ip plugin. uses cookies heavily. because of this, need clear cookies magento sets. have believe correct code it's not working: $cookies = mage::getmodel('core/cookie')->get(); foreach($cookies $cookie) { mage::getmodel('core/cookie')->delete($cookie->name, $cookie->path); } some cookies set on path '/' , on /another'. clear avoid confusion. any ideas on how can this? thanks! you getting error because $cookie->name , $cookie->path not objects. loop work try this. $names = mage::getmodel('core/cookie')->get(); //this returns array of cookies foreach($names $name) { //loop through array $cookie = mage::getmodel('core/cookie')->get($name); //get cookie object each cookie $path = $cookie->getpath(); //get path cookie mage::getmodel('core/cookie')->delete($name, $path); //delete cookie }

objective c - UIActivityViewController doesn't show FB and Twitter on iOS 7 -

i trying share items using uiactivityviewcontroller. on ios 6 works fine. when test on ios 7 mail icon shows up. in doubt sdk old downloaded recent one, it's still behaves same. tested on both simulator , device facebook installed on it, no luck. now running out of ideas wrong. here code - (void)sharebuttonwastapped:(bmpopupmenuview *)popupmenu { nsstring *sharetext; if (_correctpatternfound) { sharetext = @"yey, solved puzzle!"; } else { sharetext = @"i solving photzle..."; } nsurl *shareurl = [nsurl urlwithstring:@"http://somewebsite.com"]; nsarray *items = [nsarray arraywithobjects: sharetext, _shareimage, shareurl, nil]; uiactivityviewcontroller *activityviewcontroller = [[uiactivityviewcontroller alloc] initwithactivityitems:items applicationactivities:nil]; [activityviewcontroller setvalue:sharetext forkey:@"subject"]; activityviewcontroller.excludeda...

.net - In C# why is it faster to Create a HashSet from a List, instead of starting with a HashSet? -

i have method takes upper limit, , returns list of primes numbers limit. public static list<int> allprimesunder(int upperlimit) i later decided needed lookups on list, asking question "is prime". since dealing primes under values million, realized hashset structure should using. lookup using result of method faster, method self slower . i believe reason it's slower because hashset checks duplicates before adding, while list shoves on end. surprised me, , spawned question , title, why starting list , using create hashset, so: hashset = new hashset<int>(prime.allprimesunder(1000000)); is faster using hashset internal method, enabling call this: hashset = prime.allprimesunder_hash(1000000); if slowdown in duplicate checking, should have same amount of checking no matter what, right? understanding failing me. here times i'm getting primes under 1 million. 0.1136s pure hash 0.0975s pure list ( expected faster ) 0.0998s pure ...

unit testing - Does TDD include integration tests? -

Image
i'm working on code includes database access. test-driven development include integration tests usual unit tests? thanks! golden rule of tdd says: never write new functionality without failing test. if not following rule, doing tdd partially (like writing unit tests several classes in application). that's better nothing (at least know these classes required, cannot sure other parts of application working , these classes can integrated them), not guarantees application works expected. so, need start each feature writing failing acceptance test, guides application design , defines application behavior (outer loop). while test failing, feature not implemented application. should write unit tests separate units involved feature (inner loop). outer loop verifies classes involved feature working expected. inner loop verifies each class works expected on own. following picture great book growing object-oriented software, guided tests demonstrates these 2 feedback ...

class - Does Java keep classes in the memory or just objects? -

i'm assuming answer obvious, new coding , cannot find clear answer. here why ask: have "fastball" class in baseball game, has 10 unique sets of data (10 difficulty levels) pitched fastball, , 1 blank set of data. when object constructed class, sets blank set of data 1 of 10 data sets based on difficulty. note, there 1 "fastball" object @ 1 time. i worried 10 of data sets in class remain in java's memory, though 1 being used. legitimate concern? or object thing kept in memory? java load class , put permanent generation part of jvm's memory, happen every class ever use in code. part called permanent generation. not need ever worry part, unless using application containers hot deployment. the objects create kept on different part of memory(actually, different generation), called heap, divided again in different generations. jvm sort objects in way jvm thinks good, , job @ it. objects sorted in generation of short lived objects clean...

android - Boolean and sharedpreference -

hey trying make own app, have searched web info , didn't understand solutions other people found helpfull. have little problem. want app save boolean value stopvalue, when close app, when try this, doesn't save value when close app, instead set value true. how fix this? thanks help. public class main extends activity{ button bstart, bstop; textview tvdate, tvkm; spinner spinner1; boolean stopvalue; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); bstart = (button) findviewbyid(r.id.bstart); tvdate = (textview) findviewbyid(r.id.tvdate); tvkm = (textview) findviewbyid(r.id.tvkm); spinner1 = (spinner) findviewbyid(r.id.spinner1); boolean stopvalue = false; sharedpreferences sp = getapplicationcontext().getsharedpreferences("stopvalue", 1); stopvalue = sp.getboolean("stop", false); stopvalue = getintent().getbooleanextra("...

c# - Date Format in Day, Month Day, Year -

i using c#. i know can use tolongdatestring() to show like: friday, february 27, 2009 what instead show like: february 27, 2009 i looked around did not find use display in such format. read this: http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx try use: thisdate1.tostring("mmmm dd, yyyy");

node.js - Find records where modulo is greater than some number -

in mongodb can find records field%x=y : db.collection.find({ field: { $mod: [x, y] } }) i need $mod greater y. i've tried this: db.collection.find({ field: { $mod: [x, { $gt: y }] } }) but no effects. how can find records? ideas? regards, mateusz from v2.4 mongodb changed javascript engine v8, promissing better performance , concurrency. http://docs.mongodb.org/manual/release-notes/2.4-javascript/ i think $where operator quite appropriate unless "x" fixed in app. static "x" might worth having precomputed field {field % x}

android - Multiple font to single textview depending on langugage -

so @ moment have textviews english text , arabic text , doing applying font depending language in textview , there times when have both english , arabic in single text , how possible me apply arabic , english font on same textview? possible merge 2 fonts in 1 font type , , apply every where, work? found this: string firststring = "aaaaaa: "; string secondstring = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"; spannablestringbuilder sb = new spannablestringbuilder(firststring + secondstring); sb.setspan(new stylespan(android.graphics.typeface.bold), 0, firststring.length(), spannable.span_inclusive_inclusive); sb.setspan(new foregroundcolorspan(color.rgb(255, 0, 0)), firststring.length() + 1, firststring.length() + secondstring.length(), spannable.span_inclusive_inclusive); textview.settext(sb); might work

jpanel - Java tabbed pane not showing programs -

i'm inexperienced java , have searched around quite bit resolve issue. believe have code correct tabs not showing anything. came across changing layout borderlayout didn't work me. when run program can see quick glimpse of first tab program it's blank. posted tabbedprograms class because believe problem lies in here can post rest if needed. thank in advance help. import java.awt.borderlayout; import javax.swing.jframe; import javax.swing.jtabbedpane; public class tabbedprograms extends jframe { public tabbedprograms() { settitle("week 4 lab assignment"); setlayout(new borderlayout()); //this added change default layout jtabbedpane jtp = new jtabbedpane(); getcontentpane().add(jtp); jtp.addtab("day gui", new daygui()); jtp.addtab("office area calculator", new officeareacalculator()); getcontentpane().add(jtp); setsize(310, 210); setvisible(true); } public static void main(string[] args) { ...

javascript - Find height of element containing text -

i have box fixed width (800px) filled contents nicedit. i need know height of contents put inside box, if count number of rows not work long texts or images or different font sizes... i need find height set box height not show scrollbars , not higher content. <div style="width: 800px; overflow: hidden"><?= $contentbyuser; ?></div> this "page" shown iframe code like: <iframe style="width: 800px;height:???px;" src="page.php"></iframe> how can find height set iframe javascript and/or jquery? you can create dummy element, insert html it, , check height. //create dummy var $dummy = $('<div />').css({ position : 'absolute', left : -9999, width : 800 }).html(randomtextandimages); //add dummy dom $("body").append($dummy); //get height of dummy var theheight = $dummy.height(); //at point can remove dummy dom $dummy.remove(); //set height of iframe $("iframe...

php - sending form select option values to database not working -

im working on form posts select option value database. have done code dreamweaver server behaviors still not work. here html , php code. any appreciated <form method="post" action="<?php echo $editformaction; ?>" name="applynow"> <table width="550" border="0"> <tr><h4>name *</h4> <td width="264"><input name="fname" type="text" size="30" maxlength="35" placeholder="first name"/></td> <td width="276"><input name="lname" type="text" size="30" maxlength="35" placeholder="last name"/></td> </tr> </table> <p> <label> <input type="radio" name="gender" value="male" id="male" /> male</label> <br /> <label> <input type=...