Posts

Showing posts from March, 2012

ruby - A fiber issue with `autoload`: `fiber called across stack rewinding barrier (FiberError)` -

we using fiber eventmachine (em-synchrony) in our production env quite long time, , works well. use outdated ruby 1.9.3 , activerecord 3.x on 2 years. migrating 2 big parts latest versions. when trying upgrade ruby latest, got exception fiber called across stack rewinding barrier (fibererror) in 2.0+, not in 1.9.3. can guys figure out problem? minimal sample: test.rb autoload :user, './user.rb' f = fiber.new p user end f.resume f.resume user.rb class user end fiber.yield # line important run $ rvm 1.9.3,2.0,2.1 sh -c 'echo ==== $ruby_version; ruby test.rb' ==== ruby-1.9.3-p551 user ==== ruby-2.0.0-p598 user.rb:4:in `yield': fiber called across stack rewinding barrier (fibererror) user.rb:4:in `<top (required)>' test.rb:4:in `block in <main>' ==== ruby-2.1.5 user.rb:4:in `yield': fiber called across stack rewinding barrier (fibererror) user.rb:4:in `<top (required)>' test.rb:4:in `block in ...

how to get time from php class? -

below part of class file: class main{ public time; $this->time = gmdate("y-m-d h:i:s",time()+21600); } but showing following error: syntax error, unexpected t_variable, expecting t_function in /home/user/folder/main.php on line 3 would tell me how fix it? you forgot $ time variable , assignment of value can in __construct() function this: <?php class main { public $time; function __construct() { $this->time = gmdate("y-m-d h:i:s",time()+21600); } } $object = new main(); echo $object->time; ?> output: 2014-11-27 11:43:36 also know can assign constant values class member in class definition! in constructor can assign whatever want see: http://php.net/manual/en/language.oop5.properties.php

java - How to override configLocation in maven checkstyle plugin? -

i want override configlocation option in maven checkstyle plugin. sample part of pom.xml : <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-checkstyle-plugin</artifactid> <executions> <execution> <goals> <goal>check</goal> </goals> </execution> </executions> <configuration> <configlocation>blahblah/checkstyle/checkstyle.xml</configlocation> <consoleoutput>true</consoleoutput> </configuration> <dependencies> <dependency> <groupid>com.example.blahblah</groupid> <artifactid>checkstyle-config</artifactid> <version>2.0.0-snapshot</version> </dependency> </dependencies> <configuration> <configlocation>checkstyle.config.xml</configlocation> ...

android - Detect when system starts a download -

is there way detect when system starts download , information of , force download specific location? googled , results not helpful start service class , start download print result status of download. public class myservice extends service { private timer timer; private timertask timertask; private static final int sampling_rate = 1000; public myservice() { } @override public ibinder onbind(intent intent) { return null; } @override @deprecated public void onstart(intent intent, int startid) { log.e("download", "onstart"); } @override public void oncreate() { timer = new timer(); timertask = new timertask() { @override public void run() { // log.d(myservice.class.tostring(), // "tic ... "+system.currenttimemillis()); getdownloaddata(); } }; if (timer != null && timertask != null) { timer.schedule(timertask, 0, sampling_rate); } } @...

java - JSONModel Generic Class -

i'm trying include jsonmodel project i'm working on... in project need data web service, returns me same data structure, different entries... build base jsonmodel class should work responses. looks this: @interface webserviceresponse : jsonmodel @property (assign, nonatomic) bool success; @property (assign, nonatomic) int code; @property (strong, nonatomic) nsstring *message; @property (strong, nonatomic) nsstring *timestamp; @property (strong, nonatomic) nsarray *list; @end the data web service given in "list" , dictionary (but differs different api methods call). except on error "null"... how can define list property parse given dictionaries? given structure object null :( thanks help, urkman try using bwjsonmatcher , declare base response data model follows: @interface webserviceresponse : nsobject<bwjsonvalueobject> @property (assign, nonatomic) bool success; @property (assign, nonatomic) int code; @property (strong, nonat...

printing - Applescript: print first or other specific pages -

how can instruct application or printer print first page, page range or odd or pages of file? attempt of preview app, looks promising: set thefile "[file-path/file]"" tell application "preview" activate print thefile properties {target printer:"printer", ending page:1} without «class pdlg» --these properties isn't available printer app, here limiting amount of printed pages quit end tell but i'm bitten sandboxd process tells me file can't opened printing , deny file-read-data result in log. in cups suggestion adamh encounter issues umlauts , have other execution issues well, possibly because of sandbox rules. code works command line, not when called in automated fashion. i tried useful examples of print command in reference, in books , tried searching online apple references, can't seem find many examples fitting present day situation sandbox, if any. you script printing command line tool lp & lpr . these ...

python - Django serialization get foreign key object with primary key object -

Image
i need serialize django model instance foreign keys instance. ex. class person(models.model): first_name = models.charfield(max_length='30') last_name = models.charfield(max_length='30') class author(models.model): reg_num = models.charfield(max_length = '30') person = models.foreignkey(person) so in serialized version of authon instance, want like [ { "fields": { "reg_num": "czg29742xd4", "person": { "fields": { "first_name": "dheerendra", "last_name": "rathor" } "model": "person.person", "pk": 2 } } "model": "person.author", "pk": 2 } ] this can achieved providing bo...

MySql to txt with PHP -

i have problem. googled couldn't find answer. so, have website users can add creations. creations going in mysql table. now, want take data table , send .txt file,but, want save in txt file title have in table. mysql table has 4 columns: creations, title, user , categories. i want save each row table in separate text file title title column. or, when user click on post creation not send database send directly text file title add. this postcreations.php if ($_post['posteaza']) { $con=mysqli_connect("localhost", $uname, $password,$database) or die (" nu ma pot conecta"); mysqli_query($con,"create table if not exists postest (id int(255) not null auto_increment primary key, continut varchar(10000000), titlul varchar(200), categorie varchar(200), user varchar(30))") or die (" nu pot crea"); $text = mysqli_real_escape_string($con,(stripslashes($_post['continut']))); $titlul = mysqli_re...

javascript - How i get the window object in node webkit after startup -

i want register events on window object after startup in node-webkits node-main file. if window.alert("foo") at beginning window not defined. if wait few seconds it's working. settimeout(function(){ window.alert("foo") },2000) is there event (maybe member of process) can listen to, notified window object available ? yes, there loaded event emitted can hook into. var gui = require('nw.gui'); var win = gui.window.get(); win.on('loaded', function() { // stuff });

c# - Remove images appearing on the aspx page -

i created imagebuttons in code-behind. then, populated list of imagebuttons as: protected void image_click(object sender, imageclickeventargs e) { imagebutton imgbutton = sender imagebutton; imgbutton.imageurl = resource.tick_image; // work imagebuttonlist.add(imgbutton); } on aspx page images appear now. after time, want remove images. i tried like: buttonlist.clear(); but, still images appearing on aspx page. how should remove images? my whole code looks like: public static list<image> randomimages = new list<image>(); protected void page_load(object sender, eventargs e) { buttonlist.clear(); if (!string.isnullorempty(request.form[resource.reset_button_id]) || !page.ispostback) { randomimages = resetgame(); } addcardstodisplay(randomimages, carddiv, true); } public void addcardstodisplay(list<image> images, system.web.ui.htmlcontrols.htmlgenericcontrol divisionn...

java - NoClassDefFoundError: org/apache/commons/io/output/DeferredFileOutputStream in uploading file with SpringMVC/Wildfly/CentOS -

while upload files web application in springmvc/widlfly/ubuntu stack, encounter noclassdeffounderror exception in springmvc/widlfly/centos. both stack has same wildfly, same jdk, , same configurations. environment: springmvc wildfly 8.1 / wildfly 8.2 jdk 1.7.0_51-b13 jar files: my-ear.ear/my-web.war/web-inf/lib/commons-io-2.4.jar my-ear.ear/my-web.war/web-inf/lib/commons-fileupload-1.3.1.jar wildfly-8.1.0.final/modules/system/layers/base/org/apache/commons/io/main/commons-io-2.4.jar i know exception due conflicting in class-loader. i solved problem. moved ' commons-io-2.4.jar ' , ' commons-fileupload-1.3.1.jar ' files ' my-ear.ear/my-web.war/web-inf/lib/ ' ' my-ear.ear/lib '.

mysql - Efficient way to compare input Data with Sql table in Java -

first of explain use case: i string array of names user(can of size 2,5,1) e.g suppose user input this: string[] names={"micheal", "joe","jim"} now after taking input user, have hit sql table called "users" , check whether of these names present in users table or not. if single name not present return false. if names present in users table return true. my idea: my idea hit users table. names of users table in string array (named all_names) , compare input string(i.e names) all_names string. if names subset of all_names return true else return false. problem: but think not efficient solution. when table expand have thousands of records technique exhaustive. other better , efficient solution please. updated solution: suppose names in users table unique. thanks replies. have adopted approach after getting answers. want know solution better approach or not: string[] names={"micheal","jim",...

windows - How to gracefully shutdown a Java application that is terminated as a result of closing the command line from which it was executed? -

there answered question on best way gracefully shutdown java command line program . shutdown hook job in case when program terminated ctrl+c. my question how gracefully exit if command line closed during execution of java program? tested shutdown hook didn't work in case. cannot find out happens virtual machine in scenario. process , threads killed instantly? kind of signal closing command line produce? so, how particular problem can solved? edit: problem concerns windows environment. logically, sighup (terminal hangup) should raised. actually, i've checked guess simple shell script. yes, when user closes terminal emulator in application started (and wasn't detached), application receives sighup. set sighup handler , react accordingly. usual behaviour terminate application, intents may different. also if java application performs stdin/stdout operations, should closed or @ least re-cofigured when hup received, because attempt read/write non existing t...

Android tablet phone shows negetive color screen for all application -

i seem have changed in error in phone , entire display throughout entire phone in negative look. mean photographs, icons, backgrounds in reverse colours negative photograph. driving me crazy...i cant remember pushed or in phone when did if wiser person me has answer i'd gratefull.

php - Mysql using only a time in date_sub or alternative -

i have mysql field set "time", , check against time, using time well. i have cron run every 10 minutes, clients can set reminder messages sent out every day @ time of day or so. using following query not give me fields last 9 minutes: select `id` `sms_reminders` (`option` = "weekdays" or `option_days` "%4%") , `time` < date_sub(now(), interval 9 minute) however, giving me mixed results. my time field set @ 09:50:00 (time of running query 09:53:00). thanks. make few changes in code use > instead of <

python - Integrating a non-threaded SQLAlchemy code with Flask-SQLAlchemy -

i have python module usermanager takes care things user management related - users, groups, rights, authentication. access these assets provided via master class passed sqlalchemy engine parameter @ constructor. engine needed make table-class mappings (using mapper objects), , emit sessions. this how gobal variables established in app module: class usermanager: def __init__(self, db): self.db = db self._db_session = none meta = metadata(db) user_table = table( 'usr_user', meta, column('field1'), column('field3') ) mapper(user, user_table) @property def db_session(self): if self._db_session none: self._db_session = scoped_session(sessionmaker()) self._db_session.configure(bind=self.db) return self._db_session class user(object): def init(self, um): self.um = um flask.ext.sqlalchemy import sqlalchemy db = ...

SVG rendering incomplete in Firefox -

i've been searching few hours reason svg wouldn't work in firefox. know if i'm running known bug or have problem in code here? http://codepen.io/ryanburnette/pen/c5274e0076748da1a53a2d16c8702050 i'm asking in terms of svg in pen. note code in slim here. svg.overlay viewbox="0 0 265 281.551" g path.outer d="m132.5,0c59.322,0,0,59.322,0,132.5c0,66.245,48.616,121.134,112.115,130.939l16.505,16.504, c2.143,2.144,5.617,2.144,7.762-0.001l0.001,0.001l16.504-16.505c216.385,253.633,265,198.745,265,132.5,c265,59.322,205.678,0,132.5,0z" path.inner d="m132.502,256.388c64.08,256.388,8.614,200.921,8.614,132.5s64.08,8.612,132.502,8.612,c68.421,0,123.887,55.467,123.887,123.888s200.923,256.388,132.502,256.388z" update 1: i had commas shouldn't have. what's interesting firefox browser in malformed svg didn't work in spite of error. specifically, in firefox, element did not render past point comma should not have been there...

.htaccess - Redirecting a web folder directory to another htaccess -

sorry has no doubt been asked multiple times before, want clarification following code redirect url on olddomain.com newdomain.com homepage not equivalent url: rewriteengine on rewritecond %{http_host} !^www\.olddomain\.com$ rewriterule (.*) http://www.newdomain.com/$1 [r=301,l] rewritecond %{http_host} !^olddomain\.com$ rewriterule (.*) http://www.newdomain.com/$1 [r=301,l] also if wanted subdomain on olddomain.com eg.subdomain.olddomain.com go homepage of newdomain.com have do? can use universal selector or have write condition each subdomain so: rewritecond %{http_host} ^subdomain.olddomain.com$ rewriterule ^(.*)$ http://subdomain.newdomain.com/$1 [r=301,l] rewritecond %{http_host} ^www.subdomain.olddomain.com$ rewriterule ^(.*)$ http://subdomain.newdomain.com/$1 [r=301,l] both of attempts not correct first redirect: http://olddomain.com/foobar http://newdomain.com/foobar not homepage of newdomain . same problem 2nd rule. you can use code in document_roo...

javascript - Creating a jQuery array based on key of json array -

i have json array thats being sent ajax response. the json array in following manner [{"id":"11105","name":"gummy drop (iphone, free, row except cn, 72.3mb, w"},{"id":"11107","name":"gummy drop (ipad, free, row except cn, 72.3mb, w\/ "},{"id":"4274","name":"z-redirect non-targeted traffic dragon city mobile"},{"id":"6484","name":"z-redirect non-targeted traffic dragon city mobile"}] now, sometimes, key can id , name , can roll , address so it's not predictable or some. i need key form json array/object , build thing this var acolumns = [{ stitle: "id"}, { stitle: "name" }]; someone suggested me piece of code, follows: $.post("ajax.php",{'version':v,'category':ctg,'country':cnt,'func':'show_datatable'}, function...

javascript - Turn off suggestions bar for Chrome in Android phone -

i looking turn off spelling suggestions input box , not able achieve it. i used autocomplete="off" , autocapitalize="off" , spellcheck="off" input able see bar above keypad showing suggestions. this affecting layout. looking working solutions. if using cordova this, in html5 there spellcheck attribute. <input type="text" spellcheck="false">

Can I use Android floating action button using Android Official Library? -

not others library, i want use 'android official library' v7, support library else. i have nexus7 , want use floating action button listview. so... how can use floating action button? as of late may, 2015, floatingactionbutton standardized , officially part of android design support library . wrote quick usage example if helps @ all...

javascript - How can I implement the array feature in a select menu? -

so using questionnaire multiple select lists, classify our users different groups of 5, , working on algorithm out them different groups. having trouble select list, not sure how store selected value arrays. how can use/implement array feature in questionnaire? (sorry thepoorly constructed question, kind of new in programming language business) p.s. i'm using dreamweaver cs6 construct entire website including questionnaire, , here's 1 of question using in questionnaire < p >what time zone in? < select name="select" id="select"> <option value="0">gmt -12</option> .... <option value="23">gmt +11 </option> <option value="0">gmt +12 </option> </select> < /p > add [] name. <select name="select[]" id="select">

datetime - How to return DATE from DATE TIME in Openoffice -

i have openoffice calc column following entries: 10/21/12 09:39 12/20/12 05:35 04/30/13 12:47 pm how extract date part output is: 10/21/12 12/20/12 04/30/13 just apply rounddown() or int() date value strip time information; may have apply date formatting manually. the date value 10/21/12 09:39 am internally stored 41203.4020833333 calc. calc uses integers dates , fractions time values . so, date part of 10/21/12 09:39 am 41203 . rounding down value 41203.4020833333 41203 strips time information, leaving date (to precise: result 10/21/12 00:00 am - it's matter of formatting cell date or date/time.

c# - Is it possible to create a single add In to use in both 2010 and 2013 outlook? -

i have created add in using vs2013 targeted framework 4.5. working fine in outlook 2013 (system spec: windows 8.1, visual studio 2013 , office 2013). but when try use same in outlook 2010 getting error message "the common language runtime not loaded (add in path). contact administrator further assistance.". have installed required .net framework , microsoft visual studio 2010 tools office runtime (testing machine windows 7 , office 2010). solutions created using visual studio 2013 can run in office 2013, office 2010, or 2007 microsoft office system. however, solution can use features , apis available in 3 versions of office. can read more in running solutions in different versions of microsoft office article. make sure have got full edition of .net framework installed, not client profile.

sql - Merge four indexed views in only one -

i'm working sql server 2012 express , developer edition latest service pack. i have created 3 indexed views: create view dbo.requestedcodesstatistics schemabinding select code_level, count_big(*) codes_requested dbo.codes group code_level go create unique clustered index ix_requested_statistics on dbo.requestedcodesstatistics (code_level) go create view dbo.printedcodesstatistics schemabinding select level, count_big(*) codes_printed dbo.codes (flag = 1) or (flag = 0) or (flag = 20) or (flag = 120) group level go create unique clustered index ix_printed_statistics on dbo.printedcodesstatistics (level) go create view dbo.readcodesstatistics schemabinding select level, count_big(*) codes_read dbo.codes (flag = 0) or (flag = 20) or (flag = 120) group level go create unique clustered index ix_read_statistics on dbo.readcodesstatistics (level) go create view dbo.dropp...

amazon web services - Launching Instances in Default VPC Produces Error -

i'm trying launch webservers webservers security group, this: $ aws ec2 run-instances --image-id ami-someami --count 2 --instance-type m3.medium --key-name some_key --security-groups webservers client error (invalidparametercombination) occurred when calling runinstances operation: vpc security groups may not used non-vpc launch what gives? want launch boxes default vpc. don't want specify subnet, if do, can no longer specify security group. i'm new ec2, , rather not worry doing non-default things vpc until have to. security groups linked specific vpcs. check whether security group associated vpc different 1 in launching amazon ec2 instance (in case, different default vpc). if so, create new security group in default vpc , use when launching instances. if using ec2-classic (not vpc), note following aws cli documentation on run-instances : --security-groups (list) [ec2-classic, default vpc] 1 or more security group names. nondefault vpc, m...

ios - XCode Archive error in prefix header -

i'm using gpuimage framework in project , added projects target dependencies. builds , runs fine. problem occurred when tried archive project ipa file. error shows 'could not build module 'foundation' -inside gpuimage-prefix.pch . #ifdef __objc__ #import <foundation/foundation.h> #endif is conflicting import of project's projectname-prefix.pch ? #ifdef __objc__ #import <uikit/uikit.h> #import <foundation/foundation.h> #endif i keen know how solve ideal practice. did weak-link core video framework in project settings per gpuimage guideline , no use @ all. in advance. i think can delete /users/username/library/developer/xcode/deriveddata/modulecache clean project

c++ - Filtering file types with CMFCShellTreeCtrl -

i'm using cmfcshelltreectrl derived class called cshelltreectrl in cmfcoutlookbar object display files , i'd filter file types , later able drag , drop files it. i've managed display files folders, struggling understand how use ienumidlist achieve file type filtering. int cbar::oncreate(lpcreatestruct lpcreatestruct) { if (cmfcoutlookbar::oncreate(lpcreatestruct) == -1) return -1; cmfcoutlookbartabctrl* poutlookbar = (cmfcoutlookbartabctrl*)getunderlyingwindow(); if (poutlookbar != null) { poutlookbar->setimagelist(idb_pages_hc, 24); poutlookbar->settoolbarimagelist(idb_pages_small_hc, 16); poutlookbar->enableinplaceedit(false); recalclayout(); } redrawwindow(null, null, rdw_allchildren | rdw_invalidate | rdw_updatenow | rdw_erase); // can float, can autohide, can resize, can not close dword dwstyle = afx_cbrs_autohide | afx_cbrs_resize; crect rectdummy(0, 0, 0, 0); const dword dwtreestyle = ws_child | ws_visible | tvs_haslines | t...

java - How does TimeUnit.class enum operation work? -

how enum in timeunit api work? particularly below syntax mean? public enum name { constant { } } i have been following enum tutorial here , doesn't go details of above syntax. thing inside constant? anonymous class own methods? methods outside of constants? i'm confused. in {} "abstract" methods implemented. see body of class extends - follow example - "name". if have method in name - let's public string somemethod(){ throw new abstractmethoderror(); /*or default implementation.*/ } then you'd have implement in constant{ public string somemethod() { return "green eggs , ham"; } } and that's done in timeunit - defines abstract methods converting different units , elements implement conversion methods magnitude.

winforms - Printing vb.net forms with a loop -

hi tring print multiple copies of box labels on form using vb.net the copies depent on amount of boxes on job , range 1 500 copies. print these print choosen box number if required. can 1 attempts have failed. the problem captures screen including msgboxs of currenting being printed or done , calls them document 1. there simple way print without screen capture. here code @ moment imports system imports system.windows.forms imports system.drawing imports system.drawing.printing public class print inherits form private withevents printbutton new button private withevents printdocument1 new printdocument dim memoryimage bitmap private sub capturescreen() dim mygraphics graphics = me.creategraphics() dim s size = me.size memoryimage = new bitmap(s.width, s.height, mygraphics) dim memorygraphics graphics = graphics.fromimage(memoryimage) memorygraphics.copyfromscreen(me.location.x, me.location.y, 0, 0, s) end...

JavaFX - show graph in pane on checkbox click -

i have fxml file has pane 1 of it's entries, used show graph. not not visible default. when checkbox checked, pane visible. have add graph in pane , show graph when pane visible. how achieve this? have created graph using link. javafx real-time linechart time axis pane.visibleproperty().addlistener((obs, wasvisible, isvisible) -> { if(isvisible) { // pane became visible, add graph linechart<x, y> chart = ...; pane.getchildren().add(chart); } else { // pane became hidden, remove graph pane.getchildren().clear(); } });

c - scanf asking for two values instead of one -

this question has answer here: scanf() curious behaviour! 3 answers when compile code, leads scanf asking value twice when pick choice a. missing here? this isn't first time encountered, i'm suspecting i'm failing grasp rather fundamental scanf. #include <stdio.h> #include <stdlib.h> int main() { char choice; printf("1. 'enter 'a' choice\n"); printf("2. 'enter 'b' choice\n"); printf("3. 'enter 'c' choice\n"); scanf("%c", &choice); switch (choice) { case 'a': { int =0; printf("you've chosen menu a\n"); printf("enter number\n"); scanf("%d\n", &a); printf("%d\n", a); } break; case 'b': printf("you've chosen b\n"); break; case 'c...

node.js - MongoDB default values are not saved, instead re-calculated at runtime -

i'm building simple rest app on yeoman express mvc generator mongodb. this mongodb/mongoose model ( updated complete update.js model ): var mongoose = require('mongoose'), schema = mongoose.schema; var updateschema = new schema({ title: string, text: string, authors: string, url: string, imageurl: string, datecreated: { type: date, default: date.now }, reloadneeded: { type: boolean, default: true } }); mongoose.model('update', updateschema); this data looks in mongo client: > db.updates.find(); { "_id" : objectid("5476453f8920d05ecdef4eec"), "title" : "hello world", "text" : "yoda yoda" } { "_id" : objectid("547653748920d05ecdef4eed"), "title" : "hihi", "text" : "mookie" } and json output express app: [ {"_id":"5476453f8920d05ecdef4eec","title":"hello world...

apache - Change HTTP authentication password in Gerrit -

i using http way of authentication gerrit (apache authenticating on gerrit's behalf). have file in apache folder contains username:encrypted password. able login using configuration, however, how user change password using ui (which changed on first login)? using setup not ideal production environment. either want change ldap or openid or use apache http auth against other user database (you pretty flexible there, search the list of modules auth ). if don't have authenticate against, well.. manage users in htpasswd file. http auth, there no way change password through gerrit ui.

ios - NSDecimal equal to NSDecimalNumber value? -

i looking effective way save nsdecimalnumber other data in nsdata buffer. i have not found method directly nsdecimalnumber . however, easy convert : nsdecimal value = [thedecimalnumber decimalvalue]; and not difficult transfer nsdecimal in memory (20 bytes). but, question: the nsdecimalnumber , nsdecimal values same? because declarations have differences ( externalrefcount ?): @interface nsdecimalnumber : nsnumber { @private signed int _exponent:8; unsigned int _length:4; unsigned int _isnegative:1; unsigned int _iscompact:1; unsigned int _reserved:1; unsigned int _hasexternalrefcount:1; unsigned int _refs:16; unsigned short _mantissa[0]; /* gcc */ } typedef struct { signed int _exponent:8; unsigned int _length:4; // length == 0 && isnegative -> nan unsigned int _isnegative:1; unsigned int _iscompact:1; unsigned int _reserved:18; unsigned short _mantissa[nsdecimalmaxsize]; } nsdecimal; i...

Android: update specific notification from multiple notifications which have remoteview -

i creating application contain notification have play/pause icon , which. works perfect when there have 1 notification have 1 notification id, change play/pause icon through 1 notificationid, there have issue multiple notification. when there have multiple notification, each notification have play/pause icon. when click play/pause icon 1 of notification, changing top notification icon stack of notification. know problem due notification-id got on click on notification.i want id notification on click of play/pause icon.i have tried changing of pendingintent content , not found yet exact solution. i want know , is there way notificationid of notification,on click of play/pause icon of that? , can change icon or update notification through notification id.need update notification through there notification id. i have used remote-view costume layout in notification. code below notificationcode remoteviews mremoteviews1 = null; pendingintent pendingintent = null; pen...

pointers - Declaration of differents types of extern variables in C -

i have doubt declaration of external variables. i'm working in project working, , below (it example based in real program): file1.h #include "mystruct.h" extern long ; extern strc_1 s ; extern strc_2 *ss; in main program have main.c #include "file1.h" long ; strc_1 s ; main() { = 10; s.variablex = 10; s.variabley = 50; ss.j = 50; ss.j = 250; } so, question is: why not pointer 'ss' need declared in main program? , why work? mean, variables 'a' , 'strc_1' declared in main program because use them, however, use 'ss' did not declared in main program. long ; strc_1 s ; these in main.c called definitions , not declarations . (to precise, definitions declarations). the reason don't have define ss because it's defined in other source file. long declaration of ss (which in header1.h ) can seen, compile fine.

spring mvc - Authenticate native mobile app using a REST API -

like facebook application, enter credentials when open application first time. after that, you're automatically signed in every time open app. how 1 accomplish this? there's commom line in auto-login implementations upon initial login, token received , stored on client side upon subsequent visits, if token available on client side, server resolves identity , logs in automatically now concrete implementation variations can numerous. token can session id (encripted or not), oauth token, custom token, username , password should avoided. storing token can on within browser cookie, browser local storage, can have server counter-part. security major concern. topic can read more here https://softwareengineering.stackexchange.com/questions/200511/how-to-securely-implement-auto-login you have interesting explanation of how stackoverflow https://meta.stackexchange.com/questions/64260/how-does-sos-new-auto-login-feature-work .

java - Lucene - default search lemmatization/stemming -

does lucene default search lemmatization/stemming on words? for example when using code in sample , words in docs used or transformed basic form (i.e. managing -> manag), , if default lemmatizer use? the sample referred in post uses lucene standardanalyzer not stemming. if want use stemming, need use other analyzer implementation e.g.: snowballanalyzer

Custom header to Opencart Information pages -

i trying create custom information pages in open cart, have specific header. have done using piece of code in header.php if (!isset($this->request->get['route']) || (isset($this->request->get['route']) && ($this->request->get['route'] == 'information/information'))) { if (file_exists(dir_template . $this->config->get('config_template') . '/template/common/header_pro.tpl')) { $this->template = $this->config->get('config_template') . '/template/common/header_pro.tpl'; } else { $this->template = 'default/template/common/header_pro.tpl'; }} else { if (file_exists(dir_template . $this->config->get('config_template') . '/template/common/header.tpl')) { $this->template = $this->config->get('config_template') . '/template/common/header.tpl'; } else { $this->template = 'default/template/common...

java - mkdirs() return value for already existing directories -

file.mkdirs javadocs: public boolean mkdirs() creates directory named abstract pathname, including necessary nonexistent parent directories. note if operation fails may have succeeded in creating of necessary parent directories. returns: true if , if directory created, along necessary parent directories; false otherwise my question is: mkdirs() return false if of directories wanted create existed? or return true if successful in creating entire path file, whether or not directories existed? it returns false. from java doc: - true if directory created, false on failure or if directory existed. you should this: if (file.mkdirs()) { system.out.format("directory %s has been created.", file.getabsolutepath()); } else if (file.isdirectory()) { system.out.format("directory %s has been created.", file.getabsolutepath()); } else { system.out.format("directory %s not created.", file.getabsolutepath()); }

javascript - google+ login error. Blocked a frame with origin "http://localhost" -

i applying google+ login in website. when send data service save on database gives me following error: uncaught securityerror: blocked frame origin "http://localhost" accessing frame origin " https://apis.google.com ". frame requesting access has protocol of "http", frame being accessed has protocol of "https". protocols must match. my code is: function fills values in textboxes. , values getting filled correctly. function signincallback(authresult) { if (authresult['status']['signed_in']) { gapi.client.load('plus', 'v1', function() { var request = gapi.client.plus.people.get({ 'userid': 'me' }); request.execute(function(resp) { var googleid = resp.id; var name=resp.displayname isgooglesignup(googleid, function(res) { if (res) { window.location = "profile.php"; ...

c++ - Undefined reference to class method which inherits from template which inherits from QAbstractItemModel -

i having difficulty getting derived classes function project working on. the project using qt. using model-view architecture, , project has number of models, more or less model different business objects share lot of logic. at moment, each model inherits qabstracttablemodel , functions satisfactorily. issue there duplication between these models, , prefer not repeat code multiple times. therefore, have created generic base class, inherits qabstracttablemodel implements common functionality (adding rows databases, executing common business logic, retrieving header data). models views use inherit derived class, , implement table specific functionality (mainly getting , setting data objects represent data). generic base class provides part of functionality, , specific instances of model complete it. so qabstracttablemodel -> qualityitemmodel -> (the various models views use). qualityitemmodel have made template, shared code must work different types. the issue ge...

python - Better way of checking HTTP file extensions requested by clients than if blocks -

i writing http server in python 2.7.8 , check file extension requested before sending respond in if,else blocks. is there better way in python? here code: from basehttpserver import basehttprequesthandler,httpserver #!/usr/bin/python basehttpserver import basehttprequesthandler,httpserver os import curdir, sep import cgi port_number = 8080 class myhandler(basehttprequesthandler): #handler requests def do_get(self): if self.path=="/": self.path="/index_example3.html" try: #check file extension required , #set right mime type sendreply=false if self.path.endswith(".html"): mimetype='text/html' sendreply=true if self.path.endswith(".jpg"): mimetype='image/jpg' sendreply=true if self.path.endswith(".gif"): mimetype=...

clang - Promote "comparison between pointer and integer" from warning to error in Xcode -

i'm developing ios app xcode. have "classic" comparison between pointer , integer warning. it's clear me wrong code , how fix it. i want transform warning full error did example changing from -wincomplete-implementation to -werror=incomplete-implementation however when showing me diagnostic (using reveal in log command), xcode not give other information on specific warning code. know code warning? (and no, not want treat warning errors, it's not goal)

c# - Multiple Ribbons in Outlook Addin -

i have outlook addin need display ribbon in main outlook window , in mail read window well. have added 2 ribbon xml files right markups in them. added c# class implements office.iribbonextensibility interface have implemented getcustomui method returns right xml. did in thisaddin.cs class protected override office.iribbonextensibility createribbonextensibilityobject() { try { _ribbon = new ribbon(); return _ribbon; } catch (exception e) { } return null; } so far good. ribbons load , shows in correct place. now problem ribbon.cs file getting rather huge callbacks live in file. there way split callbacks multiple classes? if have ribbon1.xml , ribbon2.xml can have equivalent ribbon1.cs , ribbon2.cs? ok turns out not possible in vsto model. can have 1 class must have event handlers in it. recommended approach use partial classes , split c...

c# - DispatcherTimer will increasing Interval for every time it's used -

i followed example head first c# on dispatchertimer. first time press button ticker increase 1 second, next time click on button ticker increase 2 seconds every second/tick. third time ticker increases 3 seconds , on (1 second added every button press). why , how "reset" ticker interval increase 1 second every time? here code: dispatchertimer timer = new dispatchertimer(); private void button_click_1(object sender, routedeventargs e) { timer.tick += timer_tick; timer.interval = timespan.frommilliseconds(1000); timer.start(); checkhappiness(); } int = 0; void timer_tick(object sender, object e) { ticker.text = "tick #" + i++; } private async void checkhappiness() { ... code .. timer.stop(); } } } cheers! timer.tick += timer_tick; this line adds method eventhandler everytime press button; in i++ increases one. when have 2 methods doing @ same ...

php - Ajax can't load the data -

actually trying data without refreshing page. below coding done this. here file name config php used connect database index php file code <!doctype html> <html> <head> <title>ajax demo</title> </head> <body> name: <input type="text" name="name"/><br /> <input type="submit" name="name" id="name-submit" value="get data"/> <div id="name-data"></div> <script src="http://code.jquery.com/jquery-1.8.0.min.js"></script> <script type="text/javascript" src="js/getdata.js" ></script> </body> </html> this code getdata js file $('input#name-submit').on('click', function(){ var name = $ ('input#name').val(); if($.trim(name) != ''){ $.post('name.php', {name: name}, function(data) { $('div#name-data').text(...

Firefox add-on description localization -

i've created simple restartless firefox add-on , trying localize it. can not localize add-on name , description. i'm trying descriped here localizing extension descriptions below install.rdf file , package.json package.json { "name": "find_in_files", "title": "find in files", "id": "{7de613b7-54d9-4899-a018-861472402b2e}", "description": "search substring in files", "author": "vitaly shulgin", "license": "mpl 2.0", "version": "1.1", "unpack": "true", "preferences": [ { "name": "searchdirectory", "title": "search directory", "description": "you must specify before search. please, patient - may takes time index documents before search return correct result.", ...

multithreading - On MainForm closure OTL threads do not close -

closing mainform when otl treads still working iomnicancellationtoken not terminate threads. using following taskconfiguration code private canceltoken: iomnicancellationtoken; canceltoken := createomnicancellationtoken; fworker := parallel.foreach(0, calclist.count-1) .taskconfig(parallel.taskconfig.onmessage(self)) .taskconfig(parallel.taskconfig.cancelwith(canceltoken)) .numtasks(nmax) .nowait .onstop(procedure (const task: iomnitask) begin task.invoke(procedure begin fworker := nil; end); end); fworker .execute( procedure (const value: integer) begin calcunit.entrysearch(value); end); form.close canceltoken.signal ; makes form closes , threads go 'parallel.foreach worker' 'idle thread worker' threads not terminate. , program hangs. why threads not terminate? do wrong? do check canceltoken issignalled in code? tasks not forced terminate auto...

ssl - Importing trusted authority key in tomcat -

i want deploy trusted ca key on tomcat, facing problems. went through documentation, , other resources on net, few errors. describe first keys have. server.crt : key provided hosting guys, it's server's key on tomcat there trustedca.crt : ssl key provided ca authorities want deploy. as per documentation, if go , give following command : keytool -genkey -alias tomcat -keyalg rsa and add the trustedca.crt flag -trustcacerts, see exception mozilla saying the key used on site self signed if dont step 1, , plain import trustedca.crt alias tomcat, error follows : ssl_error_no_cypher_overlap i can't figure out doing wrong. tomcat configured use ssl connection following config in server.xml : <connector port="8443" protocol="http/1.1" sslenabled="true" maxthreads="150" scheme="https" secure="true" keystorefile="/home/akshay/keystore/.keystore" keystorepass="password" clienta...

regex - extract comma separated strings -

i have data frame below. sample set data uniform looking patterns whole data not uniform: locationid address 1073744023 525 east 68th street, new york, ny 10065, usa 1073744022 270 park avenue, new york, ny 10017, usa 1073744025 rockefeller center, 50 rockefeller plaza, new york, ny 10020, usa 1073744024 1251 avenue of americas, new york, ny 10020, usa 1073744021 1301 avenue of americas, new york, ny 10019, usa 1073744026 44 west 45th street, new york, ny 10036, usa i need find city , country name address. tried following: 1) strsplit gives me list cannot access last or third last element this. 2) regular expressions finding country easy str_sub(str_extract(address, "\\d{5},\\s.*"),8,11) but city str_sub(str_extract(address, ",\\s.+,\\s.+\\d{5}"),3,comma_pos) i cannot find comma_pos leads me same problem again. believe there more efficient way solve using of above approached. split data ss <- strsp...

indy - idHttp Get + Delphi + The requested URL was rejected -

i'm trying run code: var objhttp: tidhttp; ... objhttp.handleredirects := true; objhttp.allowcookies := true; sget := objhttp.get('http://www.bmf.com.br/arquivos1/arquivos_ipn.asp?idioma=pt-br&status=ativo'); ... and i'm getting this: <code> <html> <head> <title>request rejected</title> </head> <body>the requested url rejected. please consult administrator.<br>your support id is: 109088803187671168</body> </html> </code> any idea why? solution, tlama: var objhttp: tidhttp; ... objhttp.handleredirects := true; objhttp.allowcookies := true; objhttp.request.useragent := 'mozilla/5.0'; sget := objhttp.get('http://www.bmf.com.br/arquivos1/arquivos_ipn.asp?idioma=pt-br&status=ativo'); ...

How to move the layoutFragment up when the soft keyboard is shown in android? -

Image
i have page : but when open softwarekeyboard can't see other edittext . can do? notice : use below code not worked .and class extends fragment ! getactivity().getwindow().setsoftinputmode(windowmanager.layoutparams.soft_input_state_visible|windowmanager.layoutparams.soft_input_adjust_resize); there 2 ways either can use in manifest activity it work ,the adjust-pan flow surface upward , open soft keyboard getactivity().getwindow().setsoftinputmode(windowmanager.layoutparams.soft_input_adjust_pan); <activity android:name="xxxactivity" android:windowsoftinputmode="adjustpan"> </activity>