Posts

Showing posts from July, 2011

c# - Sending and receiving plain text with TCP -

i want send string through tcp connection: tr220,2,a10000xx,3545.1743,5119.5794,001.0,1503,52:56:16,2012/09/13,0,0,0,0,0,v,000,0,0,0,,+989123456789,* i using code send text: string uri = "http://localhost:1414"; string record = "tr220,2,a10000xx,3545.1743,5119.5794,001.0,1503,52:56:16,2012/09/13,0,0,0,0,0,v,000,0,0,0,,+989123456789,*"; httpwebrequest request = (httpwebrequest) webrequest.create(uri); request.method = "post"; byte[] postbytes = getbytes(record); request.contenttype = "text/plain"; request.contentlength = postbytes.length; stream requeststream = request.getrequeststream(); requeststream.write(postbytes, 0, postbytes.length); and getbytes method: private byte[] getbytes(string str) { byte[] bytes = new byte[str.length * sizeof(char)]; system.buffer.blockcopy(str.tochararray(), 0, bytes, 0, bytes.length); return bytes; } after sending request, in other side app, string: post / http/1.1\r\ncontent-type: t

foundation - NSString compare efficiency -

string compares can costly. there's statistic floating around says high percent of string compares can eliminated first comparing string sizes. i'm curious know whether nsstring compare: method takes consideration. know? according sources here (which 1 implementation, others may act differently), compare doesn't check length first, makes sense since it's not equality check. returns less-than/equal-to/greater-than return code, has check characters, if lengths same. a pure isequal -type method may able shortcut character checks if lengths different, compare not have luxury. it checks of length against zero, not comparisons of 2 lengths against each other.

ios - Removed pod also removed the associated Framework -

i had podfile looked this: platform :ios, '6.0' xcodeproj 'netapp.xcodeproj' pod 'afnetworking' pod 'tttattributedlabel' pod '[x]' decided remove pod '[x]' podfile, ran pod install , pod update . following warnings: systemconfiguration framework not found in project, or not included in precompiled header. network reachability functionality not available. mobilecoreservices framework not found in project, or not included in precompiled header. automatic mime type detection when uploading files in multipart requests not available. i have tried add frameworks manually both in pods , xcode-projplace . dosn't seem work, , functionality missing. how can resolve this? possible reinstall pods way? update seems wasn't removal of pod caused it. did git revert . when ran pod update (updated afnetworking ) warnings came back. just import header files in projectname-prefix.pch #ifdef __objc__ ... #impor

jquery - phonegap page transition issue -

i making simple application in have image image map, , when click on image map page loads. using href property in tag navigate new page. of being done on single page. when click on image map transition should smooth , second page should loaded (this natural behavior should be) getting page transition choppy , second page isn't loaded, nothing displayed on screen, , elements displayed after tap couple of times on screen. i tried looking solution couldn't find anything. the earlier application had built never ad such issue, , of sudden issue came in second application. <!doctype html> <html> <head> <meta charset="utf-8"> <title>india stats</title> <link href="css/jquery.mobile-1.3.1.css" rel="stylesheet" type="text/css"> </head> <body> <div id="listpage" data-role="page"> <div data-role="header" data-position="fixed"

c++ - sizeof returns wrong value if argument is passed via function -

this question has answer here: when function has specific-size array parameter, why replaced pointer? 3 answers let me ask question test program: #include <iostream> void testsizeof(char* buf, int expected) { std::cout << "buf sizeof " << sizeof(buf) << " expected " << expected << std::endl; } int main () { char buf[80]; testsizeof(buf, sizeof(buf)); return 0; } output: buf sizeof 8 expected 80 why receve 8 instead of 80 ? upd found similar question when function has specific-size array parameter, why replaced pointer? you're taking size of char* , not of array of 80 characters. once it's decayed pointer, it's no longer seen array of 80 characters in testsizeof. it's seen normal char* . as possible reason why, consider code: char* ch = new char[42];

SQL Server 2005 column not visible at asp.net mvc4 controller -

i using asp.net mvc4 , sql server 2005 develop web application. working fine got stuck @ point. updated table new column no_person , updated .edmx file. updated column showing in .edmx designer page when trying access field @ controller side not showing in pop suggestion window , getting error table not contain definition of field no_person i updated library.dll file , tried rebuild project, getting same error. any suggestion please help.

asp.net mvc 3 - how to dynamically edit the bind data in sql using mvc3 web grid -

i new mvc.. have task that, have bind data existing table in sql using asp.net mvc3(razor) web grid .. have edit data in webgrid.. dont know how edit operation going made... plzz me out... i have given bind data.. plz let me know how edit it... controller: public actionresult index() { var list = getlist(); return view(list); } public list<teacher> getlist() { var modellist = new list<teacher>(); using (sqlconnection conn = new sqlconnection(@"integrated security=sspi;persist security info=false;initial catalog=demo;data source=cipl41\sqlexpress")) { conn.open(); sqlcommand dcmd = new sqlcommand("select t_id,t_name,t_address,sub_id teacher", conn); sqldataadapter da = new sqldataadapter(dcmd); dataset ds = new dataset(); da.fill(ds); conn.close(); (int = 0; <= ds.tables[0].rows.count - 1; i++)

actionscript 3 - Remove discovered cards -

i'm creating flash "memory" game, idea discover 2 equal cards. fine, need make when cards discovered deleted. stay shown. when try: removechild(_card.currenttarget._type); i receive error: c:\...\memorygame.as, line 202 1119: access of possibly undefined property currenttarget through reference static type card. here part of code: for(var l:number = 0; l < 2; l++) { _card = new card(); addchild(_card); _snow = new snow(); _card.settype(_snow); _card.x = _cardx; _card.y = _cardy; _cardx += _card.width + 50; _card.addeventlistener(mouseevent.click, checkcards); _cards.push(_card); } private function checkcards(event:mouseevent):void { event.currenttarget.removeeventlistener(mouseevent.click, checkcards); if(_firstcard == undefined) { _firstcard = event.currenttarget; } else if(string(_firstcard._type) == string(event.currenttarget._type)) {

MYSQL Select all where value is highest -

Image
in mysql query, how can select of rows value highest example: select unix_timestamp(creation_date) `date`, release_version content id = '1' order `date` desc this output example: note: amount of rows same/different release_version variable , therefore can't use limit. i want select release_version highest (3 in case) how can this? thanks. this as select * content release_version = (select max(release_version) content)

reading registers in hw using python -

my aim read registers on fpga using python script. have implemented registers on hardware (fpga) , trying read registers.there programs in c able read registers. have write read/write program in python can integrate verifcation environment (written in python). new python (beginner level) wish can guide me through suggestions , comments. below code implemented. this code. #!/usr/bin/env python import array import fcntl import re import socket import struct import os #connectedsockets = {} # ioctl commands siocregread = 0x89f0 siocregwrite = 0x89f1 reg = 0x58000008 # open nf descriptor # open file nf = os.open( "/dev/nf10", os.o_rdwr ) print "opened nf descriptor" # file object above file. nf0 = os.fdopen(nf, "w+") #print "opened nf0 file object" inner_struct = struct.pack("ii", reg, 0x0) inner_struct_pinned = array.array('c', inner_struct) print inner_struct_pinned fcntl.ioctl(nf0, siocregread,) retval = struct.un

where to define a rails view table and instead a mysql table is created -

i using ror3.2 , have bunch of model objects now. 1 thing i'd have mysql view i'm not sure put it. class createqv < activerecord::migration def execute <<-sql drop view qv sql execute <<-sql2 #abbreviated view create view qv select locations.name val locations (locations.is_enabled = 1) union select concat(menu_items.header,' ',menu_items.detail) val menu_items (menu_items.is_enabled = 1) sql2 end end and update via rake db:reset but creates table , i'm not sure why. proper way of creating view? if yes, why table created? thx afaik that's right behavior view, create pseudo table, gets updated every time update associated tables. question me is: why create view rails app? reason create view i'm aware of, deny users full access data. in rails app, control show whom , can change. i might wrong though i'm not familiar relational databases. edit: can test whether view works creating new lo

mobile - How to reload the CSS file after orientation change (phone)? -

for gallery on website use media queries readjust image sizes depending on screen width (i use folio theme galleria) , image size supposed change when tilt phone - happens after reload manually. (adding orientation landscape or portrait doesn't anything). so basically, want avoid reloading whole page because involves reloading images - information in css file, can reload file individually? thanks bunch! all recent smartphone , tablet browsers support media queries based on orientation, see article here . mentioned there supported ios 4.0 upwards. if scroll down bonus: iphone support section provides workaround phones quirky triggering automatically. if specify media query part of css include shouldn't loaded until becomes applicable, automatically solving problem. if still run platforms have problems, can use javascript onorientationchange event fallback, using example mootools utility/asset load images , stylesheets @ runtime, or jquery counterpart.

onclick - Add onRightClick to JavaScript lib Hypertree -

i'm working (a repo here ) on hypertree graph, want use javascript infovis toolkit . issue follows: added specific events hypertree, onclick , onrightclick . events: { enable: true, onclick: function(node, eventinfo, e) { ht.controller.oncomplete(); }, onrightclick: function(node, eventinfo, e) { ht.controller.oncomplete(); }, }, then attached veent handlers hypertree labels, modifying demo-code little: //attach event handlers , add text //labels. method triggered on label //creation oncreatelabel: function(domelement, node){ domelement.innerhtml = node.name; $jit.util.addevent(domelement, 'click', function () { ht.onrightclick(node.id, { oncomplete: function() { ht.controller.oncomplete(); } }); }); $jit.util.addevent(domelement, 'rclick', function () { ht.oncli

provider named pipes provider error 40 - could not open a connection to sql server 2008 -

sql server name : ecare432 instance name : sqlexpress app.config contains: <connectionstrings> <add name="timetracker.properties.settings.myecareconnectionstring" connectionstring="data source=ecare432;initial catalog=myecare;persist security info=true;user id=sa;password=ecare123@" providername="system.data.sqlclient"/> </connectionstrings> i have developed first application in wpf (c#) vs 2008 & sql server 2008. works fine on system. after deployment, doesn't work on other systems. it shows following error message. provider named pipes provider error 40 - not open connection sql server 2008 i have gone through google , done following steps no use. configuration tools -> sql server configuration manager -> sql native client configuration aliases -> alias name -> ecare432,1433, port number -> 1433, protocol -> tcp/ip, server name -> ecare432 tcp/ip enabled. proto

c++ - Indicating (non) transfer of ownership with unique_ptr -

suppose have class this: class node { public: node(node* parent = 0) : mparent(parent) {} virtual ~node() { for(auto p : mchildren) delete p; } // takes ownership void addchild(node* n); // returns object ownership node* firstchild() const; // not take ownership void setparent(node* n) { mparent = n; } // returns parent, not transfer ownership node* parent() const { return mparent; } private: list<node*> mchildren; node* mparent; }; i'd use smart pointers and/or rvalue references indicate ownership , isn't transferred. my first guess change mchildren contain unique_ptr s, adapting function signatures follows. // takes ownership void addchild(unique_ptr<node> n); // returns object ownership unique_ptr<node>& firstchild() const; // not take ownership void setparent(node* n) { mparent = n; } // returns parent, not transfer ownership node* parent() const {

javascript - Add CSS when there's an error -

i have simple login page i'm having trouble with. when type in incorrect info runs alert, want add css backgrounds of fields makes them red. how go editing following code this? here's fiddle. thanks. <html> <head> <link rel="stylesheet" type="text/css" href="styles.css" /> <title>jeremy blaz&eacute;</title> </head> <body> <div id="box"> <img src="logo.png" /> <form name="login"> <input type="text" name="userid" placeholder="username" /> <input type="password" name="pswrd" placeholder="password" /> <input type="submit" class="button" onclick="check(this.form)" placeholder="password" value="sign in" /> </form> </div> <script lang

mysql - PHP If Else statement not redirecting correctly? -

i'm trying create if else statement if user isn't logged in send him homepage, otherwise, can go dashboard.php // check see if user logged in if ($_session['kt_login_id'] == '') { header( 'location: index.php' ); } else if ($_session['kt_login_id'] != '') { header( 'location: dashboard.php' ); }; in firefox receive error saying page trying redirect in way isn't possible? it you've written content page how make redirect in php? states that you can use header() function send new http header, must sent browser before html or text (so before declaration, example).

performance - improving speed of Python module import -

the question of how speed importing of python modules has been asked ( speeding python "import" loader , python -- speed imports? ) without specific examples , has not yielded accepted solutions. therefore take issue again here, time specific example. i have python script loads 3-d image stack disk, smooths it, , displays movie. call script system command prompt when want view data. i'm ok 700 ms takes smooth data comparable matlab. however, takes additional 650 ms import modules. user's perspective python code runs @ half speed. this series of modules i'm importing: import numpy np import matplotlib.pyplot plt import matplotlib.animation animation import scipy.ndimage import scipy.signal import sys import os of course, not modules equally slow import. chief culprits are: matplotlib.pyplot [300ms] numpy [110ms] scipy.signal [200ms] i have experimented using from , isn't faster. since matplotlib main culprit , it's go

wso2 - How to Access the Client Header Request -

i getting data mobile client sending data in json sending values header wso2esb getting normal values using property <property name="asset" expression="//asset/text()" scope="default"/> but how can header in esb using property not not working <property name="username" expression="get-property('transport', 'accept')"/> how work revert me in advance <property name="username" expression="get-property('transport', 'accept')"/> in configuration trying assign http header named 'accept' property named 'username'. if 'username' want access http headers, should like: <property name="some_name_here" expression="get-property('transport', 'username')"/>

python - django tastypie - api authentication ? its server for ios app -

i building ios app talks django server getting data. this app uses facebook authentication login, thinking this: in ios app, after clicking login button(fb auth), userdata(like username, email etc facebook) , access_token. store username , accesstoken in ios app somewhere(like session) , every call server getting data, send these 2 also(username , accesstoken). in server, tasty pie has authentication can customised this: class sillyauthentication(authentication): def is_authenticated(self, request, **kwargs): user = user.objects.get(username=username) -- username sent ios app. #checking token sent token saved during registration. #i hope, fb sends same authtoken everytime logins. if user.userprofile.access_token == access_token: return true return false so, means, everytime request sent ios app, need send username, accesstoken. got mind, not sure if right or wrong .

jquery - opening new colorbox from a colorbox and sending data to it -

i want open new page color box onclick. problem in colorbox , need send parameter new page. opening colorbox normal method not working. tried , didn't work. should do?(i need send uuid 1 page in colorbox page in colorbox) function openaddcarbox(i) { var uuid = document.getelementsbyname('uuid' + i).item(0).value; $("#colorbox").colorbox({ iframe : true, innerwidth : 500, innerheight : 300 }); $('#colorbox').colorbox({ href : 'vehicle.jsp?uuid=' + uuid, title : '', open : true }); } try using classes instead of ids following method. i.e. $(document).on("click", ".colorbox", function(){ $.colorbox({ href: $(this).data('url'), iframe : true, innerwidth : 500, innerheight : 300 }); }) <a href="javascript:void(0);" data-url="your link id" class="colorbox"></a>

c++ - initialized pointers are not passed through constructor -

i have 2 classes server , broker . server member in broker , of members initialized when broker members initialized. simple if @ constructors , members: #include <boost/thread/condition_variable.hpp> class server { private: boost::shared_ptr<boost::mutex> broker_client_mutex;//will initialized in constructor boost::shared_ptr<boost::condition_variable> broker_client_register;//will initialized in constructor public: server(boost::shared_ptr<boost::mutex> broker_client_mutex_, boost::shared_ptr<boost::condition_variable> broker_client_register_) : broker_client_mutex(broker_client_mutex_), broker_client_register(broker_client_register_) {//some log std::cout << "1.server starting mutexes:\n" "broker_client_mutex_[" << broker_client_mutex << "]\n"

windows - Understanding sox's progress details -

i'm trying trim silence mp3 file, , parse progress details: g:\testing\test>sox -s trim.mp3 trim2.mp3 reverse silence 1 0.1 0.1% reverse input file : 'trim.mp3' channels : 2 sample rate : 44100 precision : 16-bit duration : 00:04:24.06 = 11644870 samples = 19804.2 cdda sectors sample encoding: mpeg audio (layer i, ii or iii) in:100% 00:04:23.96 [00:00:00.09] out:11.6m [ | ] hd:0.0 clip:400 sox sox: trim2.mp3: output clipped 400 samples; decrease volume? done. g:\testing\test> i should able parse data, while taking out:11.6m data progress, file's filesize 4.03mb . perhaps data not output filesize? how can correctly conclude progress of encoding task? you right, out value not file size, number of samples. it’s approximately 11644870 samples mentioned in duration field: 264 seconds times 44100 samples per second. uncompressed output, file size proportional number of samples (e.g. @ 16 bits stereo, 4 bytes p

ios - Can't set different value for different dictionary -

i loop through nsdictionaries calculate distance user location annotations this: cllocation *pinlocation = [[cllocation alloc] initwithlatitude:reallatitude longitude:reallongitude]; cllocation *userlocation = [[cllocation alloc] initwithlatitude:mapview.userlocation.coordinate.latitude longitude:mapview.userlocation.coordinate.longitude]; cllocationdistance distance = [pinlocation distancefromlocation:userlocation]; the result: nslog(@"distance: %4.0f m.", distance); 2013-05-04 15:58:53.301 testapp[3194:907] distance: 65758 m. 2013-05-04 15:58:53.304 testapp[3194:907] distance: 91454 m. 2013-05-04 15:58:53.308 testapp[3194:907] distance: 248726 m. 2013-05-04 15:58:53.310 testapp[3194:907] distance: 297228 m. 2013-05-04 15:58:53.313 testapp[3194:907] distance: 163058 m. then try add distance dictionaries

C - Error while running .exe file that I compiled -

i used geany compile code , no errors found. when run .exe file program stops working, , i'm not programmer, work school. my program consists of reading 2 words, in words going count how many letters each 1 has, , divides de number of letters in worda number of letters in wordb. this code #include <stdio.h> int main(int argc, char *argv[]) { int i, j; float n; printf ("insert first word:\n"); for(i=0; argv[1][i] != '\0'; i++); printf ("insert second word:\n"); for(j=0; argv[2][j] != '\0'; j++); n=i/j; printf("%.4f", n); return 0; } in line n = i/j; you performing integer division. so, example, let's i 3 , j 5, perform 3/5 equals 0 . but think looking perform 3.0/5.0 , hoping answer 0.6 . need perform floating point division. can force casting 1 of operands float. n = (float)i/j; in question wrote int rather int . assumed transcription error when as

jquery - How to check Javascripts are disabled by proxy -

i not know weather there way solve or not, i'm asking because believe place of genius people. anyways, know if use <noscript></noscript> tag within html document , if user viewing page , have javascript disabled browser see no script message. if javascript has been disabled proxy? many wifi networks needs manually input proxy use internet , many of them disabled js on proxy proxy server. in case if visit same page, page see javascript has been enabled browser, disabled proxy. if there way check weather javascript has been disabled proxy(if using) , showing alert message this? glad if can how implement wordpress , without wordpress. :) thanks. you can show message default , remove or hide javascript, e.g.: <div id="jsalert">javascript disabled in environment.</div> <script> (function() { var elm = document.getelementbyid("jsalert"); elm.parentnode.removechild(elm); })(); </script> <!-- continue cont

c++ - Macro overloading -

is possible define this: #define foo(x, y) bar() #define foo(x, sth, y) bar(sth) so this: foo("daf", sfdas); foo("fdsfs", something, 5); is translated this: bar(); bar(something); ? edit: actually, bar 's methods of class. sorry not saying before (didn't think relevant). answering dyp's question: class testy { public: void testfunction(std::string one, std::string two, std::string three) { std::cout << 1 << 2 << three; } void anotherone(std::string one) { std::cout << one; } void anotherone(void) { std::cout << ""; } }; #define pp_narg(...) pp_narg_(__va_args__,pp_rseq_n()) #define pp_narg_(...) pp_arg_n(__va_args__) #define pp_arg_n(_1, _2, _3, n, ...) n #define pp_rseq_n() 3, 2, 1, 0 // macro 2 arguments #define foo_2(_1, _2) anotherone() // macro 3 arguments #define foo_3(_1, _2, _3) anotherone(_2) // macro selection number

java - Action Bar Home Button not functional with nested PreferenceScreen -

i found workaround enable actionbar home button on nested preferencescreen... doesn't call onoptionsitemselected in preferenceactivity. know way use home button on nested preferencescreen? modification of post 35 here: http://code.google.com/p/android/issues/detail?id=4611 @override public boolean onpreferencetreeclick(preferencescreen preferencescreen, preference preference) { super.onpreferencetreeclick(preferencescreen, preference); if (preference!=null) if (preference instanceof preferencescreen) if (((preferencescreen)preference).getdialog()!=null) ((preferencescreen)preference).getdialog().getactionbar().sethomebuttonenabled(true); return false; } i had problem , how solved it. firstly access preferencescreen use exact same method mentioned above. @override public boolean onpreferencetreeclick(preferencescreen preferencescreen, preference preference) { super.onpreferen

Java - Sending values from Subclass -

i need sending value subclass superclass. public class { protected int gamesize; public void setbuttons(){ for(int row = 0; row < gamesize; row++) { for(int col = 0; col < gamesize; col++) { buttons[row][col] = new playerbutton(); buttons[row][col].button.addactionlistener((actionlistener) this); buttons[row][col].player = row+""+col; buttons[row][col].button.seticon(new imageicon("src/img/empty.png")); box.add(buttons[row][col].button); } } box.setvisible(true); } } public class b extends { public void actionperformed(actionevent a) { object source = a.getsource(); jbutton pressedbutton = (jbutton)source; if(pressedbutton.gettext() == "start game") { gamesize = integer.parseint(gamesizebox.getselecteditem().tostring().replaceall("x.*","")

What is data-widget-id in twitter api ? How i can get the data-widget-id? -

i have problems previous version of twitter api , want move latest version. see information here https://dev.twitter.com/docs/embedded-timelines . what data-widget-id here. want show specified people tweets in website. how do that? your question answered on twitter developers page. to create timeline must signed in twitter.com , visit widgets section of settings page. page can see list of timelines you've configured , create new timelines. sign in on twitter.com create new widget the widget-id provided twitter (you redirected https://twitter.com/settings/widgets/xxxxxxxxxxxxxxxxxxx/ - xxx widget-id)

java - How to package test classes into the jar without running them? -

i'm struggling including test classes jar package, not running them. after googling, i've tried mvn package -dskiptests , test classes not added jar. any ideas? if youre following maven conventions test classes under src/test/java . maven never packages contents of test sources subdirectory artifact. you have (at least ...) 3 alternativs: put tests "normal" sources if really want them packaged (why?) should place test classes under src/main/java treated normal source , compiled classes packaged artifact (usually *.jar) you imght run sorts of issues doing this. example artifact have compile-scoped dependency on junit, might interfere other modules using jar. also, might have configure maven plugins running tests aware of test classes if (that if ever want run tests part of build). example surefire , failsafe plugins. configure maven jar plugin build tests jar see maven jar plugin documentation . have section titled "how create jar co

java - Retrieve object from database via hibernate -

i'm creating hibernate app , i'm able save data dtb via hibernate . nevertheless wasn't able figure out, how retrieve data database. show me, how in way, similar way, save data? i've been googling lot, everything, didn't find anything, way... e.g. used lot of annotations etc. i'm quite new hibernate, it's possible, not way, how create hibernate applications. if so, pls write in comment. part of userdaoimpl : userdao user; public userdaoimpl() { user = new userdao(); } public void createuser(int id, string username, string createdby) { user.setuserid(id); user.setusername(username); user.setcreatedby(createdby); user.setcreateddate(new date()); } public void saveuser() { session session = hibernateutil.getsessionfactory().opensession(); session.begintransaction(); session.save(user); // save data database session.gettransaction().commit(); // close connection session.disconnect(); } public void findu

c - Struggling to comunicate between processes with signals -

im trying create game in c under linux terminal. i need create tetris game consists of 2 c files, 1 c file create execute file (a.out) , other create (draw.out). first program create child process , execute other. i need send signals other program, found dificult. the source code : the first file- #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <stdbool.h> #include <termios.h> #include <signal.h> char getch(); int main() { int fd[2],pid; char *args[] = { "./draw.out", null },tav; pipe(fd); pid=fork(); if(pid==0) { execve("draw.out", args, null); } else { while(true) kill(0,sigusr2); } return 1; //getchar(); } char getch() { char buf = 0; struct termios old = {0}; if (tcgetattr(0, &old) < 0) perror("tcsetattr()"); old.c_lflag &= ~icanon; old

javascript - When using WebFont loader, how to hardcode the css? -

to load font webfont, suggest here: https://developers.google.com/fonts/docs/webfont_loader webfontconfig = { custom: { families: ['font1', 'font2', 'font3'], urls: [ 'stylesheets/fonts.css' ] }, loading: function(){ console.log('loaded'); }, inactive: function(){ console.log('not loaded'); } }; webfont.load(webfontconfig); but mean broswer wait download of css file before starts loading fonts.the css few lines of code , don't see why not paste directly in js. anyone knowes how achieve ? this not possible ; detection starts when download of css done.

c# - Two way communication between asp.net application and windows application -

is possible have type of communication using signalr : 2 applications not on same machine want asp.net application sends data windows application, windows application makes processing sends data asp.net application. any ideas, how acheive this? yes, can use signalr need set-up server (using signalr) controls flow of information between applications. more details, refer documentation here: http://www.asp.net/signalr

actionbarsherlock sherlockfragment google maps v2 is null -

i'm trying use actionbarsherlock tab bar , in 1 of taps want map. have created map in sherlockfragment google map v2, want add markers programmatically map. public class map_fragment extends sherlockfragment { static final latlng cph = new latlng(55.702355,12.436523); private final static string map_tag = "map"; private googlemap mmap; supportmapfragment mmapfragment; @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate){ supportmapfragment map = (supportmapfragment) (getsherlockactivity().getsupportfragmentmanager().findfragmentbytag(map_tag)); if(map==null){ log.d("map", "null"); } if(map!=null){ log.d("map", " " + map); log.d("getmap", " " + map.getmap()); } //googlemap mmap = map.getmap(); //mmap.movecamera(cameraupdatefactory.newlatlngzoom(cph, 14)); return inflater.inflate(r.layout.m

asp.net mvc - MVC4 Passing Model to Controller - Some of Model Null -

i having problems sending model form on view controller. main class has data in sub classes have lost values. i have main quotation class this: public class quotation { public string quotationid { get; set; } public taxipartner taxipartner { get; set; } public taxicompany taxicompany { get; set; } public int maxnumberofseats { get; set; } public int maxnumberofbags { get; set; } public double price { get; set; } } then example have taxipartner class: public class taxipartner { public string id { get; set; } public string name { get; set; } public list<address> addresses { get; set; } public bool supportspasswordreset { get; set; } public bool supportsvalidatebysms { get; set; } } here form in view @if (model.listofquotations.count > 0) { <h3>you can book online with:</h3> foreach (var item in model.listofquotations) { using (html.beginform("bookingpage1", "searchresults", formmethod

how to link a web page for playing a video created using html5 and google app engine with a python code that detects smile? -

i have created web page (that has video embeded in it) using google app engine , html5. there python code detecing smile.what should invoke python code when play button clicked (i.e.)when video starts play automatically viewers face should detected... app engine code given below.... import webapp2 class mainpage(webapp2.requesthandler): def get(self): self.response.out.write("""<!doctype html> <html> <body> <video width="320" height="240" controls> <source src="/video/mov_bbb.mp4" type="video/mp4"> <source src="/video/mov_bbb.ogg" type="video/ogg"> browser not support video tag. </video> </body> </html>""") app = webapp2.wsgiapplication([('/', mainpage)]) the app.yaml file is....

ios - NSTimer blocks other animations -

Image
description i have nstimer updates uilabel every second. have uiimageview slides in screen when uibutton pressed. issue the problem when nstimer updates uilabel , animation of uimageview stops completing. question please can tell me how can update timer without messing other animations? this common symptom of having auto layout turned on trying slide across screen adjusting frame or center . auto layout ios 6+ feature controls location , size of various uiview elements. unfortunately, when have auto layout on, every time change label's value, reapply constraints dictate label should positioned, defeating attempts animate it. two solutions: turn off auto layout opening storyboard or nib, click on first "document inspector" tab on rightmost panel, , uncheck "use autolayout". if want use autolayout, animate moving of control changing constraints rather changing frame or center . see here example of how can create iboutlet

android - Error when adding dependecy to a trigger.io native plugin -

i developing native plugin , depends on existing library (which built in maven not sure if makes difference). added plugin libs folder , updated inspector project. in adt can see library being added forge inspector plugin in libs folder not added modules build path. i figured caused library being absent build_steps.json file added dependency file: [ { "do": { "android_add_permission": { "permission": "android.permission.write_external_storage" } } }, { "do": { "include_dependencies": { "leveldb-0.6-snapshot": { "hash": "8e7bd9547206ecca974530109983fc8d" } } } } ] after adding dependency updated inspector project , got following error: applying build steps failed, check build steps , re-update inspector: [errno 2] no such file or directory: u'/home/me/forge-workspace/plugins/tri

Javascript: what does this syntax mean (0,functionName)(functionParemeter); -

i wondering javascript file source of http://www.google.com , try understand have done there. today wondering inside files , found strange function calls. maybe silly thing have no idea , couldn't searching it. a readable resemble of code- var somefunction = function(somaeparamenter){ //do stuffs; return something; } var someotherthing = (0, somefunction)(oneparameter); please excuse lack of knowledge. edit: source- i'm using chrome. while in http://www.google.com page open, opened developer tool. opened sources tab , opened file https://www.google.com.bd/xjs/_/js/s/c,sb,cr,cdos,vm,tbui,mb,wobnm,cfm,abd,bihu,kp,lu,m,tnv,amcl,erh,hv,lc,ob,r,rsn,sf,sfa,shb,srl,tbpr,hsm,j,p,pcc,csi/rt=j/ver=wuw4ydif-wi.en_us./am=ga/d=1/sv=1/rs=aitrstpu52cumknqsh0was81vrm4inla_w in viewer. file js file i've seen there. enabled "pretty print" , in line 58 you'll find defination- _.va = function(a) { var b = typeof a; if ("o

Disqus comment count in jQuery UI Tab title -

i'm trying disqus comment count show in tab title of jquery ui tab. disqus says: append #disqus_thread href attribute in links. tell disqus links , return comment count. example: <a href="http://foo.com/bar.html#disqus_thread">link</a>. since link in jquery tab looks this: <a href="#tabs-2">comments</a> i've tried adding #disqus_thread , comment count show breaks tab functionality. how can add #disqus_thread href , not break jquery tab? full code looks this: <div id="tabs"> <ul> <li><a href="#tabs-1"><span>info</span></a></li> <li><a href="#tabs-2"><span>comments</span></a></li> </ul> <div id="tabs-1"> <p>lorem ipsum</p> </div> <div id="tabs-2"> <p>lorem ipsum</p&

How to change ttk.Treeview column width and weight in Python 3.3 -

i have created gui application tkinter. using treeview widget. unable change column widths , weights. how properly? sample: tree = treeview(frames[-1],selectmode="extended",columns=("a","b")) tree.heading("#0", text="c/c++ compiler") tree.column("#0",minwidth=0,width=100) tree.heading("a", text="a") tree.column("a",minwidth=0,width=200) tree.heading("b", text="b") tree.column("b",minwidth=0,width=300) as far understand should create 3 columns widths: 100,200 , 300. nothing happens. treeview.column not have weight option, can set stretch option false prevent column resizing. from tkinter import * tkinter.ttk import * root = tk() tree = treeview(root,selectmode="extended",columns=("a","b")) tree.pack(expand=yes, fill=both) tree.heading("#0", text="c/c++ compiler") tree.column("#0&

oauth - Is it possible to get any information out of a Facebook Token without hitting the server? -

with old facebook access tokens (oauth1) possible get user's facebook id , token's expiration without passing server . is possible new oauth2 tokens? there data can token itself? i know can pass @ token /me , lots of info (assuming token still valid) interested in if there way exclusively on client without network connection and/or expired tokens. in short - no! need hit https://graph.facebook.com/me endpoint access token facebook id, cannot access token on client.

python - Writing to a file at specific time intervals in different threads for a simple keylogger -

import pythoncom , pyhook, time temp_keylogs = '' def onkeyboardevent(event): global temp_keylogs key = chr(event.ascii) temp_keylogs += key hm = pyhook.hookmanager() hm.keydown = onkeyboardevent hm.hookkeyboard() pythoncom.pumpmessages() while true: f = open('output.txt', 'a') f.write(temp_keylogs) temp_keylogs = '' f.close() time.sleep(4) i not understand why code not writing of keystrokes performed after 4 seconds file called 'output.txt'. no errors thrown, compiling ok believe, not writing file. edit: added pythoncom.pumpmessages() suggested, gives 2 while loops; so, need threading this? i tried threaded version out here: import pythoncom , pyhook, time, thread temp_keylogs = '' def onkeyboardevent(event): global temp_keylogs key = chr(event.ascii) temp_keylogs += key def file_write(temp_keylogs): while true: print 'yes' f = open('output.t

Mac standalone Xcode c++ command line project -

i made xcode (version 4.6.2) c++ command line project , want export distribute on other macs. preferably, want export in .app format haven't figured out how yet. did manage project's executable run on mac doesn't work when try on laptop. have solution? if it's command line program, don't want distribute app bundle, since hard call command line, , require @ least little bit of obj-c. want distribute installer package. if binary runs on 1 machine not another, culprits either mismatch of shared libraries, or compiler settings generate code doesn't run on machines. question not provide enough information diagnose issue.

ado.net - Null value in DataTable -

i quite surprised how come following code working without getting nullreferenceexception exception? table.rows[0][1] = null; console.writeline(table.rows[0][1].tostring()); could explain? that's because item set instance of system.dbnull rather null .

NSString -initWithContentOfFile error - Objective-C -

i'm trying load nsstring , content of file named names.txt , in directory of project. this, have following code : nserror *error = nil; nsstring *names = [[nsstring alloc] initwithcontentsoffile:[[nsbundle mainbundle] pathforresource:@"names" oftype:@"txt"] encoding:nsasciistringencoding error:&error]; if (error != nil) { [nsexception raise:@"error reading file :" format:@"%@",error]; } and i'm getting *** terminating app due uncaught exception 'error reading file :', reason: 'error domain=nscocoaerrordomain code=258 "the file name invalid."' . couldn't find other cases that. what's wrong code? ensure names.txt file included under copy bundle resources region of xcode build phases window target. in debugger, test valid bundle file with: ... nsstring *file = [[nsbundle mainbundle] pathforresource:@"names" oftype:@"txt"]; /* file ou