Posts

Showing posts from July, 2015

angularjs - Angular UI datepicker popup with type-in returns one date earlier than typed in protractor -

this bit complicated, i've verified both angular scenario tester , protractor, , in user interface. set twitter bootstrap 3.x (i'm using latest had 3.0.3 before) - bower boostrap install set angular ui built-in templates (i'm using angular-ui-bootstrap-bower library bower) set datepicker-popup field in angular-ui this: <label for='due_date'>due date</label> <input id='due_date' class='form-control' type='text' datepicker-options="dateoptions" datepicker-popup='yyyy-mm-dd' ng-model="task.duedate"> add button , controller method inspect variable. testing: click on date field, , type in date: 2013-01-05 hit escape or click on field close popup dialog (i.e. don't click done) submit form you'll find date 1 day behind. interestingly, if click on actual date in date picker, correct. including 'today'. if remove ui datepicker, w

ruby on rails - strong parameters doesn't allow to create nested attributes with json. ActiveRecord::AssociationTypeMismatch error -

i have 2 models: conference , talks. conference has_many talks , accepts_nested_attributes_for :talks, :allow_destroy => true params posting looks that: {"id"=>"2", "name"=>"rails4444", "tags"=>"ruby, rails, backbone, javascript", "date"=>"2014-02-22", "organizer"=>"backbonemeetupgroup", "description"=>"conference cool speakers", "talks"=>{"title"=>"fdsf", "video_url"=>"fdsf"}, where setting talks should created in database. my html looks that: <input type="text" name="talks[title]" placeholder="talk title" /> <input type="text" name="talks[video_url]" placeholder="url" /> and when updating conference model talks gives me error: activerecord::associationtypemismatch (talk(#70154003251480) expected,

How do I write javascript cookies from a form and then print the info in an alert or hidden div? -

how use javascript write cookies form fields, , print info in alert or hidden div? here example of have tried far..... <script type="text/javascript"> function cookieform() { document.cookie = "name_first" + encodeuricomponent(document.forms[0].name_first.value); } function printcustomerinfo() { var querydata = decodeuricomponent(document.cookie); var queryarray = querydata.split(";"); if (document.cookie) { window.alert("your info. is:" + queryarray[0]); window.alert[0].name_last.value = queryarray[1].substring(queryarray[1].lastindexof("=") + 1); } } </script> <input type="submit" value="submit" onclick="cookieform(), printcustomerinfo()"/> first, you're missing "=" in cookie string: document.cookie = "name_first=" + encodeuricomponent(document.forms[0].name_first.value); second, querydata has no ";" split by, , no last na

javascript - How can I use the File Writer object in steroids js to write to the local JSON file? -

i'm building application steroids js , i'd able overwrite contents of local json file app gets data upon app's launch. think file writer object need accomplish task i'm not quite of i'm not quite of how can write local json file under www/myapp.json it. information on file writer : http://docs.appgyver.com/en/edge/cordova_file_file.md.html#filewriter details the filewriter object offers way write utf-8 encoded files device file system. applications respond writestart, progress, write, writeend, error, , abort events. each filewriter corresponds single file, data can written many times. filewriter maintains file's position , length attributes, allow app seek , write anywhere in file. default, filewriter writes beginning of file, overwriting existing data. set optional append boolean true in filewriter's constructor write end of file. text data supported platforms listed below. text encoded utf-8 before being written filesystem. platforms support

audio - Change the «voice» played with a button in iOS app -

i have soundboard app says phrases, want able change male/female voice, thing have no idea how make this. appreciated. i'm using avfoundation/avaudioplayer play sounds. thank you! can bit hard ! you need change pitch of voices, if raise have higher pitch (can defined female), if decrease pitch give low sound (can defined male)! the simplest way playing áudio in different sample rate, change speed of audio :-( the hard , right way build pitch shift algorithm, can done in time domain (psola, sola, wsola) or in frequency domain (phase vocoder) ! some of these techniques can disfigure original voice (can change phase , envelope) looking artificial, can especific question methods in https://dsp.stackexchange.com/ more detailed answer !

asp.net - Is It Possible to stop a server request manually while the request is being processed by the server -

i using asp.net , ajax functionalities make requests server via web services search functionality. on click of search button, making screen inactive displaying loading image on it. issue searches takes longer time, , user forced wait till results fetched. there way search can cancelled manually, button click while search being performed server. any or alternates appreciated. one thing can try set timeout on ajax call, take here: asp-net-page-webmethod-ajax-call-request-timed-out another thing use javascript settimeout display user message after few seconds saying "its taking long. wait results or abort?" "abort" link refreshes page.

shell - How to print out pdf file with script generated highlighted output? -

Image
i've been used pidcat jakewharton see log of app: $ pidcat [org.test.myapp] and redirect file: $ pidcat [org.test.myapp] > ~/dev/myapp_log the pidcat generate pretty highlighted content try keep in pdf file. i've tried: $ cupsfilter ~/dev/myapp_log ~/dev/myapp_log.pdf but generate plain white text pdf. how keep beautiful highlight format in pdf file? p.s. it's long log. can't print screen.. this how original output like: and here's partial pidcat output opened default text editor on mac: [107m [0m process created broadcast com.nortek.app/org.videolan.vlc.phonestatereceiver [107m [0m pid: 9718 uid: 10157 gids: {50157, 3003, 1028, 1015} [101m [0m process 9718 ended [107m [0m process created activity com.nortek.app/.ui.activity.dummymainactivity [107m [0m pid: 2840 uid: 10157 gids: {50157, 3003, 1028, 1015

Can not remove underline of a element css -

i'm working on site https://stagetoday.squarespace.com/ . in left bottom corner, there link, can't remove text-decoration:underline when hover on it. i tried text-decoration:none , text-decoration:none!important still stays. can me? it border #bottombar a:hover { border: none; } or link .sqs-block-content a:hover { border: none; }

pdf signature requires validation vs signature has problems -

anybody, please explain what's difference between signatures. when open 1 pdf document - adobe acrobat 9 shows message "at least 1 signature has problems" if open other pdf message "at least 1 signature requires validating". seems both pdfs signed self-signed certificates, messages not same. difference extremely significant our business. please help. making comment actual answer at least 1 signature has problems implies adobe acrobat has tried verify signature failed doing so. at least 1 signature requires validating implies adobe acrobat has not tried verify signature and, therefore, has not yet decided whether fail or not. whether or not adobe reader / acrobat tries verify signature depends on filter , subfilter entries of signature dictionary: if reader / acrobat knows them, automatically tries verify signature (unless configuration settings changed). if knows subfilter not filter , not try verify automatically @ least offers verif

How Much Faster is StringBuilder respect of concat operator + in C# .Net -

this question has answer here: stringbuilder versus string concat 6 answers how faster stringbuilder respect of concat operator + in c# .net how work @ low level work faster concat? the microsoft developer network has great comparison: although stringbuilder , string both represent sequences of characters, implemented differently. string immutable type. is, each operation appears modify string object creates new string. for example, call string.concat method in following c# example appears change value of string variable named value. in fact, concat method returns value object has different value , address value object passed method. note example must compiled using /unsafe compiler option. routines perform extensive string manipulation (such apps modify string numerous times in loop), modifying string repeatedly can exact si

ios - addTarget:action:forControlEvents: unrecognized selector sent to instance - uibutton in uitablecell -

* edit: sorry, realised - code working fine, until made table have 3 sections. when single section section headings evrything worked fine when scrolling. have theree sections crashes when scrolling.* i'm adding button uitablecell. crash occurs when table contents extend beyond table height, , table scrolled extreme bottom. from error looks if uibutton isn't being created, reports jobscell instead... also layout in custom uitablecell goes awry. looks jobscell class isn't being initiated cells need reused , displayed on screen? 2014-03-20 15:20:32.080 myapp[52350:60b] mapbtn: <uibutton: 0xa89aff0; frame = (0 0; 59 59); opaque = no; autoresize = rm+bm; tag = 12; layer = <calayer: 0xa89b1a0>> 2 1 2014-03-20 15:20:32.313 myapp[52350:60b] mapbtn: <uibutton: 0xa460620; frame = (0 0; 59 59); opaque = no; autoresize = rm+bm; tag = 12; layer = <calayer: 0xa469b60>> 0 11 2014-03-20 15:20:33.512 myapp[52350:60b] mapbtn: <jobscell: 0xa7

c++ - Are there any undefined behavior issues when moving data into a function and then back out to where it came from? -

consider following function: std::vector<int> pushit(std::vector<int> v){ v.push_back(10); return v; } int main(){ std::vector<int> vec; vec = pushit(std::move(vec)); } my assumption vector moved function, modified , moved original spot. should result in simmilar behavior passing in non const reference. seems quite valid behavior colleague fears undefined behavior. there missing here? i because current function void currentpushit(std::vector<int>& v){ v.push_back(10); } has led lot of problems in code review because people overlook fact innocent call currentpushit(v) can invalidate iterators. making them write v=pushit(std::move(v)) should wake them enough don't make same mistakes. per 1.9p15, value computations , side effects associated argument sequenced before execution of body of function. time enter pushit source vec has been moved from. assignment sequenced after execution of pushit , since calli

codenameone - How do you get ActionBar from SocialBoo theme to show up in your GUI? -

Image
ok. starting on this. see socialboo theme has similar in want achieve. if find can work , improve. added new socialboo theme , created blank gui. assumed commandbehavior didnt trick, did adding tabs . seems components not specific bar... did notice issue. how social actionbar displayed in socialboo theme ? (screen shot). assuming images etc part of default theme, right. also, if create touchcommand = bar, title or native . displays fine in gingerbread not ics. know why that? (screen shot) thanks, in advance. those images aren't part of theme, part of specific demo. if add tabs component center of border layout ui thee tabs "icon" property allow customize unselected icon , can customize selected icon well. can see full source/resource file of social boo demo in docs , demos zip in download section . generally customizing commands bit complex because of platform specific constraints, when running on actual android 4 device use native actionbar def

ios - Load certain information from array index obj c -

i have array loads information plist so: nsmutablearray *array = [[nsmutablearray alloc] initwithcontentsoffile:@"items.plist"]; here how plist looks like: <array> <dict> <key>string</key> <string>str</string> <key>id</key> <string>0</string> </dict> <dict> <key>string</key> <string>str2</string> <key>id</key> <string>1</string> </dict> <dict> <key>string</key> <string>str3</string> <key>id</key> <string>2</string> </dict> <dict> <key>string</key> <string>str4</string> <key>id</key> <string>35</string> <key>data</key> <string>5</string> </dict> </array> i have created for-loop creates uibutton every string there in plist,

java - Unmarshall Solr Spellcheck results from JSON -

i have solr server working, including effective spellcheck component in main query parser. i'm building set of json unmarshalling classes (in java) convert query responses data other elements of our webapp interpret. problematically, query tokens returned json properties. these dynamic , unable predetermined in code. complicated fact other 2 results on same level cannot parsed similar objects, 1 boolean determination of correct spelling, , other top spelling suggestion produced collation. while ignore them, top element of collator presents effective spelling suggestion, nice able unmarshal these elements, include spelling suggestions each specific term. is there way pass in query tokens (eg, pass in args @ query time interpreted json properties) solr json unmarshaller property names type of java object build parse these suggestions? if not, don't need them. seems tiny bit absurd construct json that's unparseable pojo. here's example of spellcheck

java - How to use the the license-maven-plugin -

i use license-maven-plugin in order able generate license headers project. so have following pom.xml: <?xml version="1.0" encoding="utf-8"?> <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelversion>4.0.0</modelversion> <groupid>org.foo</groupid> <artifactid>bar-parent</artifactid> <version>1.0-snapshot</version> <packaging>pom</packaging> <name>bar: parent</name> <licenses> <license> <name>apache 2.0</name> <url>http://www.apache.org/licenses/license-2.0.txt</url> <distribution>repo</distribution> <comments>a business-friendly os

Managing Reports in Android -

i have scenario have show huge report consists of 16 fields, , last field consists of radio group. i've taken table layout this. problem is, don't know size of each field. mean, there 50 characters in one, , 2 in another, , have adjust width , height basing on without loosing , feel criteria. example,the first column serial no may contain 4 digits max, second column contains id may 20 digit number , on. can use wrap content, making page clumsy! so, question is, there possibility fields can automatically set width , height basing on length of characters.thanks in advance! appreciated!

debugging - How to debug firefox extension after cfx run? -

i want debug firefox extension. set javascript.options.showinconsole = true devtools.chrome.enabled: true devtools.debugger.remote-enabled: true run in sdk console cfx run, after go web developer -> browser toolbox incoming connection , see extension main.js . after that, code in main.js been executed. how debug after cfx run? bug 899054 - [meta] implement add-on debugger this really close landing (the ui bits in bug 911098 in m-c), if grab nightly tomorrow, or day after, should in there, , might work (for undefined value of "work").

How to find mode from an array -

i have been trying prototype finding mode of array work not returning right thing, please tell me doing wrong. int mode(int array[], int size) { int x; int mode = 0; int largest = 0; (x = 0; x < size; x++) { if (array[x] > largest) { largest = array[x]; mode = x; } } return mode; } first of if that's c++ arrays numbered 0, x should 0 in for. x should checked against < size. other code good.

javascript - Trigger jQuery validation from address bar -

i'm writing coded ui test , want test web frontend. purpose want trigger jquery validation without having click submit button. possible browsers address bar? tried javascript:($('form').validate()) gives me blank page "[object object]" you can call valid() method validate form, given validator initialized form $('form').valid()

c++ - Function pointer in Template -

in old code seeing function pointer used in template: typedef int (*get_max)(); template<get_max func> get_max func() { return func; } as new template, lost , trying google more same theories how possible. link of book described? in advance global functions have known addresses of known sizes, can used in compile-time expression, e.g. template parameters. on standard x86 platforms address has 32 bits, on x64 - 64 bits (that's why storing shouldn't use int , has 32 bits on both platforms, rather intptr_t ). so code doing returning pointer function func function has been specialised for. internally, returns address of passed function. may have confused function names decay function pointers (i.e. don't have use & function's address) you can create template parameter being address of global non-static variable, if in these kind of things. helps understand what's going on in original example. #include <iostream> #include

Not sure how to fix PHP error -

i have created php script , keep on getting "wsod". have turned on error reporting not appear working. decided run script through online php checker , gave me error: "parse error: syntax error, unexpected 'index' (t_string) in code on line 6". not sure how solve , hoping able me. <?php if ($username && $userid) { echo "you logged in <b>$username</b>."; } else { $form = "<form action="index.php" method="post"> <table> <tr> <td>username:</td> <td><input type="text" name="username"/></td> </tr> <tr> <td>password:</td> <td><input type="password" name="password"/></td> </tr> <tr> <td><input type="submit" name="lo

kendo ui form update cancel button -

i trying simple kendo ui form 'save' , 'cancel' buttons. using kendo.observable bind data form. functionality trying achieve is, if 'save' button clicked, form data saved. else, if 'cancel' clicked form come read-only mode previous data present. this, first saving model data in 'originalvalue' property on click of update button. if 'cancel' clicked, 'fields' model data restored 'originalvalue'. issue , 'originalvalue' not contain original value. gets updated when user editing during 'save'. question - how retain original model data can refreshed on cancel? please find below code. appreciate help, thanks. <script type="text/javascript"> var viewmodel = kendo.observable ({ updated: false, originalvalue: {}, update: function(e) { var original = this.get("fields"); this.set("originalvalue", original); thi

Sequence of Project Deployment in Mule -

does know in sequence, mule project loaded when mule starts-up? doesn't seem in alphabetical order or last updated time. if @ class muledeploymentservice , can see following: string appstring = (string) options.get("app"); if (appstring == null) { string[] explodedapps = appsdir.list(directoryfilefilter.directory); string[] packagedapps = appsdir.list(zip_apps_filter); deploypackedapps(packagedapps); deployexplodedapps(explodedapps); } else { string[] apps = appstring.split(":"); description method file.list states "there no guarantee name strings in resulting array appear in specific order". so, guess answer in no particular order, or in order listed in using -app option.

c - When I try to use scanf with 2 arrays I get an error -

i trying use scanf assign values 2 arrays, 1 x coordinate, , other 1 y, using code that: for (i1=1;i1<n;i1++) { scanf ("%f%f",&(arx[i1], ary[i1])); } but when execute error: prog.c: in function ‘main’: prog.c:11:25: warning: left-hand operand of comma expression has no effect [-wunused- value] scanf ("%f%f",&(arx[i1], ary[i1])); ^ prog.c:11:16: error: lvalue required unary ‘&’ operand scanf ("%f%f",&(arx[i1], ary[i1])); so don't know doing wrong here, new c change scanf ("%f%f",&(arx[i1], ary[i1])); // not valid syntax to scanf ("%f%f",&arx[i1], &ary[i1]); you need apply & operator each of arx[i1] and ary[i1] otherwise , in (arx[i1], ary[i1]) interpreted compiler comma operator , hence return r-value. , should know operand of unary & must l-value.

php - laravel 4 - multiple routes to the same controller -

i trying avoid code: route::get('/', array('as' => 'create_content', 'uses' => 'samecontroller@create')); route::get('create_content', array('as' => 'create_content', 'uses' => 'samecontroller@create')); and combined them 1 route. because controller same. so controller active when u go index "/" , "create_content". and if here - maybe can elaborate me purpose of "as" in array? thanks! in laravel you're not restricted static values paths. can use {}'s denote variable. adding ? after variable name makes variable optional. these variables passed routing method (in case, "create" method of samecontroller). this can combined method pull off want. method allows define regex restrictions on what's allowed variable. another alternative use route::pattern, more "global" version of where(). i've included exam

git - How to add files/folders to .gitignore in IntelliJ IDEA? -

i try switch eclipse intellij idea. have project uses git , want add files .gitignore file. in eclipse can right click on file/directory , choose ' add .gitignore '. is there in intellij idea or have edit file manually? edit : intellij has plugin of (2016): https://plugins.jetbrains.com/plugin/7495?pr=idea . @ answer below biniam_ethiopia original answer far can see intellij has no option click on file , choose "add gitignore" eclipse has. the quickest way add file or folder gitignore without typos is: right-click on file in project browser , choose "copy path" (or use keyboard shortcut displayed there) open .gitignore file in project, , paste. adjust pasted line relative location of .gitignore file additional info : there ".gitignore" plugin available intellij adds "add .gitignore" item popup menu when right-click file. works charm. to install plugin, go "settings -> plugins", click on "br

Unable to host WCF Service, Throwing an error as System.Threading.Tasks is not supported -

Image
in vs 2013, setting wcf service. getting error " operation not supported in wcf test client because uses system.threading.tasks " if synchronous methods working service working fine. problem having fact wcf test client not support methods return task, must either use synchronous methods built in client or write own client uses asynchronous methods test service.. there nothing can "fix" make wcf test client work asynchronous methods.

sprite kit - iAd Freezes App iPhone 5[s][c] -

my team , finished our first app, , ran problem iad. we're still using apple developer ads; if tap on ad, close out of ad , click on node crashes app, seems happening on iphone 5[s][c] though, know causing this? edit: we're using spritekit.

android - How to trigger selectors from the layout view? -

the problem suppose have view inside layout view, , wish each touching event on layout affect view's background selector. for example, when touch layout , selector of view choose state_pressed state. what i've tried i've read duplicateparentstate , addstatesfromchildren , think it's opposite of i'm searching for. i've tried use splitmotionevents, didn't help. the question how do this? also, should done in case layout inside listview (as item within it) ? consider have spinner inside linear layout. make focusable property of view(here spinner) false. , onclick of linear layout call performclick on view(spinner in case). edit: in focus change listener of linear layout if has focus, call requestfocus on view. can follow same method other states of view another method: do not apply selector layout(linearlayout in case) , add whatever selector want view(spinner in case). view add parameter android:duplicateparentstate=&q

python - Adding a dictionary inside a dictionary error -

i used answer here: syntax creating dictionary dictionary in python base used. i, however, syntax error , can't see why. player.image_dict = {( 0,2,0,0,0,0): {'idle' : itertools.cycle [(pygame.image.load("images/egg_1.png"), pygame.image.load("images/egg_2.png"), pygame.image.load("images/egg_3.png")] }, ( 2,4,0,0,2,5): {'idle' : itertools.cycle ([pygame.image.load("images/leaf_1.png"), pygame.image.load("images/leaf_2.png"), pygame.image.load("images/leaf_3.png"), pygame.im

sql server - Update trigger that affects only modified columns -

i trying create trigger update columns if value has been changed. i've read done comparing inserted , deleted tables. below how i'm trying comparison. is there other way? think select queries , if statements can nested in ways, can't figure out how. create trigger [dbo].[tr_persoane_update] on [dbo].[persoane] after update begin set nocount on; declare @dfirstname varchar(30), @ifirstname varchar(30), @dlastname varchar(30), @ilastname varchar(30) select @dfirstname=d.firstname, @dlastname=d.lastname deleted d select @ifirstname=i.firstname, @ilastname=i.lastname inserted if @dfirstname <> @ifirstname begin update firstname set firstname = @ifirstname firstname = @dfirstname end if @dlastname <> @ilastname begin update lastname set lastname = @ilastname lastname = @dlastname

signalr - Does ChatJS support Facebook style friends list? -

i want use chatjs in same way facebook does. way anticipate achieving have 1 chatroom added it. users contact list filtered in network. is there issue doing this? best way achieve if i'm wrong? method scale well? the facebook style rooms being developed now. it's on june 15th. functionality going implemented way: if developer chooses use fixed room, users in room presented way facebook displays friends. not need choose rooms, , default room enter automatically. it's not going possible broadcast messages entire room. i'll update answer gets finished.

asp.net mvc 4 - MVC 4 RouteConfig -

i have mvc 4 web project , wrote code in routeconfig.cs public static void registerroutes(routecollection routes) { routes.ignoreroute("{resource}.axd/{*pathinfo}"); routes.maproute( name: "default", url: "{controller}/{action}/{id}", defaults: new { controller = "home", action = "index", id = urlparameter.optional } ); routes.maproute( "course", "{controller}/{courseid}", new { action = "index" } ); } and want link [site-root]/course/15 not working (http 404 error). how can solve problem? thanks seeing "course" type of resource you're trying set up, i'd create coursecontroller e.g. index action , set in routeconfig this: routes.maproute( "course", "course/{courseid}", new { action = "index

python - solve an equation containing integrals -

i need solve integral equation embedded integral equation python 3.2 in win7. there 2 integral equations. the code here: import numpy np scipy.optimize.minpack import fsolve numpy import exp scipy.integrate.quadpack import quad import matplotlib.pyplot plt import sympy syp lb = 0 def integrand2(x, a): print("integrand2 called") return x**(a-1) * exp(-x) def integrand1(x, b, c): print("integrand1 called") integral , err = quad(integrand2, lb/b, syp.oo , args=(1+c)) return c/(b*integral) def intergralfunc1(b,c): integral,err = quad(integrand1, 0, 10, args=(b,c)) print("integral ", integral, " , err ", err) print("b ", b, " , c ", c) return 10 - integral def findguess(): vfunc = np.vectorize(intergralfunc1) f1 = np.linspace(0.01, 10,10) f2 = np.linspace(0.01, 10,10) result = vfunc(f1, f2) plt.plot(f1, result) plt.xlabel('f1') plt.subplot(211)

javascript - How taking the value of a href attr in a div -

this question has answer here: jquery: how value of html attribute? 6 answers i have link, how can value of alt attr in href ? (1) <div class="user_line"> <img class="delete_user" src="images/close_button_mini.gif"> <a class="chat_user" alt="1|test" href="#">test</a> </div> // $this $('.delete_user').live('click',function(){ } thanks you can take alt var alt=$('.chat_user').attr('alt');

angularjs - jasmine: Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL -

i have angular service called requestnotificationchannel : app.factory("requestnotificationchannel", function($rootscope) { var _delete_message_ = "_delete_message_"; function deletemessage(id, index) { $rootscope.$broadcast(_delete_message_, { id: id, index: index }); }; return { deletemessage: deletemessage }; }); i trying unit test service using jasmine: "use strict"; describe("request notification channel", function() { var requestnotificationchannel, rootscope, scope; beforeeach(function(_requestnotificationchannel_) { module("messageappmodule"); inject(function($injector, _requestnotificationchannel_) { rootscope = $injector.get("$rootscope"); scope = rootscope.$new(); requestnotificationchannel = _requestnotificationchannel_; }) spyon(rootscope, '$broadcast'); }); it("sh

android - SQLite datatbase data not inserting -

in android code inserting data database gcm intent.it working when inserting without checking condition.when check first element of json object received if statement data not inserting.i think error if condition.please me protected void onmessage(context context, intent intent) { log.i(tag, "received message"); string message = intent.getextras().getstring("title"); if (message == "instru"){ string message1 = intent.getextras().getstring("price"); string message2 = intent.getextras().getstring("price1"); string message3 = intent.getextras().getstring("price2"); string message4 = intent.getextras().getstring("price3"); string message5 = intent.getextras().getstring("price4"); databasehandler1 db = new databasehandler1(getapplicationcontext()); int count = db.getrowcount_1(); if(count > 0){ db.reset

Getting segmentation fault with c++ pointers -

so i'm trying familiarise myself c++ pointers running following code. #include <iostream> using namespace std; int main(void){ int* x; cout << &x << endl; return 0; } which works fine , prints pointer value of x but #include <iostream> using namespace std; int main(void){ int* x; *x = 100; cout << &x << endl; return 0; } gives me segmentation fault when try tun it. why this? don't see how line should change address of x. and prints pointer value of x but not exactly. std::cout << &x; prints x 's address (the pointer's address); std::cout << x; prints address, x points to; std::cout << *x; prints x points to; int* x; *x = 100; here, x pointer, need allocate memory 100 . example int* x = new int; *x = 100; std::cout << *x; or just int* x = new int( 100 ); std::cout << *x; without allocating memory , leaving x

java - Can Kitkat HCE(NFC) device talk to another Kitkat HCE(NFC) device -

can kitkat hce(nfc) device talk kitkat hce(nfc) device? i want write apps transfer data 1 kitkat hce(nfc) device kitkat hce(nfc) device. if code present what ask not make sense. if both devices operate in card emulation mode, can't communicate directly each other. nfc has 3 operating modes: reader/writer mode: nfc device can read/write nfc tags , interact contactless smartcards. peer-to-peer mode: 2 nfc device can communicate directly each other. card emulation mode (either secure element or through software card emulation/hce): nfc device acts contactless smartcard , can therefore interact legacy contactless smartcard readers (or nfc devices in reader/writer mode). thus if 1 of devices should use android hce, other device need operate in reader/writer mode. android devices use peer-to-peer mode (specifically snep on llcp) default, other device need device android 4.4+. second device need disable peer-to-peer mode , card emulation mode , explicitly pu

java - Why do I get ProviderMismatchException when I try to .relativize() a Path against another Path? -

[note: self answered question] i have opened filesystem zip file using java.nio. have gotten path filesystem: final path zippath = zipfs.getpath("path/into/zip"); now have directory on local filesystem have obtained using: final path localdir = paths.get("/local/dir") i want test whether /local/dir/path/into/zip exists, check existence using: files.exists(localdir.resolve(zippath)) but providermismatchexception . why? how fix this? this behaviour documented, albeit not visible. have delve java.nio.file package description see, right @ end, that: unless otherwise noted, invoking method of class or interface in package created 1 provider parameter object created provider, throw providermismatchexception. the reasons behaviour may not obvious, consider instance 2 filesystems can define different separator . there no method in jdk there. if filesystems use same separator can work around using: path1.resolve(path2.tostring())

symfony - How to use service method in Doctrine QueryBuilder -

i'm doing quite big symfony2 project (unfortunately on database structure cannot modify) , i'm stuck this: i have user entity contains (amongst other fields) username field. i have profilefield entity corresponds fields user (like firstname or lastname, favourite color or whatever ask user about). finally there configservice, get's value key database. in particular case it's little config value called 'username_format'. can take 1 of 3 values: 'username', 'firstname' or 'firstnamelastname'. depending on value need display formatted username. if value 'username' - i'm returning username field value user entity. both 2nd , 3rd case, when need custom profilefield corresponding particular user, i've created simple service (called usernameformatservice) has configservice injected , method called getnamefromid($userid). method checks config value , pulls correct values correct user. works nice, but... i have blog o

c++ - Scheduling file operations in embedded Linux -

Image
i'm sniffing wifi packets rssi (my interest probe request , data null, timestamp , source mac address), , need save results in pcap files further processing. the problem need divide info multiple different files, creating 1 file per hour. don't have idea how check elapsed time in program, except multithreading ( while(1) , sleep() , check clock() function). i'm using ubuntu, target platform router linux openwrt installed. my first concert problems cross compilation + pthread.h , thread.h or else, or maybe there should no issues in openwrt? and other side of question - isn't complicated use multithreading silly problem? maybe there other solutions? (i.e. small pseudo-multithreading solution, or simpler tricks)? you should use cron: cron system daemon used execute desired tasks (in background) @ designated times. basically, define script executed every hour syntax: 0 */1 * * * /path/to/script.sh check here more info: https://help.ubun

javascript - Kendo UI grid not refresh automatically in Internet Explorer -

i created project using kendo ui grid, works in chrome , mozilla. grids can refresh automatically. in explorer, can't! first time (when page open first time) datasource work (script), datasource not work in refresh time. this 2 scenario, grid can not refresh: when return "edÄ°tpage", can see updated values in grid. in chrome , mozilla, can see. i have automatic refresh command named setinterval , grid can not refresh again in explorer. can refresh in chrome , mozilla. setinterval(function () { $("#grid").data("kendogrid").datasource.read(); }, 10000); /// not work! $(document).ready(function () { $("#grid").kendogrid({ sortable: true, pageable: { input: true, numeric: false, buttoncount: 5, pagesizes: true }, autobind: true,

css - Why is HTML span stacking vertically? -

on website have 2 spans : "services" , "products" in top right corner (in gray strip). reason being stacked vertically, expect them align horizontally, since spans markup marksup text inside text block. snippet : <div id="access"> <div> <a href="#"> <span>services </span> </a> <a href="#"> <span>products</span> </a> </div> </div> this css problem think #access { /* background: #74c20e; background: #716417;*/ display: block; float: left; margin: 5px auto; background-color:rgb(181, 197, 207); -moz-border-radius: 0px; border-radius: 0px; width: 1200px; <!-- width: 940px; --> } #access .menu-header, div.menu { font-size: 13px; margin-left: 12px; width: 928px; } #access .menu-header ul, div.menu ul { list-style: none; margin: 0; } #access .menu-header li, div.men

excel - VLOOKUP not finding match -

i trying find data in excel table using vlookup. column getting source value, believe comes html page cut , paste. although data exists in search table, not found. if manually type same search data on the original column source data, found. is possible there hidden html info in there? how clear out? additionally, lookup value lastname, firstname: smith, sam example. think space after comma nbsp, don't know how figure out. for sake of answer, op: nbsp ascii 160. =trim(substitute(d1,char(160),char(32))) will turn regular space.

c++ - Qt: How to display QComboBox inside QTableWidgetItem? -

i’m trying display qcombobox inside qtablewidgetitem setting child, using code: qcombobox* qcb; int r,c; //...... qcb->setparent((qwidget*)tablewidget->item(r,c)); but didn’t job. so how fix that? thanks. you via qtablewidget object itself. firstly create qcombobox then call void qtablewidget::setcellwidget ( int row, int column, qwidget * widget ) http://qt-project.org/doc/qt-4.8/qtablewidget.html#setcellwidget

mapreduce - Hadoop Basics:Number of map tasks mappers reduce tasks reducers -

what difference between mapper , map task? similarly, reducer , reduce task? also, how number of mappers,maptasks,reducers,reducetasks determined during execution of mapreduce task? give interrelationships between them if there any. simply map task instance of mapper. mapper , reducer methods in mapreduce jobs. when run mapreduce job, number of map tasks spawned depends on number blocks(number of blocks depend on input splits) in input. number of reduce tasks can specified in mapreduce driver code. either can specified setting property mapred.reduce.tasks in job configuration object or org.apache.hadoop.mapreduce.job#setnumreducetasks(int reducercount); method can used. in old jobconf api setnummaptasks() method there. setnummaptasks() method removed in new api org.apache.hadoop.mapreduce.job with intension of number of mappers should calculated based on input splits.

bash - How to retrieve digits including the separator "." -

i using grep string this: ans_length=266.50 use sed digits: 266.50 this full command: grep --text 'ans_length=' log.txt | sed -e 's/[^[[:digit:]]]*//g' the result : 26650 how can line changed result still shows separator: 266.50 you don't need grep if going use sed . use sed' // match lines need print. sed -n '/ans_length/s/[^=]*=\(.*\)/\1/p' log.txt -n suppress printing of lines not match /ans_length/ using captured group print value next = sign. p flag @ end allows print lines matches our // . if grep happens support -p option can do: grep -op '(?<=ans_length=).*' log.txt (?<=...) look-behind construct allows match lines need. requires -p option -o allows print value part.

Does PostgreSQL have a pseudo-column like "LEVEL" in Oracle? -

does postgresql have pseudo-column "level" in oracle? if not, how can create column similar "level"? well, first of all, postgres not have hierarchical queries . no connect by , therefore no level . you can similar things recursive cte , level column that's incremented every recursion. query in oracle: select employee_id, last_name, manager_id, level employees connect prior employee_id = manager_id; .. translated recursive cte in postgres: with recursive cte ( select employee_id, last_name, manager_id, 1 level employees union select e.employee_id, e.last_name, e.manager_id, c.level + 1 cte c join employees e on e.manager_id = c.employee_id ) select * cte;

html - make a div inside a div -

i've below html code. <!doctype html> <html lang="en" xmlns="http://www.w3.org/1999/xhtml" style="margins"> <head> <meta charset="utf-8" /> <style type="text/css"> .main { width: 900px; height: 320px; border: 1px solid black; position:relative; } .margins { padding:10px 10px 10px 10px; border: 1px solid black; } .top_h { width: 720px; height: 80px; border: 1px solid black; } .mid { display: inline-block; clear: both; margin-top: 10px; margin-bottom: 10px; border: 1px solid black; } .mid_l { width: 200px; height: 120px; float: left; margin-right:10px; border: 1px solid black; }