Posts

Showing posts from April, 2011

css - Why does styling TDs in jquery make the markup insane? -

i'm trying add simple border table cells in table. it's important markup remains simple other functionality have in place work. let's style tds this: $('td').css('border', '1px solid #000'); this ends result: <td style=​"border-top-width:​ 1px;​ border-right-width:​ 1px;​ border-bottom-width:​ 1px;​ border-left-width:​ 1px;​ border-top-style:​ solid;​ border-right-style:​ solid;​ border-bottom-style:​ solid;​ border-left-style:​ solid;​ border-top-color:​ rgb(0, 0, 0)​;​ border-right-color:​ rgb(0, 0, 0)​;​ border-bottom-color:​ rgb(0, 0, 0)​;​ border-left-color:​ rgb(0, 0, 0)​;​ ">​…​/td> classes wouldn't appropriate i'm trying do. why cells being formatted in ridiculous way? this how browsers handle shorthand css properties; browsers may implement human-readable representation differently internal representation, in reality, border: 1px solid #000 is shorthand for ...

android - ImageButton and NullPointerException -

could nullpointerexception because button referencing nested inside several layouts? time reference browseeditbtn exception. it's simple button! come'on. <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <tablelayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" android:stretchcolumns="*"> <!-- <include layout="@layout/mydesctextview" /> --> <tablerow android:id="@+id/tablerow1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal"> <textview android:text="textview" android:layout_width="wrap_content" android:layout...

css3 - Plugin for CSS Transitions via jQuery addClass? -

i'm looking library allow me use css transitions via jquery's addclass / removeclass / toggleclass functions. i.e. want these functions nothing (other adding css class) in webkit, use jquery animations in ie. jqueryui replaces these 3 functions , comes close need, works on exact element (e.g $('#myid').addclass('foo'); doesn't animate #myid.foo .someclass ) i've looked around , can't find this, knows of 1 :) if not, solution requires: parsing stylesheets on page css transition properties matching stylesheets transitions (e.g. -webkit-transition ) storing these stylesheets on addclass , etc match current , down tree (e.g. .addedclass .someotherclass ) apply animations matched elements (or style rule) so if knows of existing solutions parse stylesheets (the text of them) or animate rule (instead of individual nodes), helpful well. looks want jquery++ jquery.animate overwrites $.fn.animate use css 3 animations if p...

floating point - Assign double constant to float variable without warning in C? -

in c programming language, floating point constant double type default 3.1415 double type, unless use 'f' or 'f' suffix indicate float type. i assume const float pi = 3.1415 cause warning, not. when try these under gcc -wall: float f = 3.1415926; double d = 3.1415926; printf("f: %f\n", f); printf("d: %f\n", d); f = 3.1415926f; printf("f: %f\n", f); int = 3.1415926; printf("i: %d\n", i); the result is: f: 3.141593 d: 3.141593 f: 3.141593 i: 3 the result (including double variable) lose precision, compile without warning. did compiler this? or did misunderstand something? -wall not enable warnings loss of precision, truncation of values, etc. because these warnings annoying noise , "fixing" them requires cluttering correct code heaps of ugly casts. if want warnings of nature need enable them explicitly. also, use of printf has nothing precision of actual variables, ...

MySQL Count multiple distinct records with condition -

i have table records user cross-profile visits , need count of distinct visits , count of new visits specified profile (:user_id) since specified unix timestamp (:time). id | user_id | visitor_id | time (unix) ====+==========+============+============= 1 | 1 | 5 | 1300000000 2 | 1 | 5 | 1300000010 3 | 1 | 8 | 1300000015 4 | 1 | 9 | 1300000020 5 | 1 | 9 | 1300000025 6 | 1 | 9 | 1300000030 so far able count of total visits, unable new ones. select count(distinct v.visitor_id) total, sum(v.time > 1300000012) new profile_visits v v.user_id = 1 returns total | new ============ 3 | 4 but required result is total | new ============ 3 | 2 you want sum(v.time > 1300000012) new . the expression either 0 or 1. count() count 0 happily 1. sum() "count" 1's. re comment: select count(t.visitor_id) total, sum(t.subto...

C# nested class/struct visibility -

i'm trying figure out proper syntax achieve api goal, struggling visibility. i want able access messenger instance's member msgr.title.forsuccesses . however, not want able instantiate messenger.titles outside messenger class. i'm open making messenger.titles struct. i'm guessing need sort of factory pattern or something, have no idea how i'd go doing that. see below: class program { static void main(string[] args) { var m = new messenger { title = { forerrors = "an unexpected error occurred ..." } }; // should allowed var t = new messenger.titles(); // should not allowed } } public class messenger { // i've tried making private/protected/internal... public class titles { public string forsuccesses { get; set; } public string fornotifications { get; set; } public string forwarnings { get; set; } public string forerrors { get; set; } // i've tried making pri...

java - Spring mvc Joda Datetime converter fail if invalid date -

i have domain object want have mapped jsp contains joda datetime: public beanclass{ private long id; @datetimeformat private datetime start; getters , setters... } i have following converter registered spring: final class stringtojodadatetimeconverter<s, t> implements converter<string, datetime> { private static final datetimeformatter fmt = datetimeformat.forpattern("mm/dd/yyyy"); public datetime convert(string in) { try{ return fmt.parsedatetime(in); }catch(exception e){ throw new illegalargumentexception("invalid date"); } } } spring hits converter before validator class , populate error messages full error failed convert property value of type java.lang.string required type org.joda.time.datetime property sampledate; nested exception org.springframework.core.convert.conversionfailedexception: unable convert value "asdf" type java.lang.string type org.joda.time.dat...

java - Handling authentication related intermediate redirects with ApacheHttpClient -

i trying open uri https://some-host/a/meta? (this url passed proxi.jsp page) .. redirects authentication service (on https) popups box username , password...and if on browser.. needs key-in credentials.. , comes first link trying open , shows content... want know when intermediate redirect authentication service happens.. how enter username , password popup through code.. trying use apache httpclient this... this proxi.jsp code making request.. <%@ page language="java" import=" java.util.collection, org.apache.commons.httpclient.httpclient, org.apache.commons.httpclient.usernamepasswordcredentials, org.apache.commons.httpclient.auth.authscope, org.apache.commons.httpclient.methods.getmethod" contenttype="text/html; charset=iso-8859-1" pageencoding="iso-8859-1"%> <% try { string a_url = request.getparameter( "url" ) ; httpclient client = new httpclient(); client.getstate().setcredentials( new authscope(authsco...

Does Rails automtically track the Date? -

i making calendar model product model because need list of products belong 1 date whether past or present products. want users able search specific date of product when put search engine in , pagination. idea or there better way? rails have way not make model , still give many products 1 date? unless wish store else in calendar model should store date field of products model. can find_all_by_date.

Unit tests aren't run with multiple build configurations in TFS 2010 -

i using msbuild in tfs buildprocess using defaulttemplate build multiple configurations(debug/release) of same solution. when build release or debug unit tests run when run build both configurations unit tests not run. when running multiple configurations have each of them defined in build definition under process-> items build-> configurations build mixed platforms|release,mixed platforms|debug. when run single configuration using mixed platforms|release or mixed platforms|debug. i unable put entire log here(it on 6000 lines long) appears isnt finding of testassemblies. edit: here actual sections of log. i'm not sure mixed platforms\release coming in searchpathroot. i should add compile our source's folder because few of our scripts work in layout. debug only(works) run mstest test assemblies c:\program files (x86)\microsoft visual studio 10.0\common7\ide\mstest.exe /nologo /usestderr /testsettings:"c:\builds\6\productname\buildname\sources\product...

html - Call php file to return an array, and load it into a combo box -

i have index.php. want call function in load_data.php return array. want load array combox box on index.php. can me started on this? i'm brand new php , trying head around it. you can use similar this: load_data.php function get_data() { // may want load data db // hint return array('key1' => 'value 1', 'key2' => 'value 2'); } and in main file: <select name="myselect"> <?php include 'load_data.php'; $data = get_data(); foreach($data $key => $value) { echo '<option value="'.$key.'">'.$value.'</option>'; } ?> </select>

c# - Is there a better LINQ Query to do this? -

lets have flat list of objects, each of has person's name, , single role they're in, so: var people = new[] { new personrole(){ name = "adam", role = "r1" }, new personrole(){ name = "adam", role = "r2" }, new personrole(){ name = "adam", role = "r3" }, new personrole(){ name = "bob", role = "r1" }, }; now, there direct way dictionary<string, list<string>> based on name , role (obviously). did in 2 steps, below, have think there's more direct way. dictionary<string, list<string>> resultlookup = people.select(p => p.name).distinct().todictionary(str => str, str => new list<string>()); people.foreach(p => resultlookup[p.name].add(p.role)); thanks! var dict = people.tolookup(p=>p.name, p=>p.role) .todictionary(it=>it.key, it=>it.tolist());

sql server - What are the best practices for detecting changed rows for a data feed? -

i researching best practices managing weekly data feed 3rd party olap service. analysis database initialized full data dump. subsequent weekly feeds provide new , updated rows. data sourced sql server 2005 database. what preferred approaches detecting new , updated rows? trigger modified date field on inserts , updates , grab greater last feed extraction; or timestamp column on source tables , grab rows timestamp greater last feed extraction; or some excellent idea have not thought of... well depends on how define changed row. number 2 works change @ row change timestamp update doesn't change (say updating value 1 1). sounds silly that? it's easy when use dynamic code. number 1 can modified ensure there differnce between inserted , deleted tables in trigger , fixes problem of option 2. however, suppose have 3 different feeds each contain different columns might in related tables , want send if 1 of changes. trigger isn't specific enough feeds. use...

iphone - How to get data from an SQL database in Objective-C? -

i know has been answered before, cannot find information on subject. information have found need use sql database, leading me ask question. i making iphone app needs store 4 integers, 6 floats, , 2 nsstrings online somehow (sql sounds answer), , need able data well. there documentation on subject might help? if not, how can data? the next thing need know how can set hundreds of users store , access of variables. mean each user's 4 integers, 6 floats, , 2 nsstrings totally different, , cannot figure out how set in way works. there documentation this? thanks in advance! one way odata provides sdk allows consume/produce odata service sql database (or other data source) objective-c on devices such iphone. the sdk can found here: http://www.odata.org/developers/odata-sdk there developed client on codeplex: http://odataobjc.codeplex.com/ keep in mind you'll have develop both provider (data source) consumer (your app). you can primer on basics of buildin...

python - Parse XML using lxml -

i have following xml need parse. of issue seems can't stingio work. looks can't load module; guess i'm not sure how show it's loaded properly? below xml, returned response http request: <response method="switchvox.currentcalls.getlist"> <result> <current_calls total_items="3"> <current_call id="sip/6525-b59313c8" from_caller_id_name="user1" from_caller_id_number="user1_ext" to_caller_id_name="callee1" to_caller_id_number="callee1_num" start_time="2011-06-30 15:44:17" duration="346" state="talking" provider="internal" format="g722-&gt;g722" /> <current_call id="sip/4476-b595a0a0" from_caller_id_name="user2" from_caller_id_number="user1_ext" to_caller_id_name="callee2" to_caller_id_number="callee2_n...

html5 - How to print 2 columns of pictures from a list in asp.net mvc3 -

i have code , bit in doubt how make print 2 rows instead of 1 (later want dynamic depending on screensize if possible, should 2 columns) http://pastebin.com/h7cpbwwn @model ienumerable<firstweb.models.picture> @{ viewbag.title = "index"; } <h2>index</h2> <p> @html.actionlink("create new", "create") </p> <table> <tr> <th> title </th> <th> path </th> <th> concertyear </th> <th> title </th> <th> path </th> <th> concertyear </th> </tr> @bool = false; @foreach (var item in model) { <tr> <td> @html.displayfor(modelitem => item.title) </td> <td> <a href=@html.displayfo...

c# - ListView not updated correctly with ObservableCollection -

i'm using observable collection store data objects listview. adding new objects collection works fine, , listview updates properly. when try change 1 of properties of object in collection listview not update properly. example, have observable collection datacollection. try _datacollections.elementat(count).status = "active"; i perform change before long operation due button press. listview not reflect change. add mylistview.items.refresh() ;. works, listview not refreshed till button_click method complete, no then. example: button1_click(...) { _datacollections.elementat(count).status = "active"; mylistview.items.refresh(); executelongoperation(); _datacollections.elementat(count).status = "finished"; mylistview.items.refresh(); } the status never goto "active", go straight "finished" after method completes. tried using dispatcher this: button1_click(...) { this.dispat...

ruby on rails 3 - Failure/Error: get :show, :id => @user -

i have issue on learn rails example book chapter 7 @ end of chapter these error messages in rspec spec 1) userscontroller should have right title failure/error: :show, :id => @user actioncontroller::routingerror: no route matches {:id=>nil, :controller=>"users", :action=>"show"} # ./spec/controllers/users_controller_spec.rb:36:in `block (2 levels) in ' 2) userscontroller should include user's name failure/error: :show, :id => @user actioncontroller::routingerror: no route matches {:id=>nil, :controller=>"users", :action=>"show"} # ./spec/controllers/users_controller_spec.rb:41:in `block (2 levels) in ' 3) userscontroller should have profile image failure/error: :show, :id => @user actioncontroller::routingerror: no route matches {:id=>nil, :controller=>"users", :action=>"show"} # ./spec/controllers/users_controller_spec.rb:46:in `block (2 levels) in ' below relev...

java - Android Facebook Graph api basic information requesting -

just trying allow app access basic information authenticated facebook user, yet logcat tells me 06-30 16:37:27.969: warn/system.err(1559): com.facebook.android.facebookerror: active access token must used query information current user. right after authentification code ran. can point me in right direction? i've seen similar post used identical code , worked. thanks facebook facebook = new facebook("187212574660004"); textview ntext; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); ntext = (textview) this.findviewbyid(r.id.nametext); facebook.authorize(this, new string[] {"offline_access", "user_interests", "friends_interests"}, new dialoglistener() { public void oncomplete(bundle values) { setcontentview(r.layout.homepage); } public void onfacebookerror(facebookerror error) {} ...

flash - How To Convert a SWF / DisplayObject to SVG data? -

Image
anything out there can transform swf or displayobject svg? im trying find way generate large sized jpg swf/vector shape. current jpg export() as3 has limits jpg size , resolution. so figured can send svg data imagemagick. thanks! artur if it's complex swf, might need decompile using proper tool , import vector assets , convert/re save them svg. if it's shapes (no bitmaps/shapes), can use awesome as3swf library , it's svghapeexporter. here's quick class: package { import com.bit101.components.*; import com.codeazur.as3swf.*; import com.codeazur.as3swf.exporters.svgshapeexporter; import com.codeazur.as3swf.tags.*; import com.codeazur.as3swf.tags.*; import flash.display.*; import flash.events.*; import flash.net.*; import flash.utils.*; public class swf2svg extends sprite { private var swffile:filereference; private var svgfile:filereference; private var status:label; pr...

mysql - Does it still make sense to normalize data (1NF)? (what's wrong with having empty fields in a table?) -

given disk space cheap, make sense normalize data (1nf) rather store in 1 place faster queries? background: we have table of users - event organizers , event attendees both have common fields, organizers have many more fields attendees far more numerous organizers on site question: (in far past) combined separate tables existed , made them 1 similar following: table_users uid, name, email, commonfield1, orgspecificfield1, orgspecificfield2 now, have 1 common table both types of users. attendees, last 2 fields null. compare above structure to: table_users uid, name, email, commonfield1 table_usersorganizers uid, orgspecificfield1, orgspecificfield2 which necessitate join. now, site speed perspective, faster retrieve - common-integrated table or separated one? remember fetching these records. if talking site speed in fetching data, second choice (the separated table) data retrieving time mainly number of entries in table (number of ro...

java - Is there an eclipse plugin that will show a log file output rather than stdin -

my application writes information log file, not stdin, there eclipse plugins show 1 or more log files in window console? as far understood, need this tool try !

javascript - touchEnd and onMouseUp BOTH firing from iPad -

i'm building page used on laptops , ipads. so, majority of code (it's drag/drop heavy) duplicated across mouse events , touch events. i'm finding strange behavior: when used on laptop, fine, when used on ipad, periodically touchend fires mouseup...and because overall goal of page sequence of events, throws whole thing off track (step 'n' achieved, mouseup function re-tests it, , since it's done, fails) it took quite awhile figure out (since didn't think possible) putting unique log message in different versions, can see in logs on ipad, 'mouse mistake' message. because cross event behavior isn't logical me i'm not sure how continue debugging, appreciate whatever advice can give. here primary pieces of code, followed sample log ipad. again. function touchend(event) { console.log('touchend fired\n'); if (_dragelement != null) { if((extractnumber(_dragelement.style.left)<-30)&&(extractnumber(_drag...

ruby - Rails models with before/after filters and observers, is it possible to ignore these hooks? -

if model has before/after hooks, , possibly observers other events, possible somehow perform save/update operation on model , skip any/all of these hooks fire? e.g. perform save, , somehow tell model ignore after_save events, , don't notify observer of save don't want fire whatever usuall does. you can use skip_callback method not execute callbacks. eg: user.skip_callback("create",:after,:send_confirmation_email) skip callback name send_confirmation_email configured on after_create. you can set same by: user.set_callback("create",:after,:send_confirmation_email)

ios - Code sign errors while developing for iPhone under friend's profile -

i have developer information , keys , such set on computer development profile. i developing app under friend's profile , keep getting error: code sign error: identity 'iphone developer: ***** ******* (**********)' doesn't match valid certificate/private key pair in default keychain i keychain , see 2 certs named: iphone developer: ***** ******* , iphone developer: ***** . however, not see keys set under person's name. you need matching private key use friend's profile. have him export following these steps to export private key , certificate safe-keeping, open keychain access application , select “keys” category. highlight private key associated ios distribution certificate , select “export items” ‘file’ menu. save key in personal information exchange (.p12) file format.** you prompted create password used when attempt import key on computer. you can transfer .p12 file between systems. double-click on .p12 install on system....

Is it possible to insert page divs into jQuery mobile page using append()? -

in order load jquery mobile page using anchor tag, 1 gives page div's id href <a href="#page2">my link</a> <div data-role="page" id="page2"> <div data-role="header"></div> <div data-role="page"></div> <div data-role="footer"></div> </div> but assumes page div loaded dom. if want generate pages , put them dom so: $("body").append(newpagedivhtmlstring); i trying keep getting "cannot call method _trigger of undefined". stepping through jquery mobile (beta 1) source code, found on line 2600 following code: page = settings.pagecontainer.children( ":jqmdata(url='" + dataurl + "')" ); where pagecontainer html body element , dataurl page div's id. computes undefined , seems source of problem. possible insert page div jquery mobile page, in manner am? thanks reading long question. :) ...

spree - Running Rails in Rubymine from subproject -

i'm using rubymine 3.1.1 rails 3.0.9. i have spree project cloned github, , want debug server while working on code. this, spree includes sandbox rake command creates subfolder (called sandbox) contains instance of rails app, 1 refers parent directory containing source spree gem. if close original project , open sandbox subfolder new probect, correct run configurations development , production , can debug. however, doesn't let me edit spree code in parent directory. if i'm in parent directory, subfolder there of course, there's no rails run configurations , can't add 1 says there no rails server launcher in project (or facsimile of message). anyone know how make rubymine recognize run configurations subfolder? i ran across this conversation resolved similar issue you're reporting. the gist can go settings | project structure , add subdirectory source root. can set run configuration subdirectory instead of project root.

mvvm light - WPF Close Window Closes Source Window. Why? -

the problem having little hard describe, please hear out. i'm opening 1 window , trying close second one. if use command of inputbindings of second one, second 1 closes fine. if call close directly closes both first , second window. expect code scenario. wpf: window1view (key part) <grid> <button content="button" command="{binding rptkeydowncommand}" /> </grid> window1viewmodel: (shortened listing) using galasoft.mvvmlight.command; var _runcommand = new relaycommand(() => run(), () => canrun()); public void run() { var v = new window2(); var vm = new window2viewmodel(); vm.requestclose += v.close; v.datacontext = vm; v.showdialog(); } public event action requestclose; var _closecommand = new relaycommand(() => close(), () => canclose()); public void close() { if (requestclose != null) requestclose(); } wpf: window2view ...

Perl parse links from HTML Table -

i'm trying links table in html. using html::tableextract , i'm able parse table , text (i.e. ability, abnormal in below example) cannot link involves in table. example, <table id="alphabettable"> <tr> <td> <a href="/cate/a/ability">ability</a> <span class="count">2650</span> </td> <td> <a href="/cate/a/abnormal">abnormal</a> <span class="count">26</span> </td> </table> is there way link using html::tableextract ? or other module possibly use in situation. thanks part of code: $mech->get($link->url()); $te->parse($mech->content); foreach $ts ($te->tables){ foreach $row ($ts->rows){ print @$row[0]; #it prints text part #but want link } } html::linkextor , passing extracted table text parse method. my $le = html::linkextor->n...

linux - Setting LD_LIBRARY_PATH from inside Python -

is there way set specify during runtime python looks shared libraries? i have fontforge.so located in fontforge_bin , tried following os.environ['ld_library_path']='fontforge_bin' sys.path.append('fontforge_bin') import fontforge and get importerror: fontforge_bin/fontforge.so: cannot open shared object file: no such file or directory doing ldd on fontforge_bin/fontforge.so gives following linux-vdso.so.1 => (0x00007fff2050c000) libpthread.so.0 => /lib/libpthread.so.0 (0x00007f10ffdef000) libc.so.6 => /lib/libc.so.6 (0x00007f10ffa6c000) /lib64/ld-linux-x86-64.so.2 (0x00007f110022d000) your script can check existence/properness of environment variable before import module, set in os.environ if missing, , call os.execv() restart python interpreter using same command line arguments updated set of environment variables. this advisable before other imports (other os , sys), because of potential module-import side-effects, o...

iphone - How to develop a payment verification for in-app purchase? -

i have developed iphone application rejected. application offer sms transmission service. on website each user has account , can buy credits on website able send sms. the reason rejections app uses external service, website. have use in-app purchase credits. so extend api. if purchase takes place in-app web server needs know there purchase , type of purchase. done using http-post. i build simple url , register purchase in user-account, since can verify purchase performed correctly in app store. prevent hacking , security reason think there has kind of encryption. e.g. if payment process in app successful send http-post webserver. contains encrypted key can encrypted webserver. what think this? how can make api safe regarding in-app purchase , security algorithm use? any other suggestions or ideas? you should server product model , rather trying invent way app on device tell server credit purchased after fact. section on verifying store receipts come in handy; ...

atomic - OpenCL - atomic_cmpxchg -

what function do??. couldn't understand thing opencl specification!! code below snippet spmv code. atomic_cmpxchg((__global int*)loc, *((int*)&old), *((int*)&sum)) != *((int*)&old) atomic_cmpxchg "atomic compare , exchange". implements atomic version of standard c99 ternary operation. code above implies atomic equivalent of following: p = *loc; *loc = (p == *old) ? (*sum != *old) : p; with atomic_cmpxchg call returning p . operation atomic, means no other thread can read or write loc until transaction completed.

c++ - Box2D static library project installation issues -

hey took following steps: downloaded box2d 2.1.2 , used cmake build msvs++ projectiles built box2d.sln under debug , release, didn't touch libs or dlls made new win32 project, , copied code "hello world" included in box2d download new projects main source file added include directory same source code used cmake generate projects added project "box2d" (the static library project) sollution modify library's code; generated cmake added "box2d" refrence under new projects common properties looked @ "box2d"'s librarian properties , set 'link library dependencies' yes pondered question put comment above includes (please answer too!) here's hello world.cpp (please answer question in comment) /* i've added "box2d" project generated cmake, includes same files in folder include directory points to, alter code. mean should change <box2d\box2d.h> "box2d.h" ? */ #include <b...

java - Is there any api to create thumbnil of my video that is presen in my own server not in other? -

i going create application need show thumbnil image of video present in server.some site youtube have link if put in tag show video thumbnil.i want know there api video? use mplayer , runtime.exec()

c - How would i Use strtok to compare word by word -

i've been reading on strtok , thought best way me compare 2 files word word. far can't figure out how though here function perfoms it: int wordcmp(file *fp1, file *fp2) { char *s1; char *s2; char *tok; char *tok2; char line[bufsize]; char line2[bufsize]; char comp1[bufsize]; char comp2[bufsize]; char temp[bufsize]; int word = 1; size_t = 0; while((s1 = fgets(line,bufsize, fp1)) && (s2 = fgets(line2,bufsize, fp2))) { ; } tok = strtok(line, " "); tok2 = strtok(line, " "); while(tok != null) { tok = strtok (null, " "); } return 0; } don't mind unused variables, i've been @ 3 hours , have tried possible ways can think of compare values of first , second strtok. know how check file reaches eof first. when tried if(s1 == eof && s2 != eof) { return -1; } it returns -1 when files same! because in order reach if statement outside of loop both files have reache...

javascript - Scope of object properties & methods -

in article show love object literal , it's said: when have several scripts in page, global variables & functions overwritten if name repeats. one solution make variables properties & functions methods of object, , access them via object name. but prevent issue of variables getting global namespace? <script> var movie = { name: "a", trailer: function(){ //code } }; </script> in above code elements gets added global namespace? a) object name - movie b) object name properties , methods inside – movie, movie.name, movie.trailer() movie exist in global namespace (in browser: window ). within movie -scope exist: name , trailer . can see if try executing trailer global object ( window.trailer() result in referenceerror: trailer not defined ). trailer can executed using movie.trailer() (or window.movie.trailer() ). javascript has lexical scope, aka static scope, meaning: ...

Error Inflating class com.google.android.maps.MapView -

i following simple map tutorial http://developer.android.com/resources/tutorials/views/hello-mapview.html getting error . new android tried follow solution provided on internet no success yet. please me. main .xml below <?xml version="1.0" encoding="utf-8"?> <com.google.android.maps.mapview xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mapview" android:layout_width="fill_parent" android:layout_height="fill_parent" android:clickable="true" android:apikey="***" /> and manifestfile i had problem , solved following 2 steps: 1) put following line in application (important) element of androidmanifest.xml file. <uses-library android:name="com.google.android.maps" /> 2) extend mapactivity instead of activity. enjoy!

asp.net - display field in gridview from another sqldatasource -

i trying implement gridview field data table, 1 of fields in table called "locationid" foreign key locations table. don't want display number on gridview want see address field locations table , edit value using dropdownlist control. this main table in use gridview , sqldatasource net-items [id],[name] ,[model] ,[serialnumber] ,[company] ,[purchasedate] ,[purchaseprice] ,[monthprice] ,[commitmentprice] ,[status] ,[commitmentdate] ,[free] ,[tilldate] ,[locationid] and secondary table net-locations [id] ,[contactname] ,[address] ,[city] thanks please try below code. <%@ page language="c#" autoeventwireup="true" codefile="default.aspx.cs" inherits="_default" %> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat=...

sql server - handling big apllications and big databases -

i allready have programmed small applications, database design simple, 1 normalized database containing datas need application. now want try programm bigger: there should 4 websites build mvc3. websites should use 1 sql-membership-database , tables contacts , on should shared between diferent pages too. now question is: how start? 1. should use 1 database tables (each application needs 40 different tables) including shared tables sql-membership-database or should create 1 database shared data, 1 application 1, 1 application 2 , on? 2. should put applications 1 mvc3-application , seperate them using areas? 3. applications need save text , pictures, should use 1 table pictures application 1/2/3... , choose them application id or should create image-table each application (same question texts , descriptions , tooltipps...)? 4. idea work woth blob (ms sql 2008 r2) save files, think choice? is there have got tipps ore experiances in creating huge (for me huge ;-)) a...

php - How to find the first day of the week a given date belongs to? -

possible duplicate: get first day of week in php? given timestamp need find first day week timestamp belongs to. e.g. $format = "first day of week"; //convert time $time = strtotime("2011-07-01 00:00:00"); //format time first day of week $date = strtotime($format,$time); //put first day of week pretty format $weekstartdate = date("y-m-d",$date); the week start should equal 2011-06-27 @ moment gone horribly wrong , equals 1970-01-01 suggests me “first day of week” format invalid. any ideas appreciated thanks, $time = strtotime("2011-07-01 00:00:00"); $weekstartdate = date('y-m-d',strtotime("last monday", $time));

Facebook GRAPH API, php SDK problem -

it's weird morning facebook applications don't work anymore. , when use graph api using request : "graph.facebook.com/me" got : { "error": { "type": "oauthexception", "message": "an active access token must used query information current user." } } any idea? facebook did developer update past couple days.. http://developers.facebook.com/blog/post/518/ we had problems api key on older versions of sdk, check that.

iphone - Invitation API in Linkedin is not working properly? Can somebody share me the code? -

here xml file using send invitaion email-id --- nsstring * requeststring= @"\ \ \ \ \ abc\ xyz\ \ \ \ invitation connect\ please join professional network on linkedin.\ \ \ friend\ \ \ "; here xml file using send invitaion member-id --- nsstring * requeststring= @"\ \ \ \ \ \ \ invitation connect\ please join professional network on linkedin.\ \ \ friend\ \ name_search\ y6xn\ \ \ \ "; getting error- 401 1309502595763 5l213r30zx 0 [unauthorized]. oau:lawgkyhs6zfsdw8dzeby5n2mzztevzxe5nnkxrfyedgkye8lvp00lyzaotqjrg4z|21e7b7a4-23da-4f64-b698-5049de5f8ff8|*01|*01:1309502595:3feir09u8vfqpzgplhyseon9dve= can 1 know why getting error? please me out..... no body write whole code you.so have tell have done far & facing problem. f...

apache - How do I isolate unwanted PHP error messages? -

Image
i using wamp , need know why getting server error messages appear in browsers. (see grab). have turned error display off in php.ini , cannot see anywhere in httpd.conf file displaying these. appreciate how can troubleshoot problem. if requires further code or information, happy supply @ fiddle. i using php5.3.5 , apache 2.0.53. thanks display_errors changeable php_ini_all ( documentation ). this means can enabled in .htaccess , or in running script using ini_set() . check .htaccess files; note server (in default config) checks .htaccess files in parent directories - if site in /var/www/example.com/htdocs , check .htaccess in each of directories in path.

android - TextView problems -

(1) @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.game); health = (textview) findviewbyid(r.id.lblhealth); gold = (textview) findviewbyid(r.id.lblgold); steel = (textview) findviewbyid(r.id.lblsteel); wood = (textview) findviewbyid(r.id.lblwood); health.settext("fsdfsd"); } (2) @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); txt = (textview) findviewbyid(r.id.txtv); txt.settext("fsddfs"); } why first(1) not work , second works? in first activity im asking user press button, im using intent go layout , there im getting force close error ? hell? 07-01 14:29:17.321: error/androidruntime(1384): uncaught handler: thread main exiting due uncaught exception 07-01 14:29:17.371: error/andro...