Posts

Showing posts from May, 2015

networking - How to request grunt serve from host machine? -

Image
trying setup angular on virtual machine yeoman avoid breaking machine packages management. after generate project yo myproject , install angular globally & locally, install grunt bower , more dependencies, i'm able run server using grunt serve the localhost accessible vm via wget localhost , not load host. i've tried modifying file /etc/network/interface static address , accessing static ip browser, , set dynamic dhcp port forwarding none have worked, browser can't make connection: firefox can't establish connection server @ i upload more useful files/output give more context, new grunt user have no idea look. set connect-middleaware listen on 0.0.0.0 ip address ensure host accessible. you can edit gruntfile.js this. find connect task in grunt.initconfig({}); change hostname in options 0.0.0.0 it should this: // actual grunt server settings connect: { options: { port: 9000, // change '0.0.0.0' access se

ios - Match the data type of a object in Swift -

how match data type of object in swift? like: var xyz : xyz = 1; switch xyz { case let x xyz as?anyobject[]: println("\(x) anyobject type") case let x xyz as?string[]: println("\(x) string type") case let x xyz as?int[]: println("\(x) int type") case let x xyz as?double[]: println("\(x) double type") case let x xyz as?float[]: println("\(x) float type") default:println("none") } in case switch case run default case change var xyz : anyobject var xyz : any , add match case case let x int: from repl 1> var : = 1 a: int = <read memory 0x7fec8ad8bed0 failed (0 of 8 bytes read)> 2> switch { case let x int: println("int"); default: println("default"); } int from the swift programming language you can use , operators in switch statement’s cases discover specific type of constant or v

How to convert pdf file to svg file using itextsharp in asp.net c#? -

i have project in project have convert pdf file svg file. note: pdf contains images. please suggest me how convert pdf svg file you have follow steps.. convert pdf images.. then use each image , convert svg using canvas(that possible way).. use final result per requirement.. note: post of work more clarity

java - android regex odd behavior -

what error following regular expression? working fine in java whereas android throws "pattern syntax exception". "((?<==)+(\"[^\"]+\"|[^,=+<>#;\r\n]+))" avinash raj pointed important mistake: + multiplier after positive lookbehind expression. using nested marking groups mistake. outer parentheses useless here , should removed reduce complexity. and backslashes in strings must escaped backslashes. think \r , \n should passed regular expression engine , not characters code value 13 , 10, string use is "(?<==)(\"[^\"]+\"|[^,=+<>#;\\r\\n]+)"

hadoop - Adding/Defining Jars in Hive permanently -

i trying add jar in hive classpath using below add command. command: hive> add myjar.jar but whenever login hive, need add myjar.jar using add cmd. there way can add permanently in hive classpath. regards, mohammed niaz add .hiverc file add jar myjar.jar have @ if require further info http://hadooped.blogspot.in/2013/08/hive-hiverc-file.html

java - i can't test the android wear sdk -

i'm trying launch test app eclipse on android wear, when create new projet, part of android wear not here. messages : watchactivity cannot resolved type (java file) error: no resource identifier found attribute 'roundlayout' in package (xml file) error: no resource identifier found attribute 'rectlayout' in package (xml file) i've installed sdk, , update adt 23. you'll need add android wear support library (android.support.wearable)to workspace. here full steps on how build android wear app using eclipse. hope help. https://medium.com/@tangtungai/how-to-develop-and-package-android-wear-app-using-eclipse-ef1b34126a5d

javascript - Sum similar keys in an array of objects -

i have array of objects following: - [ { 'name': 'p1', 'value': 150 }, { 'name': 'p1', 'value': 150 }, { 'name': 'p2', 'value': 200 }, { 'name': 'p3', 'value': 450 } ] i need add (summation) , other mathematical operation calculate average object same name appearing in it. like: - [ { 'name': 'p1', 'value': 300 }, { 'name': 'p2', 'value': 200 }, { 'name': 'p3', 'value': 450 } ] would appreciate can get. thanks in advance! first iterate through array , push 'name' object's property. if property exists add 'value' value of property otherwise initialize property 'value'. once build object, iterate through p

ruby on rails - Missing template in RoR application -

Image
in ruby on rails application, want controls value controllers page: below view page: <%= form_for :managerviewresume, :url => { :method => :post, :action => :managerviewresume }) |f| %> <table class="table" width="100%"> <tr> <td><%= @selection %></td> //here checking radio button value <td> <label style="font-size:small;">selected?</label> <label class="radio inline" style="font-size: small"> </br>&nbsp;&nbsp;&nbsp; <%= f.radio_button :select, "yes", :id => "rb_select1" %> yes </label>&nbsp;&nbsp; <label class="radio inline" style="font-size: small"> <%= f.radio

php - how to active subscription process with paypal DirectPayment method -

we integrated paypal recurring payment api (php) subscription using express checkout , working fine. trying integrate directpayment accept credit/debit cards using dodirectpayment . send request paypal using dodirectpayment method , returns success in response , want create recurring profile against credit/debit card future transactions. @ point if call createrecurringpaymentsprofile method requires token don't have token returned in dodirectpayment method response create recurring profile. please , guide me right process problem or made mistake. thanks createrecurringpaymentsprofile requires token when used express checkout. direct credit cards you'll use same crpp request, you'll leave token out , include credit card parameters instead. here sample request works fine. [requestdata] => array ( [user] => **** [pwd] => **** [version] => 112.0 [buttonsource] => angelleye_phpclass [signature]

sql - Union in xml select query -

i selecting data table xml. used xml path , have succeeded. in xml need add 1 section named return dummy used later. have select query return section xml. need union both these select queries single xml. my code select cast(idno varchar(8)) [idno] ,cast(code varchar(4)) [code] ,cast(amt varchar(18)) [amt] tbl1 xml path('item'), root('table1'), type select '' iname ,'' unq_id ,'' status xml path('it_return') please advise me. edit: expected output is <table1> <item> <idno>0283883</idno> <code>abc</code> <amt>20</amt> </item> <item> <idno>0374747</idno> <code>dhf</code> <amt>10</amt> </item> </table1> <it_return> <iname></iname> <unq_id></unq_id> <status></status> </it_return> the follow

Laravel selfregistering ServiceProvider -

in laravel 4.2 possible create package automatically registers serviceprovider without user adding path manually app.php file? this way 1 run composer update after adding package composer.json file , ready go. i think there no way register main service provider putting in app.php file. in fact can, require developer. can't away with simple composer update . you can register sub service providers app::register('myapp\providers\myserviceprovider'); inside package.

vb.net - Me.Handle in Module - Alternative? -

i programming i've hit small problem, is: using me.handle in module used source codedom-compiler. i want or rather need use in following procedure: private const appcommand_volume_mute integer = &h80000 private const wm_appcommand integer = &h319 declare function sendmessagew lib "user32.dll" (byval hwnd intptr, byval msg integer, byval wparam intptr, byval lparam intptr) intptr private sub mute() sendmessagew(me.handle, wm_appcommand, me.handle, ctype(appcommand_volume_mute, intptr)) end sub you idea, want mute system-sound. more or less searching way of doing without using me.handle , not working in module reason... any appreciated, in advance guys! sendmessage requires handle form, don't have in module or standard class. three options either pass in reference form this: private sub mute(formref form) sendmessagew(formref.handle, wm_appcommand, formref.handle, ctype(appcommand_volume_mute, intptr)) end sub or use handle

objective c - iOS App with web contents got rejected even the similar one is in appstore -

i have developed native ios application based on client's requirement show timelines of different social networks(fb,twitter,instagram,google + etc.) in same application using webview.say example,when click facebook button show web contents of facebook , so.the client gave me reference app doing same thing , published in appstore.that https://itunes.apple.com/sa/app/mysocial-for-ios/id687623816?mt=8 (is not native app?) but when tried publish similar app appstore,it got rejected.i got same reason mentioned in link http://www.sencha.com/forum/archive/index.php/t-215050.html?s=b15f82172b608c468a36774a93c7a7c9 could tell me wrong , why other app got published , publishing appstore

c# - How to fix this error thrown on process exit when using Tibco? -

when using tibco, cause of error? 2014-06-27 07:58:39.8230|error|boot.processes.servicerunner|ctrl-c handler error.| system.objectdisposedexception: safe handle has been closed @ system.runtime.interopservices.safehandle.dangerousaddref(boolean& success) @ system.stubhelpers.stubhelpers.safehandleaddref(safehandle phandle, boolean& success) @ microsoft.win32.win32native.setevent(safewaithandle handle) @ system.threading.eventwaithandle.set() @ serviceproxyhelper.setstatestopped(iserviceproxy serviceproxy) in container\serviceproxyhelper.cs:line 387 @ serviceproxyhelper.shellstop() in container\serviceproxyhelper.cs:line 200 @ serviceproxy.shellstop() in container\serviceproxy.cs:line 193 @ boot.processes.servicerunner.consolecancelkeypress(object sender, consolecanceleventargs e) in boot\processes\servicerunner.cs:line 218 ^ this caused calling tibco's environment.open() without calling matching tibco environment.close() . until refer

merging two lists in R (many-to-many relationship) -

i trying merge 2 lists in r. names of list should used perform join. here toy example: > list1 <- list(a=c(1,2,3), b=c(2,4,5,6), c=c(1,3)) > list2 <- list(a=c(w,x), b=c(y,z)) the final merged list should this: $w [1] 1 2 3 $x [1] 1 2 3 $y [1] 2 4 5 6 $z [1] 2 4 5 6 the idea had far convert lists data frames, , use merge function. there simpler do? thanks lot help. hopefully want? in fact don't need list2 @ all. because lists vectors, can use named vector "lookup" values of list1 need, assign names new list list1 <- list(a=c(1,2,3), b=c(2,4,5,6), c=c(1,3)) lookup <- c(w = "a",x = "a",y = "b",z = "b") list2 <- list1[lookup] names(list2) <- names(lookup) list2 $w [1] 1 2 3 $x [1] 1 2 3 $y [1] 2 4 5 6 $z [1] 2 4 5 6

cmd - How can the batch file use the username? -

i want make batch file make this: set /p username=username: echo %username% > c:/users/%username%/desktop/extramitico/ud1.txt and says: the system can not find path specified why?? please help! much depends on input, , mentioned, username variable established system , hence poor, if logical, choice. let's presume use set /p name=username: echo %name% > c:/users/%name%/desktop/extramitico/ud1.txt you message if string input name contains illegal characters * or : . you message if directory c:/users\%name%\desktop\extramitico\ not exist - , note directory-separator \ , not / - / used switches. and message if name input contains spaces or commas , other characters. so - try set /p name=username: md "c:\users\%name%\desktop\extramitico" 2>nul echo %name% > "c:\users\%name%\desktop\extramitico\ud1.txt" where "quoting string" gets on spaces etc. in input (but not illegal characters). 2>nul suppr

yii - Not able to create Table through YIIC Migreate create -

i started learning yii framework , facing issue while trying create table through yiic migrate. below code of table. class m140627_072906_create_test_table extends cdbmigration { public function up() { $this->create('tbl_locations', array( 'id'=>'pk', 'location_name'=>'string not null', 'create_time'=>'datetime not null', 'create_user_id'=>'int(11) not null', 'update_time'=>'datetime not null', 'update_user_id'=>'int(11) not null', ), 'engine=innodb' ); } } public function down() { echo "m140627_072906_create_test_table not support migration down.\n"; return false; } } my project under c:\wamp\www\bookmyroom\ , below folder structure c:\wamp\www\bookmyroom>dir volume in drive c has n

ios - How to fill NSMutableArray with images from Parse -

hello need fill nsmutablearray images parse.com can please help patternimages = [nsmutablearray arraywithobjects:@"neon-autumn.gif", @"alchemy.jpg", @"white-wood.jpg", @"green-goblin.png", @"subway-lines.png", @"canvas-orange.jpg", @"kiwis.png", @"cuadros.png", @"hodgepodge.png", @"naranjas.png", @"bunting-flag.png", nil]; i need display images database in parse.com i url pffile using file.url , create image using url, , add each image array. nsurl *url = [nsurl urlwithstring:file.url]; nsdata *data = [nsdata datawithcontentsofurl:url]; uiimage *img = [[uiimage alloc] initwithdata:data cache:no];

sql - How to select data based Group by ID,Year,Month in sqlserver? -

how data based on given below format: id name year month amount 1 2012 jan 100 1 2012 jan 900 1 2012 jan 300 1 2012 apr 100 1 2012 apr 500 2 b 2013 may 100 output in below mentioned form, if name, year, , month in parameter, id name jan feb mar apr may jun ...... jan .....may total 1 1300 0 0 600 0 0 ..... 0 ...... 0 1900 2 b 0 0 0 0 0 0.........0.......100 100 declare @t table (id int,name varchar(10),years varchar(10),months varchar(10),amt int ) insert @t (id,name,years,months,amt)values (1,'a','2012','jan',100) insert @t (id,name,years,months,amt)values (2,'a','2012','jan',100) insert @t (id,name,years,months,amt)values (3,'a','2012','apr',200) insert @t (id

Java regex to rewrite date expression -

i have string dates mentioned "or" operator. want rewrite "between" operator. input : table.it='2013-03-06-23' or table.it='2013-03-07-00' or table.it='2013-03-07-01' or table.it='2013-03-07-02' or table.it='2013-03-07-03' or table.it='2013-03-07-04' or table.it='2013-03-07-05' or table.it='2013-03-07-06' , table.name = 'test' output : table.it between '2013-03-06-23' , '2013-03-07-06' , table.name = 'test' i want rewrite first , last date between operator. please advice how can in java. thank you. hope helps: string s = "where table.it='2013-03-06-23' or table.it='2013-03-07-00' or table.it='2013-03-07-01' or table.it='2013-03-07-02' or table.it='2013-03-07-03' or table.it='2013-03-07-04' or table.it='2013-03-07-05' or table.it

android app widget dynamic background color with rounded corners android 2.3 -

i'm facing problem implementation of changing widget background color dynamically in android 2.3. i used approach implementation: http://oceanuz.wordpress.com/2013/07/11/widget-remoteviews-round-corners-background-and-colors/ so have imageview in widgetlayout: <imageview android:id="@+id/widget_background_image" android:layout_width="match_parent" android:layout_height="match_parent" android:src="@drawable/widget_bg_shape" /> this how widget_bg_shape looks like: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <solid android:color="#496fb3"/> <corners android:radius="3dp" /> </shape> and code changing background color based on user preferences: private static void setbackgroundcolor(context pcontext, in

tfs - Buid definition: Error HRESULT E_FAIL has been returned from a call to a COM component -

when add new work item tfs, build definition throw exception below: exception message: error hresult e_fail has been returned call com component. (type comexception) exception stack trace: @ microsoft.teamfoundation.workitemtracking.client.datastore.datastorenative.begindatastoreinit(intptr handle, string defaultcachepath, string instanceid, int32 cacheversion) @ microsoft.teamfoundation.workitemtracking.client.datastore.datastore.begindatastoreinit(string defaultcachepath, string instanceid, int32 cacheversion) @ microsoft.teamfoundation.workitemtracking.client.workitemstore.initializeinternal() @ microsoft.teamfoundation.client.tfsteamprojectcollection.initializeteamfoundationobject(string fullname, object instance) @ microsoft.teamfoundation.client.tfsconnection.createserviceinstance(assembly assembly, string fullname) @ microsoft.teamfoundation.client.tfsconnection.getservice(type servicetype) @ microsoft.teamfoundation.client.tfsconnection.getservicet

XML File using PHP - Altering the First Two Lines UTF-8 -

i have xml file formatted in specific way specific nodes. have following php code (in test.php) create new xml file each week or else append xml file if entry within same week; $filename = date('y-w').'.xml'; //2014-26.xml //check if file exists if (file_exists($filename)) { // call xml appendfile function appendfile($filename); } else { // call xml createfile function createfile($filename); } when new file created (e.g. 2014-26.xml), top 2 lines of xml file follows; <?xml version="1.0"?> <entry> i need top 2 lines be; <?xml version=”1.0” encoding=”utf-8”?> <document xmlns=”urn:iso:std:iso:20022:tech:xsd:pain.008.001.02” xmlns:xsi=”http://www.w3.org/2001/xmlschema-instance”> in test.php file, have following function causing "entry" node displayed; function addroot(&$xml) { $xml->appendchild($xml->createelement("entry")); } i call function within cre

javascript - reuqure.js how to separate main module to submodules -

guys. have question how can use require.js in project. i have module. example: obj.js var mymodule = (function(){ var myobject = function(){ this.options = { foo: 'foo', bar: 'bar' }; }; myobject.prototype.foo = function(){ console.log(this.options.foo); }; myobject.prototype.bar = function(){ console.log(this.options.bar); }; return { getmyobject : function(){ return new myobject(); } } })(); i haven't problems using object solid. appended obj.js code: define(function(){ return mymodule; }) and use in app.js module requirejs.config({ baseurl : 'lib', paths : { app:'../js/app' } }); require(['app/obj'], function(mymodule){ var someobj = mymodule.getmyobject(); someobj.foo(); someobj.bar(); }); it's ok. how can split mymodule submodules? example. in module have 1 object, c

ruby on rails - gmap4rails load and add infobox only when marker clicked -

i'm using gmap4rails v2 rails 4.1 , instead of loading of infoboxes @ once, inefficient, load contents info box of particular marker once marker clicked. came following select marker. markers = handler.addmarkers(<%= raw(@hash.to_json) %>); _.each(markers, function(marker){ google.maps.event.addlistener(handler.getmap(), 'click', function(){ marker.infowindow(); }); }); but i'm not sure how can send query user table needed attributes example user.name , user.photo used in infobox . the full gmaps handler here: var handler = gmaps.build('google', { markers: { maxrandomdistance: null, clusterer: undefined } }), maxzoom = 14; handler.buildmap({ provider: { maptypecontrol: false, maptypeid: google.maps.maptypeid.roadmap, streetviewcontrol: false, doclustering: false, minzoom: 5 }, internal: {id: 'big_map'}}, function(){ mark

c# - Scraping based on dropdown list -

#document <html> <head></head> <body bgcolor="f2f2f2" leftmargin="0" topmargin="5"> <style> ... </style> <table width="100%""> <tbody> <tr></tr> <tr> <form id="frmfindparts"></form> <td> <select id="selyear" onchange="document.getelementbyid('frmfindparts'). submit();" name="year"> <option value="">2015</option> </td> </tr> <tr>...</tr></tbody></table> i need xapth should scrape value 2015 here code when

Validations on money-rails gem -

i have money-rails gem installed , it's working flawlessly. however, there no validations on money objects when create new model record. if try input letters money field, form submission successful, sets value 0. how validations working? have no code actual validation, seeing money-rails on github states has validations included, have tried validates_numericality_of no avail. edit yes have read docs extensively, , tried validation option suggested on github. i have example hope you monetize :price_cents, :numericality => {:greater_than => 0, :less_than => 10} validates :price, :format => { :with => /\a\d+(?:\.\d{0,2})?\z/ } just 1 of them (monetize validation) validate numericality stuff , other 1 validate format.

javascript - JS call to function in php page - syntax issue -

hi tring call js function in php file using echo ""; , it's not working, if call without echo it's work, missing here ? this way it's work: <a href='#' onclick='delfrmvbar("dlsyg","<?php echo $sgid;?>","<?php echo $sgid;?>")'>x</a>&nbsp;</span> and way not (i tried without - ' sign) echo "<a href='#' onclick='delfrmvbar('dlsyg','$sgid','$sgid')'>x</a>&nbsp;</span>"; your single quotes issue because use single quotes wrap onclick attribute, use them again around arguments. example solution: use double quotes around attribute , escape. echo "<a href='#' onclick=\"delfrmvbar('dlsyg','$sgid','$sgid')\">x</a>&nbsp;</span>"; this render html below, syntactically correct: <a href='#' onclick="delfr

linq - DbContext with IQueryable entities write custom queries -

i stuck requirement past of couple days without progress. our database layer handled through dbcontext repository , unit of work pattern. works on poko classes generate queries. public virtual iqueryable<ent> all(params expression<func<ent, object>>[] includes) { iqueryable<ent> query = set; query = addincludestoqry(query, includes); return query; } protected dbset<ent> set { { return ctxt.set<ent>(); } } protected virtual iqueryable<ent> addincludestoqry(iqueryable<ent> query, params expression<func<ent, object>>[] includes) { expression<func<ent, object>>[] includestouse = d2l.nullorempty(includes) ? defaultincludes : includes; if (d2l.nullorempty(includestouse)) return query; foreach (var incl in includestouse) { query = query.include(incl); } return query; }

ios - open infowindow on google maps marker when app launch -

i'm new ios development google maps sdk ios. i'm working on iphone application & want open info window of google map markers when app launching. (pop info window default, without clicking on marker balloon). is there way accomplish task? here code: gmsmarker *marker = [[gmsmarker alloc] init]; marker.flat = yes; marker.appearanimation=yes; marker.position = cllocationcoordinate2dmake(lt,ln); marker.title = name; marker.snippet = type; [self.mapview setselectedmarker:marker]; marker.map = self.mapview; where calling code? might want try putting in viewwillappear or viewdidappear . may setting selected marker doesn't work until after map has started rendering.

javascript - Auto resize innerWidth & innerHeight based on the viewport when using the Colorbox jquery plugin -

i using latest version of colorbox jquery plugin open iframe - i'd have open , resize correctly depending on size of viewport, have far $(document).ready(function(){ $(".youtube").colorbox({iframe:true, innerwidth:640, innerheight:390}); }); any ideas have open @ suitable size mobile etc.. you didn't specify meant exactly. make 100% no matter what. $(document).ready(function(){ var w = $(window).innerwidth(); var h = $(window).innerheight(); $(".youtube").colorbox({iframe:true, innerwidth: w, innerheight:h}); }); $(window).resize( function(){ var w = $(window).innerwidth(); var h = $(window).innerheight(); $('.youtube').css('width',w,'height',h) });

Non WAR JSP spring-boot example -

i've been checking out of spring-boot provided examples jsp view technologie being packaged war artifacts. would nice provide jar example if possible? i know jsp requires servlet engine/servlet container opposed e.g freemarker .. rendering .. being jetty or tomcat servlet containers option viable , possible ? trying setup far not success, last try create meta-inf/resources folder put jsp resources still not visible viewresolver @bean public viewresolver jspviewresolver() { internalresourceviewresolver viewresolver = new internalresourceviewresolver(); viewresolver.setprefix("/meta-inf/resources/jsp/"); viewresolver.setsuffix(".jsp"); viewresolver.setorder(2); return viewresolver; } at end.. trying setup here: http://alexismp.wordpress.com/2010/04/28/web-inflib-jarmeta-infresources/ thanks afaik it's not possible (owing limitations imposed containers): http://docs.spring.io/spring-boot/docs/current/reference/h

java - Why I am gatting getting Parcelable encountered IOException when try to pass an Interface object through intent -

i trying pass interface object through intent. public interface ilockkeyconfig extends serializable{ public void onkeyconfigchage(); } // doing in activity intent intent = new intent(lockscreensettings.this,buttoncustomization.class); ilockkeyconfig ilockkeyconfig = new ilockkeyconfig() { @override public void onkeyconfigchage() { system.out.println("onkeyconfigchage called"); } }; object[] keconfig = {lockscreenkeylist.get(position),ilockkeyconfig}; intent.putextra("keyconfigobj", keconfig); startactivity(intent); //and in activity b doing... private void getintentdata() { object[] keyconfigobj = (object[]) getintent().getserializableextra("keyconfigobj"); keyconfig = (keyconfig) keyconfigobj[0]; ilockkeyconfig = (ilockkeyconfig) keyconfigobj[1]; } but above code getting following error: `06-27

java - How do I deserialize this JSON type -

i have json looks this: { "results": { "exchange": [ "site.com", { "currency": "usd", "last_traded": "2015.24" } ] } } how last_traded value? i wrote pojo this, can't seem find way key-value inside exchange array. public class exchangecontainer { @expose private results results; public results getresults() { return results; } public void setresults(results results) { this.results = results; } @override public string tostring() { return tostringbuilder.reflectiontostring(this); } } public class results { @expose private list<string> exchange = new arraylist<string>(); public list<string> getexchange() { return exchange; } public void setexchange(list<string> exchange) { this.exchange

javascript - Appending email body message -

i working on easy javascript, wherein user clicks checkbox, , our email client brought up, ready send email. have information need, , appears should when email client brought up, have signiture email erased whenever "?body=text" stuff. i wondering (as finding difficult find on own) if there way append text email through javascript, rather replace text.

c - Unable to connect with multiple client with my socket server program -

my socket server program mentioned below. works fine single client when try connect client @ same time, unable connect. have defined max_clients in program 2 still why unable connect multiple clients? correct process connect multiple client? able connect multiple client modifying code? possible fix? socket server code: #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <error.h> #include <strings.h> #include <unistd.h> #include <arpa/inet.h> #define error -1 #define max_clients 2 #define max_data 1024 main (int argc, char **argv){ struct sockaddr_in server; struct sockaddr_in client; int sock; int new; int sockaddr_len = sizeof (struct sockaddr_in); int data_len; char data [max_data]; if ((sock = socket (af_inet, sock_stream, 0)) == -1) { perror ("socket: "); exit (-1); } pri

php - Fullcalendar settings from mysql -

is possible set following setting of fullcalendar.js mysql, or file? $(document).ready(function() { var date = new date(); var d = date.getdate(); var m = date.getmonth(); var y = date.getfullyear(); var calendar = $('#calendar').fullcalendar({ editable: true, alldayslot: true, alldaytext: 'celý den', firsthour: 8, slotminutes: 30, defaulteventminutes: 120, defaultview: 'resourceday', axisformat: 'hh:mm', timeformat: { agenda: 'h:mm{ - h:mm}' }, dragopacity: { agenda: .5 }, mintime: 8, maxtime: 18, header: { left: 'prev,next today', center: 'title', right: 'month,resourceday' }, .. i need user can edit through interface make.

php - export data into CSV format and store the csv file in the server -

how save csv file in server containing data fetching form mysql dtatbase? want download database in csv format.i able download contants directly, need save fetched data server , provide user link download data xls or csv format. new field , don't have idea how save csv file in server itself. you can first query database required conditions , write contents csv file on application server & later on provide link file in application. may check following link on how obtain data, convert csv & write file : php code convert mysql query csv

java - Android L - Floating Action Button (FAB) -

did google released defined style or component new circular fab button or should implement design on own? the button described here: google design | floating action buttons edit (05/2015): check lukas' answer / gabriele's answer showing easy way implement design support library. update : there's official widget fab: floatingactionbutton, see gabriele mariotti reply full information. according adam powell , chet haase didn't create widget fab button cause it's easy component reproduce. there question in google io 2014 speech "google i/o 2014 - material science: developing android applications material design", @ end of speech (at 37:50) there question, can hear here: https://www.youtube.com/watch?v=lsh9akxjgt8#t=2280 chet haase says there's roundedbitmapdrawable (i didn't check if that's name) should job of defining outline. but can own drawable, set elevation , define circle outline programmatically. this should giv

sql server - SELECTing from multiple views -

i pulling information database using views. in aforementioned views, need have layer responsible picking information views. the views pretty large, , have same types of information in them (there few flags responsible picking correct type of information specific layer). visualize example different layers in merchandise. pallet (view3) of items, each item wrapped in case (view2), case holds x items, , items base layer (view1). example: view1(single item) view2 (multiple items) view3 (all items) 10 cols 8 cols 4 cols what's special views, of columns have same name in 3 views. column named "name" same in view1, view2 , view3, different physical layers different in amount of information that's pulled each one. should scrap this, , put inside 1 view, , select on flags there? the sql responsible pulling information views supposed stored procedure. input id , region code, , presented different layers item. you

java - Regular expression - allow space and any number of digits -

my valid string should either "1234" or " 1234" allow one or 0 space @ beginning then followed number of digits only so should regular expression ? you can use this: ^ ?\d+$ which easier read this: ^[ ]?\d+$ see demo . to test if have match, can (for instance): if (subjectstring.matches("[ ]?\\d+")) { // matched! } else { // nah, didn't match... } here don't need ^ , $ anchors, because matches method looks exact match. explanation the ^ anchor asserts @ beginning of string. depending on method used, these anchors may not needed. [ ]? matches 0 or 1 space. brackets not needed, make easier read. can remove them. do not use \s there matches newlines , tabs. \d+ matches 1 or more digits the $ anchor asserts @ end of string

php - Modifying whole column Type Code PHPExcel -

i have been doing program format xls, opening, modifying , saving it. it taking time showing me timeout error change functions execute change of typecode on cells on whole column , not on every cell. my current sentence is: $sheet->getstyle($currenticell)->getnumberformat()->setformatcode('0000'); and inside loop while until last row reached. i wonder if there function setformatcode on column , not cell. thank in advance. don't set style every individual cell, that's enormous processing , memory overhead; set style range of cells in single call: $sheet->getstyle('a1:a255') ->getnumberformat() ->setformatcode('0000');

delphi - Migrate From DevArt UniDac To FireDac -

i've been using unidac 2 years , best solution me, because doesn't support asynch query's have move on firedac there quick migration wizard or can use because have around 200+ tunistoredproc components in form , convert them tfdstoredproc, doing every 1 of them hand take allot of time, , dont have, replace them old tunistoredproc tfdstoredproc my setup: embarcadero rad studio xe5 the components connected mssql database here sollution ** warning not perfect, ant may cause databinding loss opened forms ** please recheck databindings once finished have backup in case. download , install notepad++ install , open press ctrl+shift+f select find in files find what: tunistoredproc replace with: tfdstoredproc filters: .pas; .dfm directory: project directory press replace in files find what: tuniconnection replace with: tfdconnection filters: .pas; .dfm directory: project directory press replace in files find what: ;1 replace with: (leave empty) filte

Updating XML Tag Values using VB.NET -

i need update below xml using vb.net code. tags added , need update value. <?xml version="1.0" encoding="utf-8"?> <test xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"> <language>eng</language> <statement/> <statement2/> <statement3/> <size/> <language>fra</language> <statement/> <statement2/> <statement3/> <size/> <language>spa</language> <statement/> <statement2/> <statement3/> <size/> <attribute>a</attribute> <containment/> <attribute>b</attribute> <containment/> </test> there no parent tags in xml. for eng need update statement, statement2, , statement3. same case spa , fra. data going different. means statement spa ,

Kendo grid paging throwing an java script error kendo.aspnetmvc.min.js file -

i working on kendo grid. have implemented ajax binding default paging. in ie10 getting javascript error in aspnetmvc.min.js file before pageload. once page loaded working perfectly. below code have used .cshtml -------- <div> @(html.kendo().grid<kendouiajaxbinding.model.pm_ano>() .name("grid") .datasource(datasource => datasource .ajax() .read(read => read.action("products_read", "home") .data("productsreaddata") ) ) .columns(columns => { columns.bound(anomaly => anomaly.god); columns.bound(anomaly => anomaly.ver); // create column bound productid property columns.bound(anomaly => anomaly.c_ano); // create column bound productname property columns.bound(anomaly => anomaly.y_ano); // create column bound unitsinstock property columns.bound(anomaly => anomaly.z_rep_auto

javascript - Listen for changes in DOM -

i working on reflection of part of website. relevant html: <div id = "original"> <img src = "picture.png" alt = "a picture" id = "picture"> <p id = "text">some text</p> </div> <div id = "reflection"></div> my idea copying content of div#original div#reflection this: <script> function reflect() { var original = document.getelementbyid("original"); var reflection = document.getelementbyid("reflection"); reflection.innerhtml = original.innerhtml; } </script> i aware, make html invalid, in whole project iterate through elements copied , set ids not have side effect. thought unnecessary include here. the problem have html want reflect dynamic, may change. reflection wrong. have searched event handler this, haven't found one. 1 near found onchange, apparently listens changes in attributes, not child

c# - Determine missing translations in RESX files -

for globalized c# windows forms projects set designer value localizable true store default labels automatically resx files. my question is: there build-in way or setting determine , log resourcemanager.getstring("translatedlabel", resourceculture); wasn't able find translation given resourceculture , therefore took value invariant resx file? nice have these issues reported within error log. till can find projects compare resx files , try find missing keys (e.g. http://www.codeproject.com/articles/322037/localization-sync ). tools need take care of every single component translated. possibility miss 1 way high. one way find missing resx entries using resex . vs extension displays resources in different languages side-by-side , highlights missing entries in red. can filter view show resources missing entries.

javascript - Conflict between two js scripts (galleria and multi-screen) -

i've tried looking up, can't seem find makes sense me. have project in 2 of scripts seem clashing. 1 of them multi-screen.js ( http://www.jqueryscript.net/animation/full-page-slide-transitions-with-jquery-multi-screen-js-plugin.html )and other galleria.js. if comment out multiscreen, galleria works perfectly, if multiscreen active navigation in galleria gallery wont work - shows pictures , thumbnails. so seems multi-screen blocking of functionality out of other scripts. i hope tell how sort thing out, driving me mad. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <script src="js/galleria/galleria-1.3.6.min.js"></script> <script type="text/javascript" src="js/multi-screen.js"></script> <!-- run plugin --> <script type="text/javascript">$(document).ready(function() { multiscreen.init(); });</script>

My Device is not detected to test my Android App -

i trying test application in phone. following link. link but device not showing in device chooser. using sony xperia sola test app. but if use micromax a089, working fine. why sony not working. please let me idea. i think drivers of phone not installed, installing mobogeine might detect device!

android - Is it possible to start account authenticator activity from the abstractAccountAuthenticator -

i have created custom account application,now when use third party application,in case of no account present,i launch login/sign activity application(my custom account application).is possible?or have pass intent accountmanagercallback , launch intent. essentially handiwork within application , return the calling application access token. and can explain me setaccountauthenticatorresult(bundle) method.where return to? http://developer.android.com/reference/android/accounts/accountauthenticatoractivity.html#setaccountauthenticatorresult(android.os.bundle) so solution involved invalidating current token.this force accountauthenticatoractivity gain control handle situation required.

javascript - Mouse position on scaled canvas -

i have canvas 100% width , height . it part of remote desktop working on. stuck because mouse position not reflect position on canvas correctly. when send data desktop have compensate different screen sizes. var x = math.floor( mouse.x / canvas.width * 100 ); var y = math.floor( mouse.y / canvas.height * 100 ); however when try draw on canvas x , z values not getting correct positions. the reason need canvas / trying use percentage is going overlay on top of video. , user has draw rectangle around video offset because videos display black sidebars aspect ratios. here example of canvas not put rectangle in right position: http://jsfiddle.net/74cp8/ edit: fyi: firefox not seem run jsfiddle due way jsfiddle works apparently. try chrome. i'm not sure of want, here 2 possible solutions : the first allows move correctly mouse in scaled canvas http://jsfiddle.net/74cp8/1/ the second allows draw rectangle top left corner bottom right corner. http:/

ASP.NET MVC3 - Display accented string in TextBoxFor -

i'm working on asp.net mvc3 project. in basic update page, i'm trying display data recorded in db textboxfor . however, data can contain special characters, quote ' or accented letters é when write @html.textboxfor(m => m.myproperty) the displayed text looks l&#39;av&#233;e instead of l'avée . i've seen this question answer doesn't change me. is there way display string properly accented letters , quotes in textboxfor ? update this field in partial view containing field : @model myapp.models.somemodel <div class="form-group"> @html.labelfor(m => m.mymodel.submodel.myproperty) @html.textboxfor(m => m.mymodel.submodel.myproperty, new { @class = "form-control", @id = "txtmyproperty" })*@ </div> here, somemodel correctly displayed (believe me). somemodel has mymodel property. mymodel has somemodel property somemodel has myfield field. everything correctly

mysql - CakePHP hasOne association returns array of empty fields for non-existant record -

have user , userprofile models. user model has hasone association userprofile. userprofile mysql table empty. when $this->user->find('all', array('contain' => array('userprofile'))) instead of empty userprofile array, expect, array populated empty fields correspond schema: array ( [0] => array ( [user] => array ( [id] => 1 [firstname] => joe [surname] => bloggs [email] => katie.barnes@scotlandsdna.com [password] => $2a$10$re4r7axwqcxgkkcabuqmto6j.7p2ba1t2sleg93evsidpbggaexrs [enabled] => 1 [user_group_id] => 1 [created] => 2014-06-26 15:01:38 [modified] => 2014-06-26 15:01:38 ) [userprofile] => array ( [id] =>

html5 - using single canvas i have drawn two different diagrams using javascript,is there any way i can remove last drawn diagram in canvas -

using single canvas element have drawn 2 different diagrams using javascript,is there way remove last drawn diagram in canvas.here canvas code <canvas style="width: 100px; height: 100px; border: 1px solid red;" id="cns"></canvas> , have created diagram using javascript , in button click trying remove last drawn diagram var c = document.getelementbyid("cns"); var d = c.getcontext("2d"); d.fillstyle = "#ff0000"; d.fillrect(0, 0, 106, 106); var c1 = document.getelementbyid("cns"); var d1= c.getcontext("2d"); d1.fillstyle = "#00a550"; d1.fillrect(0, 0, 90, 90); $("#clk").click(function () { d1.clearrect(0, 0, 90, 90); }); ,but clears whole rectangle on given size.is there clear last drawn image i see you're getting multiple references same canvas (id=cns) , multiple references context. for single canvas, there 1-and-only-1 con

javascript - Sending Active element from all clients to server -

lets have collaborative text-editor. collaborator writing on paragraph a. collaborator b writing on paragraph b. collaborator c writing on paragraph c. i want send active element of a,b,c (element focused) server , emit client. need help. there information on internet. you can try complete tutorial of chat socket.io: http://socket.io/get-started/chat/ here project: https://github.com/laktek/realie

java - Null Pointer Exception when using CustomList Adapter -

i trying create list view inside fragment. array causing null pointer exception being taken separate class called "getdata". to create list view using custom list adapter. when put array custom list adapter error. fragment error evolves: package com.example.testapp; import android.os.bundle; public class fragmenta extends fragment { @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view v = inflater.inflate(r.layout.fragment_a, container, false); listview listview = (listview)v.findviewbyid(r.id.list); integer[] imageid = { r.drawable.ic_launcher, r.drawable.ic_launcher, }; getdata data = getdata.getmydata(); customlist adapter = new customlist(getactivity(), data.myarray, imageid); //this put array. listview.setadapter(adapter); return v; } } getdata class (where array taken from):

php - Correct regular expression -

i need php regex matches http://bla/bla/bla/variable-text/numbers/ where blass same, variable text changes , can have inside minus (-) , after slash numbers there 5 digits. i've tried regex, i'm quite rusty , cannot find right one, 1 i've tried /(http:\/\/bla\/bla\/bla\/)([:alnum:]-)\/([:num:]{5})/ but doesn't work. any suggestion? thank you! you can use regex in php: ~\b(http://bla/bla/bla)/([\da-z-]+)/(\d{5})\b~i working demo

java - how to use nested EL in this case? -

i have empid 600 , custid 400 under session object. want apply jstl function on it. want apply project specific taglib function on "600-400" i tried below "${myproject:taglib(${sessionscope.empid}-${sessionscope.custid})}" but getting below error javax.el.elexception: failed parse expression [${myproject:taglibfunction(${sessionscope.empid] i know can in 2 separate lines i.e <c:set var="intermediatevar" value="${sessionscope.empid}-${sessionscope.custid}" scope="page" /> var finalvalue= "${myproject:taglibfunction(intermediatevar)}"; but there way can in single line ? when within expression should not have ${} again. try: edit: types variables empid , custid? type argument taglibfunction? question looks method looking string concatenation of empid (dash) custid. without more details end function/variables guessing here instead of: "${myproject:taglibfunction(sessionscope.em