Posts

Showing posts from May, 2010

actionscript 3 - dispatch mouse out event when the mouse not out -

i created tooltip class. when mouse on over movieclip enable , when out disable. movieclip containt other movieclips. code that: to.addeventlistener(mouseevent.mouse_over, showtip); to.addeventlistener(mouseevent.mouse_out, hidetip); to.addeventlistener(mouseevent.mouse_move, movetip); and functions that: private function showtip(evt: mouseevent) { if (tip != null && !tip.visible) { tip.x = evt.stagex; tip.y = evt.stagey; tip.visible = true; } } private function hidetip(evt: mouseevent) { if (tip != null && tip.visible) { tip.visible = false; } } private function movetip(evt: mouseevent) { if (tip != null && tip.visible) { tip.x = evt.stagex; tip.y = evt.stagey; } } its work hidetip function , showtip function enable in same time , tip flashing. apparently tooltip obscures underlying to movieclip, ma

Python : Pygame.mixer.Sound() slows down the game -

i'm working on breakout game project in when load .ogg file there's problem fps guess , slows down paddle's , ball's speed. if change clock.tick more 120 problem remains same. ideas why , how fix it? pygame.mixer.pre_init(18432, -16, 2, 4096) pygame.init() if state == state_playing : sound = pygame.mixer.sound('intro.ogg').play(-1)

How to rewrite this php slugify function to mysql? -

i found slugify function on here: php function make slug (url string) and tried rewrite mysql, i've done is: borrowed regex_replace function from: https://techras.wordpress.com/2011/06/02/regex-replace-for-mysql/ and transliterate function from: http://igstan.ro/posts/2009-02-13-mysql-transliteration-function.html rewrote mentioned @ top correct answer function symfony fw last bit of mysql create function, function. , @ output i'm getting lowered text, no dashes , letters seem transliterated well, thing left dashes. my query: update `ad_kategorija` set `slug_lt`=slugify(`kat_pavlt`), `slug_ru`=slugify(`kat_pavru`), `slug_en`=slugify(`kat_paven`) functions: # regex replace function delimiter $$ create definer=`root`@`localhost` function `regex_replace`(pattern varchar(1000),replacement varchar(1000),original varchar(1000)) returns varchar(1000) charset utf8 deterministic begin declare temp varchar(1000);

Python iterative loop -

i'm trying iterate through search list, i've written in c want re-write more pythonic. i've been trying enumerate can't seem work, searching lines of data key-words saved in array called strings, can show me or explain correct python syntax please. thanks for line in f: jd = json.loads(line) n=0 while n<=(len(strings)-1): if findwholeword(strings[n])(line) != none: print (jd['user_id'], jd['text']) break n=n+1 there seems no need use enumerate here. iterate on strings directly: for s in strings: if findwholeword(s)(line) != none: print (jd['user_id'], jd['text']) break if need index variable n , use enumerate : for n, s in enumerate(strings): if findwholeword(s)(line) != none: # n here? print (jd['user_id'], jd['text']) break but since break after first match anyway, use any builtin: if a

Whether to use exceptions in C++ for Socket library? -

i plan build portable socket library c++ programming language. known, errors occurs in network programming. of them recoverable, while others not. plan use exceptions in c++ trace exception, logging operations , inform end-users. using exceptions extremely difficult, , using classic techniques error codes lead code hard read (lots of if statements). what's preference? by way, there light-weighted socket library (education-purposed welcomed, , ace hard understand)? the downside of using return codes people forget error handling. cannot happen exceptions. however, if write return code class asserts in destructor unless return value read or explicitly ignored can portability , performance of return values without disadvantage of poor error handling. still have manually forward error codes if caller needs handle exception.

javascript - d3 Choropleth map with different dates and times -

i created own germany.json administrative regions. as data germany.json, created simple table 2 columns: (name of administrative region)(rate of administrative region) my map works great, job isn't done that. i have detailed tables 4 columns (date, time, administrative region , rate). so choropleth map can created if choose date first, time. after choosing date , time, map given input shows up. the problem here, i'm beginner in javascript. have ideas in mind, can't move ideas code. that's why ask here , ideas. is i'm asking possible? http://www.vincentbroute.fr/mapael/usecases/world/ the map @ above link interesting choropleth map have found far has in common map want make. thanks reading far. here code: <!doctype html> <meta charset="utf-8"> <style> .properties { fill: none; } //hier werden die farben für verschiedene kategorien zugeteilt .q0-9 { fill:rgb(247,251,255); } .q1-9 { fill:rgb(2

android - Error:Failed to resolve: :estimote-sdk-preview: <a href="openFile">Open File</a> in estimote iBeacon Sdk -

steps have done following this follows:- 1.create libs directory inside project , copy there estimote-sdk-preview.aar. 2.in build.gradle add flatdir entry repositories repositories { mavencentral() flatdir { dirs 'libs' } } 3.add dependency estimote sdk. all needed permissions ( bluetooth, bluetooth_admin , internet ) , services merged sdk's androidmanifest.xml application's androidmanifest.xml. dependencies { compile(name:'estimote-sdk-preview', ext:'aar') } ater doing this...i following error: error:(31, 0) project path ':estimote-sdk-preview' not found in project ':app'. how can solve it can double check if downloaded aar file correctly. open zip archive , there should contents. it might similar problem described here downloaded html file instead of aar file.

windows - CopyFiles not working in INF files -

i've created xxx.inf file , placed sample.exe alongside same directory. [version] signature=$chicago$ [destinationdirs] samplecopy = c:\\sample [defaultinstall] copyfiles = samplecopy [samplecopy] sample.exe i tried install inf file, desktop refreshes don't see creation of c:\sample folder nor files should copied there is there wrong? destination directories need given in format "dirid,subdir", dirid number . in case use 1 of 2 lines below. samplecopy = 24,\sample samplecopy = -1,c:\sample

cq5 - How to get url of all child,grand child pages using root path? -

i have path of root page , want retrieve child pages of root page , grandchild , grand grand child of root page. structure this rootpage | | |---------childpage | | |---------grandchildpage | | | |----------------------grandgrandchildpages so want path of these pages. how can this? i'm using this adminsession = repository.loginadministrative( repository.getdefaultworkspace()); resourceresolver resourceresolver = request.getresourceresolver(); pagemanager pagemanager = resourceresolver.adaptto(pagemanager.class); list<string>pagelist = new arraylist(); page rootpage = pagemanager.getpage("/content/abc/roi"); iterator<page> rootpageiterator = ro

c++ - Nested interface inheritance implementation -

i encounter scenario of nested interface declarations , implementation, , looking better solution. 2 possible solutions can think of either have wrapper objects in implementation, or using diamond inheritance. not satisfy wrapper objects if have on ten methods in each interface there lot of wrapper methods in each level of implementation class. diamond inheritance implementation more concise told avoid using diamond inheritance whenever possible. can suggest alternative better solution 2 in question? the wrapper object implementation is class ia { public: virtual void ma() = 0; }; class ib : public ia { public: virtual void mb() = 0; }; class ic : public ib { public: virtual void mc() = 0; }; class id : public ic { public: virtual void md() = 0; }; // ------------------------ class impla : public ia { public: void ma() { /* */ } }; class implb : public ib { public: void ma() { a.ma(); } void mb() { /* b */ } private: impla a; }; class impl

jquery - Submit to 2 different PHP forms using Ajax -

i facing issues when want send 2 forms different values using 2 different php pages. my ajax code this: $(document).ready(function() { var form = $('#main_form_new'); var submit = $('.sbbtn'); var alert = $('.form_result'); form.on('submit', function(e) { e.preventdefault(); $.ajax({ url: 'ajax/category.php', type: 'post', datatype: 'html', data: form.serialize(), beforesend: function() { alert.fadeout(); submit.html('saving changes....'); }, success: function(data) { alert.html(data).fadein(); form.trigger('reset'); // reset form submit.html('save changes'); }, error: function(e) { console.log(e)

How can I extract a value from this simple JSON string in Excel VBA? -

i have simple json string in vba : { price_a: "0.172", price_b: "0.8", price_c: "1.3515" } i extract value of price_a 0.172 . how can done in excel vba? using microsoft office 2013. i don't need extensive json library. simple function extract value of price_a . a regexp gives more control on parsing rather relying on character length. as example: sub test_function() dim strin string strin = "{" & _ "price_a: " & chr(34) & "0.182" & chr(34) & "," & _ "price_b: " & chr(34) & "0.8" & chr(34) & "," & _ "price_c: " & chr(34) & "1.3515" & chr(34) & "}" msgbox get_value(strin) end sub extract first set of numbers in "" after price a . can adapted check price b public function get_value(strin string) string dim objregexp object dim

java - Overwriting spring-boot autoconfiguration -

i'm little bit confused behaviour of spring-boot when overwriting specific autoconfigurations. i partly overwrite batchautoconfiguration, guess, question not specific batchautoconfiguration. actually, want "overwrite" 2 methods of class: public batchdatabaseinitializer batchdatabaseinitializer() , public exitcodegenerator jobexecutionexitcodegenerator() . therefore, i've written following code: package ch.test.autoconfig.autoconfigure; import org.springframework.batch.core.launch.joblauncher; import org.springframework.boot.exitcodegenerator; import org.springframework.boot.autoconfigure.autoconfigureafter; import org.springframework.boot.autoconfigure.autoconfigurebefore; import org.springframework.boot.autoconfigure.batch.batchautoconfiguration; import org.springframework.boot.autoconfigure.batch.batchdatabaseinitializer; import org.springframework.boot.autoconfigure.batch.batchproperties; import org.springframework.boot.autoconfigure.batch.jobexecuti

error logging - Sentry - JavaScript Projects and Source Maps -

i have questions sentry handling of minified javascript code. projects have around ~3 mb of regular javascript, in production reduced 200 - 400kb. how work if sentry implemented plus javascript sourcemaps. if error appears, client load sourcemap (400 kb + unminified version 3 mb) , process find correct line ? bad, since lot of projects target mobile devices. or sentry server access sourcemap server , parse correct error? thanks knowledge. the sentry server process sourcemaps remotely part of pipeline. looks them based on standard headers or annotations when fetches source itself, , fetch them automatically. in case of files being unavailable publicly, there api send files sentry server using "releases".

ios - Upload Image/Video from Photos to Instagram using iPhone Hooks -

i want upload image , video instagram using iphone hooks unable achieve result. for video, use following code : alassetslibrary *library = [[alassetslibrary alloc] init]; [library writevideoatpathtosavedphotosalbum:videofilepath completionblock:^(nsurl *asseturl, nserror *error) { nsstring *cfurl = (nsstring *)cfbridgingrelease(cfurlcreatestringbyaddingpercentescapes(kcfallocatordefault,(cfstringref)[nsstring stringwithformat:@"%@", [asseturl absolutestring]], null, cfstr("!$&'()*+,-./:;=?@_~"), kcfstringencodingutf8)); nsstring *cfcaption = (nsstring *)cfbridgingrelease(cfurlcreatestringbyaddingpercentescapes(kcfallocatordefault,(cfstringref)[nsstring stringwithformat:@"%@", strinstagramcaption], null, cfstr("!$&'()*+,-./:;=?@_~"), kcfstringencodingutf8)); nsstring *instagramstring = [nsstring stringwithformat:@"instagram://library?assetpath=%@&instagramcaption=%@", [asseturl absolutestri

windows - Nsis delete folder & subfolder -- inside installer directory -

how can delete intel_xdx folder inside installer folder. intel_xdx folder have files & subdirectories inside it. script not working me not able delete intel_xdx folder. i have added requestexecutionlevel admin inside script. installer windows 7 pc. ; script generated hm nis edit script wizard. ; hm nis edit wizard helper defines !define product_name "uimagician" !define product_version "1.0.3" !define product_publisher "dinesh guleria" !define product_web_site "http://www.vscp.org/" !define product_dir_regkey "software\microsoft\windows\currentversion\app paths\uimagician.exe" !define product_uninst_key "software\microsoft\windows\currentversion\uninstall\${product_name}" !define product_uninst_root_key "hklm" ; mui 1.67 compatible ------ !include "mui.nsh" ; mui settings !define mui_abortwarning !define mui_icon "fatbee_v2.ico" !define mui_unicon "${nsisdir}\contrib\gra

hadoop - /usr/local/java/jdk1.8.0_40/jre/bin/bin/java: No such file or directory -

i enter command , gives error `bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.6.0.jar grep input output 'dfs[a-z.]+' bin/hadoop: line 144: /usr/local/java/jdk1.8.0_40/jre/bin/bin/java: no such file or directory` please help. looks you're trying set hadoop. should find java installed in machine, go to /etc/<hadoop>/<conf>/hadoop-env.sh and change java_home java installed. in order know java installed, try echo $java_home (if it's set it'll show path), if not, try search it: sudo find /usr/ -name *jdk now i've noticed have double /bin in path, change java_home , remove redundant /bin .

firefox addon - Use native sdk in cross browser plugin tool -

i using kango extension make cross browser plugin. need use part of native firefox sdk . have problem following code: var window = require('sdk/window/utils').getmostrecentbrowserwindow(); this doesn't work @ , doesn't print error. added sdk folder mozila sdk folder sdkx/lib/sdk . have tried move whole lib folder inside plugin doesn't work also. use native features safari , chrome in same way firefox requires import of sdk. can make work?

android - How to get users location bounding box from google fit api -

i'm trying users step count , location bounding box in last 24 hours google fit api. i don't have problem step count i'm getting error location. code: @override protected void onstart() { super.onstart(); if (mgoogleapiclient == null) { mgoogleapiclient = new googleapiclient.builder(this) // optionally, add additional apis , scopes if required. .addapi(fitness.api) .addscope(new scope(scopes.fitness_location_read)) .addscope(new scope(scopes.fitness_activity_read)) .addconnectioncallbacks(this) .addonconnectionfailedlistener(this) .build(); } mgoogleapiclient.connect(); } private class getfitnesstask extends asynctask<void, void, string> { @override protected string doinbackground(void... params) { log.e("getfitnesstask", "getfitnesstask"); getstepstoday(); getlocation()

c - segmentation fault while calling strlen with a previously allocated pointer -

up until have had code worked regarding variable called wfiles . wfiles initialized within main file: char* wfiles = ""; which far can tell c has no complaints. next wfiles variable allocated in switch statement: switch (c) { case 't': /* user wants template */ template = optarg; break; case 'f': wfiles = optarg; break; case 'v': vcs = optarg; break; case 'u': url = optarg; break; case 's': /* custom save location */ save_loc = optarg; break; case '?': break; default: abort(); } finally check whether or not wfiles empty: if (!empty(wfiles)) empty macro expands (strlen(wfiles) == 0) i cannot see problems when run code segmentation fault. had never happened before. when ran code in gdb , without debugging symbols, 1 line pointed if statement earlier mentioned. know why

ios - Hashtags for posts with swift using parse -

i have uitextfield tags. parse "post" class has column tags when user creating posts. want textfield tags saved data base in such way can query column in posts class , able show them in app separated "#" right after keyboard dismissed or when hit space bar. basically same functionality stack overflows tags when creating question, ios! your tags should class, , column of tags should array of pointers (not strings). as user types can query matching tags , display these options. if no match found can create , save new tag. add tag array of pointers (add unique method). when querying objects can use includes key option have array of tag pointers downloaded @ same time have tag names display. to query tag tag object , query objects tags array contains tag object.

case - How to "sample" a value in VHDL? -

so have modulo counter going 1->15, looping around in seperate entity. to, in case statement depending on outputs, sample value on rising_edge of clock, once, otherwise value changing. there way this? assign signal , have stay static? i've posted code hope demonstrate trying bit better. process(all) begin --sensitivity list? if(reset) playercards <= "0000000000000000"; dealercards <= "0000000000000000"; elsif rising_edge(clock) case? deal & dealto & dealtocardslot when "1100" => playercards(3 downto 0) <= singlecard; playercards(15 downto 4) <= (others => '0'); when "1101" => playercards(7 downto 4) <= singlecard; playercards(15 downto 8) <= (others => '0'); when "1110" => playercards(11 downto 8) <= singlecard;

.net - Select method, changes default ordering of DataTable -

when convert datatable ienumerable using select method, default ordering sp changed! option can set prevent this? var list = datatable.select(); i got it! instead of datatable.select(); i should use datatable.asenumerable();

python - Class nested in for loop -

i have loop, inside loop class. don't think that's how supposed laid out. i'm unsure terms search solve problem. for x,y in something: stuff: class someclass: def__init__(self): stuff the full code can seen http://pastebin.com/g7fyeqwa i have tried importing both modules each other didn't work ended circular dependency moving of non class code file , importing 1 module ran db inserts on last team scraped( understand why) this first attempt @ oop in language advice on front appreciated well. program not oop begin why class inside loop begin with. of aspects oop added after initial program( work) written. from can tell need able call kind of scrape function teamscraper, , put in loop, im not sure how go it don't that. a class, in object oriented language class of objects. objects have attributes , methods. class defines how create new object of particular type. main ideas of oo encapsulation , inheritance , polymorph

mysql - Annual salary Between 2000 and 6000 to display -

i have query select employeeid, sum( salary *12 ) annual_salary employee group salary limit 0 , 30 it displays annual salary want display annual salary between 2000 , 6000 within advance select employeeid, sum( salary *12 ) annual_salary employee group salary having sum( salary *12 ) between 2000 , 6000 limit 0 , 30

asp.net - show an Image on Click of a LinkButton Control -

how show image in contentplaceholder4 on click of link button placed on contentplaceholder3. i have master page , 1 content page. on master page have link instruments clicking on redirected content page instruments. have 10 link button controls on content page , want on click of each link button corresponding image should open on same content page in different cntentplaceholder. please guide me how add code link button click , how render iamge on click of link button. following code have added till now. **this master page** <%@ master language="c#" autoeventwireup="true" codefile="masterpage.master.cs" inherits="masterpage" %> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <asp:contentplaceh

python - How can I download all files from Amazon S3 that are in a folder that was created last month? -

how can download folder amazon s3 created last month until present? i have code using boto: for key in bucket.list(): if last_month < dateutil.parser(key.last_modified).month: key.get_contents_to_filename(local_path + key.name) the problem loop take long time because it's comparing each file in folder. want compare folder timestamp. if there's way using aws cli better. this not possible. amazon s3 not use directories. flat storage structure. to give appearance of directories, paths prepended key (filename) of object (file). for example, object called cat.jpg stored in directory called animals have key (filename) of animals/cat.jpg . since directories not exist, there no way retrieve properties directory. (btw, there concept of "common prefixes" can work directories when referring multiple files, still isn't actual directory.)

actionscript 3 - how to reference a hit test object between .as files [AS3] -

i'm trying make top down shooter game, , have been following tutorials here: http://gamedev.michaeljameswilliams.com/2008/09/17/avoider-game-tutorial-1/ , here: as3gametuts.com/2013/07/10/top-down-rpg-shooter-4-shooting/ i've managed shooting , movement, need hit test object register when bullet (defined in own seperate class file) , enemy (also defined in seperate file) come contact. code below: enemy code: package { import flash.display.movieclip; public class enemy extends movieclip { public function enemy() { x = 100; y = -15; } public function movedownabit():void { y = y + 3; } } } bullet code: package { import flash.display.stage; import flash.display.movieclip; import flash.events.event; import flash.utils.timer; import flash.events.timerevent; public class bullet extends movieclip { private va

html - How to vertically center two child DIVs inside of a parent DIV -

i creating site in bootstrap, , want know how vertically center 2 child divs inside of parent div. know pretty simple, have tried , not work. (http://codepen.io/cjhill02/pen/vlperd) try margin:auto * { border: 1px solid #ddd; } section { padding: 100px 0; margin: auto } .col-md-6{ margin: auto } for ie9 , ie10 put display:table parent div , set attribute vallign="middle";display:table-cell child element vallign basic property supperted old browsers new browsers

php - Codeigniter: All pages shows 404 page not found (codeigniter's 404, not apache's) -

recently, before pc changed hard disk, using virtual host. after changed hard disk, using apache's htdocs folder. when tried accessing codeigniter project again, pages show '404 page not found'. not web server because can tell error message codeigniter's(because styled 404 error page). my project has 2 controllers: ( admin.php , vendor.php ). these 2 working fine. things tried: checked config/config.php $config['base_url'] = ''; $config['index_page'] = 'index.php'; then tried changing to: $config['base_url'] = 'http://localhost/work%20projects/admin_panel/'; tried accessing controllers , without index.php in case mod_rewrite not functioning. still not working. http://localhost/work%20projects/admin_panel/index.php/admin http://localhost/work%20projects/admin_panel/admin change this in config.php $config['base_url'] = ''; $config['index_page'] = 'index.php'

How can Java programs crash when exceptions must always be caught? -

this question has answer here: why catch exceptions in java, when can catch throwables? 14 answers forgive me if stupid question, far know, java exceptions must caught , handled. example, create compiler error: public string foo(object o) { if (o instanceof boolean) { throw new exception(); } return o.tostring(); } because method foo() didn't add throws clause. however, example work (unless either method foo() didn't have throws clause or method bar() didn't surround usage of foo() in try/catch block): public string foo(object o) throws exception { if (o instanceof boolean) { throw new exception(); } return o.tostring(); } public void bar(object o) { try { string s = foo(o); } catch (exception e) { //... } //... } at end, java program still crashes due unhandled

ios - Swift update UILabel with dispatch_async not working -

Image
why doesn't work? dispatch_async(dispatch_get_main_queue(), { self.timestringlabel.text = "\(self.timestringselected)" println(self.timestringlabel.text) }) i'm trying update label in swift ui label never changes. keep googling it, can't find responses don't use dispatch_async. doing wrong? 1st edit: mistaken. i'm not printing updated text. text never changes. prints out optional("0") if helps. default value 0 defined in storyboard. i have tried , without dispatch_async without success. tried adding self.timestringlabel.setneedsdisplay() after updating text, doesn't work. edit 2: here's complete function + uilabel declaration @iboutlet weak var timenumberlabel: uilabel! @ibaction func timenumberbuttonpressed(sender: uibutton) { println("number selected. tag \(sender.tag)") dispatch_async(dispatch_get_main_queue()) { self.timenumberonebutton.selected = false self.timenumb

ironpython - I want to host Spotfire web player UI in an iframe. Can I do this with Spotfire Desktop? -

i've downloaded spotfire desktop. can't figure out how host webplayer inside iframe. possible spotfire desktop? the following link http://stn.spotfire.com/stn/tasks/integratingwithwebplayer.aspx leads tibco spotfire documentation describes how embed spotfire within iframe. that operation not have directly related spotfire desktop. use desktop create dashboards , actions link above embed dashboards inside iframe.

actionscript 3 - In Flex mobile app, can I stream local video file to rtmp server -

i have video file in external storage of phone. can stream rtmp server directly? currently, i'm able stream camera server successfully: ns = new netstream(nc); ns.attachcamera(cam); ns.attachaudio(mic); ns.publish("my_rtmp_streaming_server_url", "live");

android - Hardware menu popup issue with Appcompat -

i implemented in application (not so) new appcompat theme darkactionbar. works fine, except popup hardware menu button (or long press recent button), rendered white text. popup result: toolbar: http://i.stack.imgur.com/huwpm.png hard menu: http://i.stack.imgur.com/o5fml.png i solved old issue popup action mode, adding actionbarpopuptheme attribute in app theme. after this, hardware menu popup getting background actionbarpopuptheme (ok, want! before black), not textcolor. the code: <style name="apptheme" parent="theme.appcompat.light.noactionbar"> <item name="colorprimary">@color/primary</item> <item name="colorprimarydark">@color/primary_dark</item> <item name="windowactionmodeoverlay">true</item> <item name="actionbartheme">@style/themeoverlay.appcompat.dark.actionbar</item> <item name="actionbarpopuptheme">@style/themeo

Why do I get nvarchar value null to a data type in SQL Server 2008? -

i getting error in sql server: conversion failed when converting nvarchar value 'null' data type int. in employee table have: id int, name nvarchar(50), gender nvarchar(10), salary nvarchar(50), departmentid nvarchar(50) nulls allowed departmentid . in department table have: id int, department name nvarchar(50), location nvarchar(50), departmentheead nvarchar(50) none of them allow nulls. i trying join tables so: select name, gender, salary, departmentname employee join department on employee.departmentid = department.id that's when error: conversion failed when converting nvarchar value 'null' data type int. i not understanding error here. goal join departmentname column employee table. if you're storing foreign key reference table (in case, departmentid on employee table id field on department table), need of same data type. if don't have foreign key reference defined, should. ensure referential integr

java - How to split an Acronym from it's Meaning in a String -

this question has answer here: what best way extract first word string in java? 10 answers i want able split string contains acronym , it's meaning in 2 strings. for example: string main = "bc before christ"; //do something. string acronym = "bc"; string meaning = "before christ"; any appreciated, thanks! :) you can use string.split this. there variant of split takes second parameter dictates how many times split (the size of returned array). string arr[] = main.split(" ", 2); string acronym = arr[0]; string meaning = arr[1];

java - JavaDoc: document only the public methods in a framework that users are supposed to use? -

frameworks need contain classes have public methods because of needs of framework; users using framework aren't supposed invoke them. for example, class might have public constructor factory in package can instantiate it, user supposed use factory, never constructor directly. i'd javadoc emit documentation on methods user supposed invoke, not others. in example, should document factory method, not public constructor. of course, javadoc won't know which, thinking "public" methods annotated annotation, @supportedapi, , javadoc spit out documentation on those. (this have added benefit mark methods expected remain stable.) can javadoc configured that?

C++ : Creating program that reads a text file -

i need new. text below has been created on separate file( football.txt ). trying create program can read data , have displayed. player name: rusell william salaray: $8000000 age: 20 team: seahawks position: quarterback this have, //this program read text files display #include <iostream> #include <fstream> #include <iomanip> #include <string> using namespace std; int main() { //declaring variables int salary, age; string firstname, lastname, team, position; //delcaring file. ifstream infile; infile.open("football.txt", ios::in); if (!infile) { cout<<"file not exist"; } infile.close(); ofstream outfile; //declare on display cout<<"**********player summary*********\n"; outfile.open("football.txt", ios::app); outfile<<"football.txt"; outfile.close(); return 0; } no errors, no displayed neit

ios - updating with Core Data -

i have following code: class ratingsdata { var ratings = [nsmanagedobject]() func fetchfromdatabase() -> void { let appdelegate = uiapplication.sharedapplication().delegate as! appdelegate let managedcontext = appdelegate.managedobjectcontext! let fetchrequest = nsfetchrequest(entityname: "rating") var error: nserror? let sortdescriptor = nssortdescriptor(key: "date", ascending: false) fetchrequest.sortdescriptors = [sortdescriptor] let fetchedresults = managedcontext.executefetchrequest(fetchrequest, error: &error) as! [nsmanagedobject]? if let results = fetchedresults { ratings = results } else { println("error fetching database") } } func addtitle(newtitle:string) -> void { let appdelegate = uiapplication.sharedapplication().delegate as! appdelegate let managedcontext = appdelegate.managedobjectc

android - How can I trigger my notification from a method? -

i trying trigger notification bottom. followed example code http://www.compiletimeerror.com/2013/10/status-bar-notification-example-in.html#.vwtos1xviko i can trigger notification when call method homeactivity main activity app. when try call 1 of methods within app, nothing happens. (eg) homeactivity homeactivity = new homeactivity(); homeactivity.notify("title: ...", "msg: ... "); here logs event. trigger alert after 5 button presses 05-31 18:33:41.533 10118-10118/com.myapp.md e/>>>>>>﹕ multiclickevent clickcount = 5 05-31 18:33:41.543 10118-10118/com.myapp.md e/>>>>>>>﹕ in onactivation of hwreceiver 05-31 18:33:41.603 10118-10118/com.myapp.md v/vibrator﹕ called vibrate(long) api - puid: 10588, packagename: com.myapp.md 05-31 18:33:41.603 10118-10118/com.myapp.md v/vibrator﹕ vibrate - puid: 10588, packagename: com.myapp.md, ms: 3000, mag: -1 05-31 18:33:41.643 10118-10118/com.myapp.md d/abslistview﹕ onvisibil