Posts

Showing posts from June, 2013

c# - Showing near guesses that exist in the grammar? -

c# - Showing near guesses that exist in the grammar? - microsoft sapi speechrecognitionengine know, not accurate speech recognition engine out there. in event of programme not recognizing speech correctly, there way user notify application application recognized speech incorrectly? or how can display near guesses exist in speech grammar similar speech uttered? for example: speaking words: "read entire book" engine recognizes as: "read enrich book" the user should able click on button says: "incorrect guess" and application shows list of words similar user can select he/she said , maybe programme can larn mistake? program displays: "words in grammar similar: enrich, enhance, entire, encapsulate i know similar machine learning , neural network training, if this, create sapi work better. answers please? alternates available dictation recognitions. 1 can ask alternates grammar-based recognitions, engine doesn&#

How to insert two lines for every data frame using awk? -

How to insert two lines for every data frame using awk? - i have repeating info follows .... 4 4 4 66 79 169 150 0 40928 40938 40923 40921 40789 40000 40498 5 4 3 16 22 247 0 40168 40911 40944 40205 40000 40562 6 4 4 17 154 93 309 0 40930 40919 40903 40917 40852 40000 40419 7 3 2 233 311 0 40936 40932 40874 40000 40807 .... this info made of 115 info blocks, , each info block have 4000 lines format. here, hope set 2 new lines (number of line per info block = 4000 , empty line) @ begining of each info blocks, looks 4000 1 4 4 244 263 704 952 0 40936 40930 40934 40921 40820 40000 40570 2 4 4 215 172 305 33 0 40945 40942 40937 40580 40687 40000 40410 3 4 4 344 279 377 1945 0 40933 40915 40907 40921 40839 40000 40437 4 4 4 66 79 169 150 0 40928 40938 40923 40921 40789 40000 40498 ... 3999 2 2 4079 4081 0 40873 40873 40746 40000 40634 4000 1 1 4080 0 40873 40923 40000 40345 4000 1 4 4 244

Spring Data java.lang.NoSuchMethodError in grails -

Spring Data java.lang.NoSuchMethodError in grails - i using mongo db plugin , spring-data-neo4j in grails application. i using latest version of sdn , mongo db plugin. here buildconfig : grails.servlet.version = "3.0" // alter depending on target container compliance (2.5 or 3.0) grails.project.class.dir = "target/classes" grails.project.test.class.dir = "target/test-classes" grails.project.test.reports.dir = "target/test-reports" grails.project.work.dir = "target/work" grails.project.target.level = 1.6 grails.project.source.level = 1.6 //grails.project.war.file = "target/${appname}-${appversion}.war" grails.server.port.http = 1111 grails.project.fork = [ // configure settings compilation jvm, note if alter groovy version forked compilation required // compile: [maxmemory: 256, minmemory: 64, debug: false, maxperm: 256, daemon:true], // configure settings test-app jvm, uses daemon default test: [

How to determine space and time complexity of an algorithm? -

How to determine space and time complexity of an algorithm? - i have algorithm, not sure time , space complexity. , for (i = 1 n ) begin r(xi) = random(o, xi, r) i++ end what time , space complexity in above algorithm , why? thanks space , time complexity in proportional size of input. suppose there input array of size n , processing each element once, time complexity o(n) . if utilize info construction store , process intermediate results, array of size n , space complexity o(n) . there many notations complexity , different complexities such log n, n, n^2, n^3, n! . for code time complexity o(n) , space complexity depends on whether have defined( o(n) ) r or passed( o(1) ) parameter. refer here more analysis of algorithms algorithm time-complexity space-complexity

data structures - git: DAG vs. tree? -

data structures - git: DAG vs. tree? - i've read git uses directed acyclic graph (dag) info structure, each commit node, , things branches , tags pointers nodes. but when seek visualize commit history using tools gitk, looks more tree graph since every parent-child relationship directed 1 way. so, what's difference between dag , tree, regards git? but when seek visualize commit history using tools gitk, looks more tree graph since every parent-child relationship directed 1 way. a dag, tree, can laid out such parent-child relationships one-way. difference between them nodes in dag can have multiple parents. mutual case of in git when merge. merge commit have of commits merged parents. tree doesn't allow nodes have multiple parents. (image source) notice how merge commit c6 has 2 parents, c4 , c5. git data-structures

html - How to debug Font-Awesome icons? -

html - How to debug Font-Awesome icons? - i have been using font-awesome , icons while now, , has been working fine. today, however, displays blank squares instead of icons. have read many other related questions, none of cases apply me. said, worked before, , did not create changes font-awesome files (i using downloaded version of fa, not cdn) or html templates display icons. so want start debugging process. 1 illustration this: <i style="color: orange" class="fa fa-exclamation-triangle"></i> however, cannot find urls in css of affected elements, when inspecting chrome. see on every icon element though, this: .fa-warning:before, .fa-exclamation-triangle:before { content: "\f071"; } where \f071 "blank square" character. so question is: where icons come from, , how can debug no-show fa icons, in general? update i found out \f071 , friends symbols referring icons, stored in font files. fact show blan

ios - NSURLRequest returning nil -

ios - NSURLRequest returning nil - i performing simple download of info json service. when invoked request returns nil response object. seems same code i've used several times, stumped why request returns nil. have verified generated url valid , homecoming data. missing obvious? thanks! nsstring *serviceendpoint = [nsstring stringwithformat:@"http://waterservices.usgs.gov/nwis/iv/?sites=%@&period=pt%luh&format=json", guageid, hours]; nsurlrequest *request = [nsurlrequest requestwithurl:[nsurl urlwithstring:serviceendpoint]]; nsdata *response = [nsurlconnection sendsynchronousrequest:request returningresponse:nil error:nil]; // response nil @ point nsdictionary *rvdata = [nsjsonserialization jsonobjectwithdata:response options:0 error:&jsonerror]; you're totally disregarding nserror , nsurlresponse populated sendsynchronousrequest method. first, add together check inquire whether nserror has been populated (if nsurlresponse if nil),

c# - User Control button click not working as expected -

c# - User Control button click not working as expected - i have created user command should deed button in windows forms application. it looks public partial class controlbutton : usercontrol { .. .. public controlbutton(string id) { initializecomponent(); this.click += new eventhandler(controlbutton_click); this.mouseenter += new mouseeventhandler(controlbutton_mouseenter); } } the issue click event not fired consistently. gets clicked every 5-6 times click on it. there no issue mouseenter event , gets fired consistently. i tried this.mouseclick, this.mousedown events raise event, these working inconsistently. thought how solve this? short answer: command or form handling wm_lbuttondown message. does usercontrol have children , focused before click? give more info reply question completely. have looked @ wm_messages command receiving when click on it? c# w

java - Why do I need to handle an exception for Thread.sleep()? -

java - Why do I need to handle an exception for Thread.sleep()? - to code compile, can either: put phone call thread.sleep() in try/catch block, or have printall() declare can throw interruptedexception . why have this? class test { public static void main( string[] args ) { printall( args ); } public static void printall( string[] line ) { system.out.println( lines[ ] ); thread.currentthread().sleep( 1000 ): } } (sample code kathy sierra's scjp book.) i know exception thread.sleep() throws checked exception, have handle it, in situation thread.sleep() need throw exception? if method declared in way can throw checked exceptions ( exception s not subclasses of runtimeexception ), code calls must phone call in try-catch block or caller method must declare throw it. thread.sleep() declared this: public static void sleep(long millis) throws interruptedexception; it may throw interruptedexception strai

How to draw triangle with OpenGL and Haskell -

How to draw triangle with OpenGL and Haskell - i'm reading tutorial http://www.arcsynthesis.org/gltut. write test haskell program. want see triangle interpolating colors on center of window, on window 1 color. module shaders import graphics.ui.glut import foreign.marshal.array import foreign.ptr import foreign.storable() import foreign.c.types() import qualified data.bytestring bs import system.io import control.monad info state = state { vertexbuffer :: bufferobject, gpuprogram :: programme } trianglevertexes :: [glfloat] trianglevertexes = [ 0.0, 0.5, 0.0, 1.0, 0.5, -0.366, 0.0, 1.0, -0.5, -0.366, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0 ] main :: io () main = (progname, args) <- getargsandinitialize initialdisplaymode $= [ doublebuffered, rgbamode, withalphacomponent, withdepthbuffer ] _ <- createwindow progname state <- initializestate display

html - One page website navbar to highlight when on section (using bootstrap)? -

html - One page website navbar to highlight when on section (using bootstrap)? - i using bootstrap , smoothscroll 1 page website. unsure how section in navbar become active though if scrolls - help on this? know how highlight when clicked not sure position <div class="navbar navbar-default navbar-fixed-top" role="navigation"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse"> <span class="sr-only">toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <!-- nav bar --> <div class="navbar-brand"><b>merisa lee</b&g

windows - How Can I Write a Batch File Where I Start one Program and When that Program Finishes or Closes, Start Another -

windows - How Can I Write a Batch File Where I Start one Program and When that Program Finishes or Closes, Start Another - for example: @echo off start c:\windows\system32\dfrgui.exe /c wait defragmentation finish. start c:\"program files (x86)"\ccleaner\ccleaner.exe /auto wait ccleaner finish. start c:\windows\system32\cleanmgr.exe /sagerun:1 and on.. point. how can this? thanks. start can take command line argument /wait e.g. @echo off title test cmd start start /wait wait.cmd 5 start /wait cmd /k echo launched sec command pause this simple illustration uses script have written (wait.cmd shown below) first command executed, see if test /wait alternative specified script allows first command finish before continuing: @echo off rem phone call # of seconds wait set /a secs=%1 set /a ms=%secs%*1000 echo process wait %secs% seconds , continue... ping 1.1.1.1 -n 1 -w %ms% > nul echo. exit as side note if open cmd session can fin

html - JavaScript alert -

html - JavaScript alert - i have problem homework... don't know what's wrong code.. homework create simple learning mathematic level selection... utilize drop downwards menu choosing level , arithmetic operations... problem when click button go function start() save level , operation been chosen 2 variable levelselect , operationselect...and test alert(levelselect); ...supposed show alert window level select...but can't work... view post , willing help me...thanks... >< class="snippet-code-js lang-js prettyprint-override"> <script language="javascript"> var levelselect; var operationselect; var num1; var num2; function start() { levelselect = form.element["form1"]["level"].value; operationselect = form.element["form1"]["operation"].value; alert(levelselect); } </script> class="snippet-code-html lang-html pretty

c# - Attach event handler from parent class in xaml -

c# - Attach event handler from parent class in xaml - i have base of operations class window contains number of event handlers mutual windows of type (they fire mutual validation methods). here illustration event handler: protected virtual void validatetextboxtextchanged(object sender, system.windows.controls.textchangedeventargs e) { validateproperty((frameworkelement)sender, textbox.textproperty); } and there approximately 20 of these, covering mutual controls. each window instance built kid class of base. in .xaml of kid class do: <textbox textchanged="validatetextboxtextchanged"/> but when navigate window, next error: failed assign property 'system.windows.controls.textbox.textchanged'. so it's not finding event handler. there elegant way can assign event handlers without duplicating them in every kid class (~ 30 children , counting)? that's interesting -- seems limitation of event mechanism check

sql server - SQL queries do not currently support returning aliases -

sql server - SQL queries do not currently support returning aliases - i have raw sql trying run on grails final session = sessionfactory.currentsession; final string query = 'select count(a.*) artifact left bring together classification c on (a.id=c.artifact_id) c.id null or c.active=0'; final sqlquery = session.createsqlquery(query); def totalunclass = sqlquery.with { addentity(artifact); } but getting error message: sql queries not back upwards returning aliases tried method failed there accomplish result click here try changing query line this final string query = 'select count(*) artifact left bring together classification c on (a.id=c.artifact_id) c.id null or c.active=0'; sql-server oracle hibernate grails hql

java - Calling a print method from another class with primitive data types in it -

java - Calling a print method from another class with primitive data types in it - i have been programming in java using bluej 2 months , need help assignment. making basic vehicle purchase info entry program. need phone call printpurchasedate() method purchasedate class. problem faced print statement has 3 int values: year, month, , day. when seek phone call method in vehicle class in printdetails() method, tells me need return, if take away void have label method string. doesn't work because holds 3 int variables within conflict string method. how can go doing this? want print of info including purchasedate . apologies in advance if did not nowadays question properly, first post. give thanks help. i have 2 classes: purchase date , vehicle. my vehicle class has method, designed print out information: public void printdetails() { system.out.println("customer:" + " " + customer.getfullname()); system.out.println("vehicle

ms access - Compare 2 tables and show 1 column answer -

ms access - Compare 2 tables and show 1 column answer - i have been trying phone number comparing 2 different tables. illustration area 1: customer_ tel: 10123 10020 area 2: customer_tel: 02103 02351 10123 using area 1 reference, wanted outcome show numbers in area 2 not found ( or match) table 1. i tried using this: select area1.[customer_tel],area2.[customer_tel] area1 left bring together area 2 on area1.[customer_id]=area2.[customer_tel] the query above identified numbers found in area 1 , went on show in show in area 2, client id column. next add together in using area1. [customer_tel]<>area2.[customer_tel] showed blank cells except headers. hope kind soul help in tweaking it. there several ways joins. next left join select area2.[customer_tel] area2 left bring together area1 on area1.[customer_tel]=area2.[customer_tel] area1.[customer_tel] null while here right join select area2.[customer_tel] area1 right bring together area2

oop - When using object identifiers (OIDs) to manage object relationships in a relational database? -

oop - When using object identifiers (OIDs) to manage object relationships in a relational database? - when using object identifiers (oids) manage object relationships in relational database, 1 of next characteristics should oids not have? selection 1: stored separately in reference table selection 2: become key of table storing object selection 3: numeric or @ to the lowest degree incremented selection 4: have no business meaning selection 5: unique objects in classes oop

ruby on rails - How to add exception handling to my before_action -

ruby on rails - How to add exception handling to my before_action - i have before_action method this: def current_user @current_user ||= user.find(:id => session[:id]) end and phone call method this: def get_food user nutrient = food.find(:id => user.id) end this fine, want add together exception handling. when user nil want utilize @current_user : def get_food user nutrient = food.find(if user nil want utilize @current_user.id) end of course, can write this: def get_food user if user.nil? nutrient = food.find(@current_user.id) else nutrient = food.find(user.id) end or, best way? def get_food user nutrient = food.find(user == nil? @current_user.id : user.id) end i'm curious there improve way adding simple if statement within param? the shortest 1 lines can think of this: food.find((user || current_user).id) food.find(user.try(:id) || current_user.id) food.find(user ? user.id : current_user.id)

php - Error in compiling product.tpl using smarty -

php - Error in compiling product.tpl using smarty - i have tried compile this tpl file using smarty. php file this. beingness shown error message ( ! ) fatal error: uncaught --> smarty compiler: syntax error in template ".\templates\product.tpl" on line 94 "var doesntexist = '{l s='this combination not exist product. please take another.' js=1}';" unknown tag "l" <-- thrown in c:\wamp\www\smarty\libs\sysplugins\smarty_internal_templatecompilerbase.php on line 94 can please help me how prepare error? the problem appears at: var doesntexist = '{l s='this combination not exist product. please take another.' js=1}'; the question here l - smarty function? if yes, appears it's not loaded , if should plain text reason, might seek putting {literal} : var doesntexist = '{literal}{l s='this combination not exist product. please take another.' js=1}{/literal}'; php cs

DownloadString in C# skips newline characters -

DownloadString in C# skips newline characters - i want import text info google finance, , utilize http address parameter downloadstring http://www.google.com/finance/getprices?i=1200&p=1d&f=d,o,h,l,c,v&df=cpct&q=aapl . however, resulting string misses newline characters, hard parse. ideas? the line ends returned stream \n opposed default windows line ends \r\n (which represented in environment.newline on windows). try split on of possible combinations of \r , \n : webclient wc = new webclient(); string s = wc.downloadstring("http://www.google.com/finance/getprices?i=1200&p=1d&f=d,o,h,l,c,v&df=cpct&q=aapl"); string[] lines = s.split(new string[] { environment.newline, "\n", "\"r" }, stringsplitoptions.none); c# downloadstring

javascript - why this is ref to window Obj here? -

javascript - why this is ref to window Obj here? - i new js , felt understood concept of this until came across. function toplevelfn(){ var obj = { empid : 232 }; console.log('toplevelfn() empid :' + obj.empid); innerfn(); function innerfn(){ //why points window object... console.log('innerfn() empid :' + this.obj.empid); } } var register = new toplevelfn(); if understood innerfn() called toplevelfn() invoking obj , this should ref toplevelfn()? context depends on how invoke function. case described in ecmascript spec 10.4.3 entering function code: the next steps performed when command enters execution context function code contained in function object f, caller provided thisarg, , caller provided argumentslist: if function code strict code, set thisbinding thisarg. else if thisarg null

asp.net mvc - MVC 4 validation message from entityconfiguration -

asp.net mvc - MVC 4 validation message from entityconfiguration - this attributes model need validation. public system.datetime entrydate { get; set; } public system.datetime deadline { get; set; } public string client { get; set; } public string customercontact { get; set; } this entitytypeconfiguration validation these attributes. this.property(t => t.entrydate) .isrequired(); this.property(t => t.deadline) .isrequired(); this.property(t => t.customer) .isrequired() .hasmaxlength(20); this.property(t => t.customercontact) .isrequired() .hasmaxlength(20); this.property(t => t.intercontact) .isrequired() .hasmaxlength(20); this.property(t => t.category) .isrequired() .hasmaxlength(5); how work @html.validationmessagefor(model => model.deadline) the va

c# - Is WCF announcement the right choice? -

c# - Is WCF announcement the right choice? - i have created local wcf service tcp binding. handle case when service goes down. know how check when service goes downwards in client side not know how check when service come online. in simple word, want client side automatically create new proper connection when service restarts. after checking internet, found wcf proclamation feature, did not find clear illustration on how utilize proclamation feature. please note client connection object (service) created automatically visually studio entering service reference , not myself. service has static ip address , clients on local network. my question is wcf proclamation right selection or there other solution? there 2 ways general ways can go doing need do: since have static ip address service, can utilize old method of having "check if online" timer event on client side starts when connection service lost , keeps on poking destination see when service c

node.js - Express.js turn off views only display JSON -

node.js - Express.js turn off views only display JSON - is there way in express.js/node disable view engine , homecoming json? app working on homecoming json var jsondata = [{ "id": 1, "email": "1@demo.in" },{ "id": 2, "email": "2@demo.in" }]; and res.json(jsondata) , don’t need view engine. sample code: var express = require('express'), router = express.router(); router.get('/api/users', function(req, res){ res.json(jsondata); }); node.js express

linux - Is libc.so.2 required to be located in /usr/lib? -

linux - Is libc.so.2 required to be located in /usr/lib? - i have directory next contents: bin/busybox lib/ld-linux.so.2 lib/libc.so.6 and when invoke: chroot . bin/busybox sh it fails following: /bin/busybox: error while loading shared libraries: libc.so.6: cannot open shared object file: no such file or directory when move lib/libc.so.6 usr/lib, works fine. why libc required in /usr/lib? when invoke: objcdump -p bin/busybox | grep needed i get: needed libc.so.6 so thought, soname of library used without slashes etc. loaded able find in standard folders, /lib , /usr/lib. apparently, not case. to create matters more confusing, ld-linux.so.2 seems have in /lib because when moved /usr/lib, chroot fails with: chroot: failed run command '/bin/busybox': no such file or directory which learned error loader cannot found, not busybox binary. is issue libc.so.2 distro specific? if important, i'm using arch linux. the loc

database - MySQL Join and COUNT(*) query -

database - MySQL Join and COUNT(*) query - i have problem. solution downwards lack of sql knowledge on part. have 2 tables. table : jobs +---+----------+ |id | jobname | +---+----------+ | 1 | tinker | | 2 | tailor | | 3 | soldier | | 4 | sailor | +---+----------+ table : applied +---+--------------+--------+ |id | jobappliedid | name | +---+--------------+--------+ |1 | 1 |cliff | |2 | 2 |john | |3 | 2 |ringo | |4 | 2 |paul | +---+--------------+--------+ now, want create sql simple select on table jobs, ... select * jobs; but want bring in select count of how many times each job has been applied for. illustration homecoming following. +---+----------+-------+ |id | jobname | count | +---+----------+-------+ | 1 | tinker | 1 | | 2 | tailor | 3 | | 3 | soldier | 0 | | 4 | sailor | 0 | +---+----------+-------+ i think need embed select not know start. can help? thanks

sql - Active Reports Table Row Height -

sql - Active Reports Table Row Height - hi new active reports , using trial find out if can utilize it. i have table in study header detail , footer row. problem having that, have description in 1 of columns , description can 1 or more rows of text. can't set fixed height rows because might have 1 row 10 words in , row 50 words. so how can create row height set auto. thanks first thing want create sure using cpl study rather fpl report. fixed page layout (fpl) reports not allow growing of controls , hence table not automatically grow accommodate long text. suggest seek these steps. with designer open in visual studio, go study menu , select "convert cpl" option. after conversion, select cells within table , create sure cangrow property set true. once create these changes, table automatically grow fit long text within it. in add-on this, recommend taking @ this , this links larn more cpl , fpl study types. i hope helps. s

php - How to add active state of category menu in wordpress? -

php - How to add active state of category menu in wordpress? - i create template category menu. when click "category", based on category reload page shows post in category. need create category menu active. how do? category-menu.php <div class="row text-center" > <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12"> <?php $menu_item=wp_get_nav_menu_items( 'category menus', $args ); foreach ($menu_item $menu) { ?> <div class="col-lg-3 col-sm-12 col-xs-12 col-md-3 menu-padding"> <div class="blog-menu-items cat-menu-color"> <a href="<?php echo $menu->url; ?>"> <?php echo $menu->title; ?> </a> </div> </div> <?php } ?> </div> </div> category.php <?php get_template_part

How to load localization strings from JSON in iOS -

How to load localization strings from JSON in iOS - i have service homecoming json of key/value pairs of localized strings. info can change, looking set phone call service latest localization strings. since, not bundling localization string app. should build .string file pragmatically on update? or insert records core data? just looking best solution performance. thank you give try, can useful , cut down much of code: mclocalization ios localization

ember.js - Ember select making model dirty on init -

ember.js - Ember select making model dirty on init - having select in template makes model dirty , triggers observer on init, why? wanna able update model on alter update function triggered on init , don't wanna create api phone call on every single item on init. template: {{#each booking in bookings itemcontroller="booking"}} {{isdirty}} // true {{view "select" content=daterange value=booking.playingon optionvaluepath="content.date" optionlabelpath="content.day"}} {{/each}} controller: // running on init , when select in select drop down. updateplayingon: function(){ console.log(this.get('currentstate.statename')); // logs root.loaded.updated.uncommitted }.observes('playingon') as have understood value=booking.playingon updates playingon model attribute same value , making model dirty. seems ember select can't handle javascript objects, in case date object. making objects string

jquery - Parse error 200 Json ajax webapp2 -

jquery - Parse error 200 Json ajax webapp2 - i have ajax phone call jquery function admin_ajax_pop_rows(){ $(document).ready(function(){ variable1= 'none'; $.ajax({ type: "post", url: "/someurl", datatype: "json", data: json.stringify({"variable1": variable1}) }) .success(function(data){ alert('success response: ' + info + ' number of rows : '); }) .done(function(data){ alert ('rows : ' + data.return_rows); maketablejquery(data); }) .fail(function(error){ alert('error status : ' + error.status + ' text: ' + error.statustext + ' response text : ' + error.responsetext); }); }); } and in python server code have def post(self): user_key = ndb.key(self.user_model,'value') user_key_parent = user_

Got Error on Creating Simple Compiler Using Flex and Bison -

Got Error on Creating Simple Compiler Using Flex and Bison - i'm trying run simple compiler compiler construction using flex , bison book there lot of error write downwards code book. not expert in flex , bison tried prepare can't. here codes tried run , error. root@tom:/home/karo/desktop# bison -dv simple.y simple.y: warning: 39 shift/reduce conflicts [-wconflicts-sr] root@tom:/home/karo/desktop# gcc -c simple.tab.c in file included simple.y:6:0: sm.h: in function ‘fetch_execute_cycle’: sm.h:55:4: warning: format ‘%s’ expects matching ‘char *’ argument [-wformat=] default : printf( "%sinternal error: memory dump\n" ); break; ^ in file included simple.y:7:0: cg.h: in function ‘print_code’: cg.h:28:3: warning: format ‘%ld’ expects argument of type ‘long int’, argument 2 has type ‘int’ [-wformat=] printf("%3ld: %-10s%4ld\n",i,op_name[(int) code[i].op], code[i].arg ); ^ cg.h:28:3: warning: format ‘%ld’ expects argument of type ‘long

Filtering graph results -

Filtering graph results - using next query: /me/posts?fields=story,type,created_time,privacy,message,picture,comments.summary(1).limit(100){created_time,from.id,like_count,message},likes.summary(1).limit(100){id} i getting posts user , related data; works fine. however, status updates (type = status) non-empty message field. as quick prepare have solved programatically, find crude. there improve way? facebook-graph-api

javascript - Repeating a set of s in the same table row using AngularJS -

javascript - Repeating a set of <td>s in the same table row using AngularJS - i want create table that, in header, contains names of each player 2 teams in each . scope has variable teams list of team objects, each 1 having list of player objects attribute. this turning out way harder expected. <table> <thead> <tr> <div ng-repeat="team in teams"> <th ng-repeat="player in team.players">{[ player.name ]}</th> <th>partial score</th> <th>total score</th> </div> </tr> </thead> </table> is easiest thing have in mind - doesn't work. can't placed within according w3c (from understand), browser takes div , places outside table. i've tried directives - these don't help. illustration of directive file. <th ng-repeat="player in team.players">{[ player.name ]}</th> <th>partial

php - Having Multiple Values Inside One Array - For Loop? -

php - Having Multiple Values Inside One Array - For Loop? - the script: <?php include("connect.php"); ?> <form method="post" action="<?php echo $_server['php_self']; ?>"> <input type="text" name="name1" /> <input type="text" name="name2" /> <input type="text" name="name3" /> <input type="submit" name="submit" /> </form> <?php if(isset($_post['submit'])){ $name1 = $_post['name1']; $name2 = $_post['name2']; $name3 = $_post['name3']; $myarray = array($name1, $name2, $name3); for($i = 0; $i < count($myarray); $i++){ $tqs = "select `id` `images` `image_file` in ('" . $myarray[$i] . "')"; $tqr = mysqli_query($dbc, $tqs) or die(mysqli_error($dbc)); $fetch_array = arra

java - Convert BigDecimal to String with no trailing zeros -

java - Convert BigDecimal to String with no trailing zeros - this question has reply here: why new bigdecimal(“0.0”).striptrailingzeros() have scale of 1? 1 reply i want remove trailing zeros bigdecimal , print it. trailingzeros method not working (i) expected. bigdecimal = new bigdecimal("-11111111111111111111111111111111111111.111111111111111111111111111111"); bigdecimal b = new bigdecimal("11111111111111111111111111111111111111.111111111111111111111111111111"); bigdecimal c = a.add(b); system.out.println(c); system.out.println(c.toplainstring()); c = c.striptrailingzeros(); system.out.println(c); system.out.println(c.toplainstring()); the output of code is: 0e-30 0.000000000000000000000000000000 0e-30 0.000000000000000000000000000000 i result of "0". what using decimalformat create formatted string accor

android - Build next ViewPager fragments -

android - Build next ViewPager fragments - well, i'm building app uses android.support.v4.view.viewpager in mainactivity. load video adresses json object server , want create fragment every video (to swipe next one). my fragment.xml looks this: <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <videoview android:id="@+id/videoview1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_alignparentbottom="true" android:layout_alignparentleft="true" android:layout_alignparentright="true" android:layout_alignparenttop="true" /> <imageview android:id="@+id/imageview1" android:layout_width="fill_parent" android:layout_

ios - How to check if a character is supported by a font -

ios - How to check if a character is supported by a font - i'm working on app text field. text wrote in field printed , have issue characters emoji, chinese characters, etc... because font not provide these characters. it's why want character provided font (the font downloaded can deal straight file or uifont object). i heard ctfontgetglyphsforcharacters i'm not sure function want , can't work. here code : ctfontref fontref = ctfontcreatewithname((cfstringref)font.fontname, font.pointsize, null); nsstring *characters = @"🐯"; // emoji character nsuinteger count = characters.length; cgglyph glyphs[count]; if (ctfontgetglyphsforcharacters(fontref, (const unichar*)[characters cstringusingencoding:nsutf8stringencoding], glyphs, count) == false) nslog(@"ctfontgetglyphsforcharacters failed."); here ctfontgetglyphsforcharacters homecoming false. it's want because character '🐯' not provided font used. problem when replac

c++ - LWPSTR to CONST CHAR* help needed -

c++ - LWPSTR to CONST CHAR* help needed - i trying convert const char pointer constant wide string pointer. here code. double ret; const wchar_t* file; file = const wchar_t* (file_old); i says this: "error, type name not allowed." on const. any help appreciated! you need convert contents pointer points wide characters. easiest way set narrow version string , convert using wstring_convert detailed in answer: http://stackoverflow.com/a/18374698/82320 c++

SQL unique : manual check vs catch exception -

SQL unique : manual check vs catch exception - i'm working on big database , i'm seeking can speed database. question : when have unique index on somes fields, faster between create select request check if it's ok, or seek anyway , grab exception if entry exists ? i made researchs nil conclusive. thanks. a manual check won't think does. (see below.) if check first, every insert requires 2 round-trips database. might require serializable transactions. and have trap errors anyway. duplicate value one thing can go wrong on insert; there lot of other things can go wrong. i insert, , trap errors. the point of select before insert determine whether value exists in database. can't rely on work. here's why. open 2 terminal sessions (for example), , connect both database. table exists. it's empty. create table test ( test_id serial primary key, test_email varchar(15) not null unique ); a: begin transaction; a: select test_em

How to know when a client has disconnected in Socket.IO because of connection issues? -

How to know when a client has disconnected in Socket.IO because of connection issues? - i've noticed socket.io server, if client's network times out, server never gets disconnect event. how handle disconnect in case client silently times out? or disconnect after long time? can explain happens in socket.io server, when client silently disconnects (power plugged, router crashed, network issues, etc.) socket.io

python splitting text file by line reminders -

python splitting text file by line reminders - i have created python programme count lines in text file split multi files depending on how much file numbers user asks have problem remainder of partition process when user asks split file 3 files script creates 4 files , write remaining lines in 4th file my code : num_lines = sum(1 line in open("perfix/{0}.txt".format(name))) size2 = num_lines / progs open('perfix/{0}.txt'.format(name)) f: i, g in enumerate(grouper(size2, f, fillvalue=''), 0): open('ip{0}_{1}'.format(name,(i+1)), 'w') fout: fout.writelines(g) any way how can solve ? thanks if want lines written lastly file, size should different lastly one. 1 way can build array file sizes , if there remainder, append part size of lastly file. seems grouper custom function extending itertools. don't know does, here code out that. read many lines need initial file: def filesplit(name,progs)

javascript - Mailto or hyperlink doesn't work on footer menu due to submenu script -

javascript - Mailto or hyperlink doesn't work on footer menu due to submenu script - do submenu script mailto link or hyperlink doesn't work , don't why , in script causes problems. $(function () { $('footer > ul > li a').click(function(event) { event.preventdefault(); event.stoppropagation(); var $parentli = $(this).closest('li'); $parentli.siblings('li').find('ul:visible').hide(); $parentli.find('> ul').stop().toggle(); }); }); $(document).click(function() { $("footer ul li ul").hide(); }); fiddle: http://jsfiddle.net/foroloca/65t6gk5n/ you're calling event.preventdefault(); . prevents default functionality of event, , prevents link beingness fired. if need functionality in place other a elements in footer, suggest add together class name , modify event handler apply elements: <ul> <li> <a href="..." class="prevent-default

Get actual location google maps v2 ANDROID -

Get actual location google maps v2 ANDROID - i want current position googlemap object, i'm doing this: private void setupmap() { mmap.setmylocationenabled(true); final location location = mmap.getmylocation(); log.w("status", "yes"); if (location != null) { log.w("status", "no"); latlng = new latlng(location.getlatitude(), location.getlongitude()); } mmap.setonmylocationchangelistener(new googlemap.onmylocationchangelistener() { @override public void onmylocationchange(location loc) { loc = location; mmap.movecamera(cameraupdatefactory.newlatlngzoom(latlng, map_zoom)); mmap.addmarker(new markeroptions().position(new latlng(loc.getlatitude(), loc.getlongitude())).title("it's me!")); } }); } i don't know if have utilize tool current posi

c# - Bad request exception in OData request -

c# - Bad request exception in OData request - during execution of snippet var res = ctx.resources.where( t => t.resourceid == "t/15") .first(); the programme throws bad request - error in query syntax exception. the problem '/' char string. it of import note resourceid string , "the key" of resources entity. the special char mandatory in our system. this error occurs since special characters / have escaped in odata request. in .net framework utilize uri.escapedatastring method purpose, example: var encresourceid = uri.escapedatastring("t/15"); var res = ctx.resources.where( t => t.resourceid == encresourceid) .first(); it assumed specified query transformed next odata request: http://localhost/odata/resources()?$filter=resourceid eq 't%2f15' c# linq odata

multithreading - How to avoid busy spinning in Java -

multithreading - How to avoid busy spinning in Java - i have multi-threaded application thread sends message thread. waiting thread polls message , reacts (locks handled). this: waiting thread code: while(true) { if(helloarrived()) system.out.println("got hello"); if(byearrived()) system.out.println("got bye"); if(stoparrived()) break; } i want avoid cpu hogging technique , utilize else instead. ideas? edit: actual code below: blockingqueue<mail> killmemailbox = new linkedblockingqueue<mail>(); blockingqueue<mail> messagemailbox = new linkedblockingqueue<mail>(); public void run() { while(true) { if(killmemailbox.size() > 0) { break; } if(messagemailbox.size() > 0) { system.out.println(messagemailbox.poll()); } } } public void receivemail(mail mail) { //

php - Calling function with return value in cakephp -

php - Calling function with return value in cakephp - i new cakephp. have problem calling function. here issue. in contrloller file values using next function class="lang-php prettyprint-override"> public function index() { $conditions = array( 'order' => array('histroy.chat_sk desc') ); $this->set('histroys', $this->histroy->find('all',$conditions)); } in model file have following, class="lang-php prettyprint-override"> class histroy extends appmodel { public $tableprefix = 'plc_'; public $usetable = 'chat_history'; } in view file have listed values using foreach() function , follows class="lang-php prettyprint-override"> foreach ($histroys $histroy): $oper_name = $histroy['histroy']['operator_fk']; $operator_email = $histroy['histroy']['email']; endforeach in opertaor_fk field in histo

ios - UIView animation returns to origin -

ios - UIView animation returns to origin - i have uilabel within of uitableviewcell. trying animate label moving right when user taps cell. have code: cgrect otherframe = celllabel.frame; otherframe.origin.x +=50; [uiview animatewithduration:1.0f animations:^{ celllabel.frame = otherframe; }]; the odd thing that's happening label jumping 50 pixels left , animating origin (where before action began). i had working before in week , didn't have problem it, , after scouring through revision history, can't figure out i've gone wrong. must missing stupid. edit: based on reply jakub, found works: [uiview animatewithduration:0.01f animations:^{} completion:^(bool finished) { cgrect otherframe = celllabel.frame; otherframe.origin.x += 50; [uiview animatewithduration:1.0f animations:^{ celllabel.frame = otherframe; }]; }]; oddly, if move of logic completion handler performs new animation after first 1 completes (with

php - 404 not found when posting to localhost -

php - 404 not found when posting to localhost - when user enters details trying add together them database via post file called registernewuser.php post never succeeds. i'm given 404. here post code: $http({ method: 'post', url: '../../php/login/registernewuser.php', data: newuser, headers: { 'content-type': 'application/x-www-form-urlencoded' } }).success(function(data, status) { console.log("success"); }).error(function(status) { console.log("error"); }); i have tried moving setting url /registernewuser.php , moving registernewuser.php base of operations directory still no luck. help appreciated. php html5 angularjs node.js