Posts

Showing posts from May, 2014

Intuit SDK paymernt merge -

we're using intuit sdk version 10 sync our app, use /n software quickbooks integrator, , querying qb payments qb date modified. we're experiencing random results qb on returning payments, entered after our date trigger, last modified date of qb payment. wondering of there actions in qb can cause payment modified date set other current date of transaction cause them overlooked query. using qb 2012 ent in example,sdk 10,qbfc_10 thanks, mark

c# - Master page post back on click of sub-menu item -

Image
i have master page in have menu list items :- add staff, add venue,add time sheet , setting , invoicing. sub menu items of settings :- general settings , users , roles , sub-contractors. concern when click on general setting , users entire page gets post back. not want happen. instead want content needs refreshed/change.and second concern :- sub-menu items of settings shown on setting page go general setting users how happen. any quick / easy solution above issue? please help. you have 2 choices: use asp.net tags use ajax change tabs asynchronously. (better) use javascript framework jquery or dojo create effect in javascript. (note microsoft including jquery in newer web templates)

iphone - How to Better Drag a UIButton? UIButton UIControlEventTouchUpInside Event Is Not Called -

my draggable button using these events dragged: [button addtarget:self action:@selector(begandragging:) forcontrolevents:uicontroleventtouchdown]; [button addtarget:self action:@selector(wasdragged:withevent:) forcontrolevents:uicontroleventtouchdragoutside | uicontroleventtouchdraginside]; [button addtarget:self action:@selector(exitdragging:) forcontrolevents:uicontroleventtouchupinside]; it's straight forward above. method wasdragged adjusts center of uibutton uitouch location. however, there cases when end button being hung (normally snaps grid after finger release) because uicontroleventtouchupinside never called! how? let's start dragging button , while holding make screenshot (power+home). when release button no events ever called (i.e. uicontroleventtouchupinside ). therefore, button stuck , not snapping grid in method exitdragging any light how make sure exitdragging runs? maybe easi

java - meaning of 'core pool size' in ScheduledThreadPoolExecutor's constructor -

i'm new scheduledthreadpoolexecutor (as use simple timer , people have been advising against it), , don't quite understand appropriate integer value pass scheduledthreadpoolexecutor(int) constructor. could explain this? thank you in case of scheduledthreadpoolexecutor , corepoolsize maximum number of threads created perform scheduled actions. thread pool fixed-sized , idle threads kept alive. drunkenrabbit's answer ivalid because scheduledthreadpoolsexecutor docs says explicitly (there no thread coun spikes @ all): while class inherits threadpoolexecutor, few of inherited tuning methods not useful it. in particular, because acts fixed-sized pool using corepoolsize threads , unbounded queue, adjustments maximumpoolsize have no useful effect. now value, reasonable number number of cpu cores application running on.

How to restore a floated window when opening Visual Studio 2012? -

with visual studio open float separate window. example: open tfs query, right click tab , select float. after floating , closing/reopening visual studio floated window no longer open. further, when go reopen visual studio particular window not floating anymore opens did before floated (in 'main document group'). addition: there 2 kinds of floating. floated window doesn't result in program icon in task bar works (for instance, floating solution explorer igor suggests). floated window gives second task bar program icon (in taskbar have main visual studio , have second window) not stay. does know how force vs either: remember if window floated when reopening after vs close/reopen automatically reopen floated window(s) open when last closed vs i prefer #2. as far know layout settings stored under c:\users\username\documents\visual studio 2012\settings\currentsettings.vssettings . (see http://msdn.microsoft.com/en-us/library/zbhkx167.aspx ) the settin

c++ - Minimum heap via array representation of a binary tree; MoveDown function loops infinitely -

i working on implementing minimum heap using array datastructure, having issue movedown method (used @ root node return collection heap if root's children every smaller it). assume reader know min heap is, i'll describe in case not or understanding incorrect. a minimum heap (in case) binary tree represented array such that: the root node smallest value in datastructure a node must smaller it's children given node of array index i, it's left child @ index i*2 + 1 , right child @ i*2 + 2 the current issue having movedown function runs infinite loop when swapping. having difficult time finding logic error, fear might closer root (pun intended, couldn't myself). notable data members of heap.cpp file: int size; minivector array;// implementing custom array void movedown(int root); movedown function in heap.cpp file: void binaryheap::movedown( int root ){ int temp = root; int templc = temp*2 + 1;//leftchild int temprc = temp*2 + 2;//righ

c - Segmentation fault with strcpy() with array of pointers to structures -

constants: #define max_opcode_name_len 4 i have array of structs: opcode *mot[num_opcodes]; struct def: typedef struct opcode { char name[max_opcode_name_len + 1]; char format; int type; } opcode; in code: strcpy(mot[0]->name, "hlt"); strcpy(mot[1]->name, "add"); strcpy(mot[2]->name, "sub"); // seg fault on command strcpy(mot[3]->name, "mul"); // ...more code follows my code gives me segmentation fault here , i'm not sure why, since should have enough space hold 5 characters (4 char followed '\0'), shouldn't running out of space, , i'm copying string literal static memory location. perhaps defined struct incorrectly or used pointer arrow in wrong spot? opcode *mot[num_opcodes]; is array of pointers opcode . not array of opcode s . you have either allocate opcode memory each pointer stored in mot or (easier way current code) make mot array of opcode s opcode mot[num_opcodes];

join - SQL not including duplicate values on a combination of 2 columns -

i working on exercise 16 sql-ex.ru. problem asks following: find pairs of pc models having identical speeds , ram. result, each resulting pair shown once, i.e. (i, j) not (j, i). result set: model higher number, model lower number, speed, , ram. the database schema : product(maker, model, type) pc(code, model, speed, ram, hd, cd, price) laptop(code, model, speed, ram, hd, screen, price) printer(code, model, color, type, price) i wrote following query: select a.model, b.model, a.speed, a.ram pc join pc b on (a.model<>b.model) a.speed=b.speed , a.ram=b.ram but displays duplicates of i,j j,i. here output: model model speed ram 1121 1233 750 128 1232 1233 500 64 1232 1260 500 32 1233 1121 750 128 1233 1232 500 64 1260 1232 500 32 as can see, values of i,j flipped , counted distinct values. there easy way rid of duplicates this? kind of lost on part. i think "model higher number, model lower number" in

debugging - How do I fix the safari 6 web inspector so that it works with iOS devices or simulators? -

whenever try connect safari web inspector simulator or device running mobile safari in foreground, site try inspect never loads in inspector. dom never fills out in dom tree view; have collapse , expand webpage in resource view able see scripts, images, frames , none of items should show dom do. touch mode select specific dom element tapping on on iphone/ipad doesn't work either result of this. i've correctly set relevant ios settings , mac safari settings safari on mac can see each device , connect specific websites/webviews connection seems fail somehow. i've had moderate luck in getting work clearing cookies , cache via ios settings safari, connects , shows me dom part of time. has else run this? going wrong? there way fix it? possible use different web inspector debug sites on ios (like webkit nightly one) , if so, how? this happens on both 10.7 , 10.8 machines , on various different ipads. might issue our site don't know how narrow down exactly.

dry - Rails Remove Duplication in Controller -

i learned rails , rails' dry principle. i need making controller dry: in 3 of controller actions have same if statement: respond_to |format| if @items.empty? @cart.destroy session[:cart_id] = nil format.html { redirect_to products_path, notice: 'empty cart' } else if @line_item.save format.html { redirect_to @line_item.cart, notice: 'item removed' } format.js { @current_item = @line_item, @items } end end end if @line_item.save i tried remove duplication using respond_with not work. help me if .

unix - remove colon and - between numbers -

i have file this: chr1:34610-36081 1.20286 chr1:69090-70008 0.0392553 chr1:321083-321115 0 chr1:321145-321207 85.0555 chr1:367658-368597 0.114414 and want convert in to: chr1 34610 36081 1.20286 chr1 69090 70008 0.0392553 chr1 321083 321115 0 chr1 321145 321207 85.0555 chr1 367658 368597 0.114414 i can remove colon cant create space between them cut -d: -f1,2 file | sed s/\:/\/g simplest solution sed : $ sed 's/[:-]/ /g' file chr1 34610 36081 1.20286 chr1 69090 70008 0.0392553 chr1 321083 321115 0 chr1 321145 321207 85.0555 chr1 367658 368597 0.114414 to store changes file can use -i option: $ sed -i 's/[:-]/ /g' file

ruby on rails - Ingredient has many sub-ingredients modelling -

i've got recipe model, , ingredient model. right recipe has_and_belongs_to_many :ingredients , ingredient has_and_belongs_to_many :recipes . because ingredient conceivably made of other ingredients, i'm trying self-join on model, so: has_many :components, class_name: 'ingredient', foreign_key: 'parent_id' belongs_to :parent, class_name: 'ingredient' now, works, each ingredient can have 1 parent, e.g., mayonnaise in "crab cakes" ingredient part of recipe, can't ingredient in "spicy mayo" ingredient of other recipe simultaneously. what i'm trying interface this: r = recipe.create(name: "jumbo lump crab cakes") r.ingredients << ingredient.create(name: "crab cakes") r.ingredients[0].ingredients # => [] r.ingredients[0].ingredients.create(name: "mayonnaise") r.ingredients[0].ingredients # => [#<ingredient id: 2, name: "mayonnaise">] r.ingredients[0].ingred

CSS with JavaScript - Cannot read property 'undefined' error -

i tried change colors of select lists header, title , text. added functions changehead() , changetitle() , changebody() this. , bind elements through unique id. but i'm getting following error uncaught typeerror: cannot read property 'undefined' of undefined in function changehead() , after header = document.form1.heading.options[i].value; and in function changetitle() after header = document.form1.heading.options[i].value; i'm not sure whether should using 2 different functions or if can done one. code: <script> function changehead() { = document.form1.heading.selectedindex; header = document.form1.heading.options[i].value; document.getelementbyid("head1").style.color = header; } function changetitle() { = document.form1.heading.selectedindex; header = document.form1.heading.options[i].value; document.getelementbyid("head2").style.color = header; }

javascript - Multiple Locations in Bing Maps in an iframe -

i'm trying piece of code work in iframe, error: referenceerror: getmap not defined i not advanced programmer, have no idea why works alone, not in iframe (and nobody seems have same problem)! appreciated. ps: programming code yoyomyo (who posted on stackoverflow), adapted use <html> <head> <script charset="utf-8" type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0"></script> <script type="text/javascript" language="javascript"> function getmap() { var longitude = new array(); var latitude = new array(); var title = new array(); var description = new array(); longitude[0] = 47.5564154 //two defined locations latitude[0] = 7.59245395 title[0] = "basler münster"

c# - WP7 Skydrive API - creating folder doesnt work -

i try this tutorial create new folder on skydrive wp7 app. here code: private void msaccountlogintoggleswitch_checked_1(object sender, routedeventargs e) { try { liveauthclient auth = new liveauthclient("** id **"); auth.loginasync(new string[] { "wl.skydrive_update", "wl.calendars_update" }); auth.logincompleted += auth_logincompleted; } catch (liveauthexception exception) { messagebox.show("error signing in: " + exception.message); } } private void auth_logincompleted(object sender, logincompletedeventargs e) { if (e.status == liveconnectsessionstatus.connected) { mysession = e.session; } else { msaccountlogintoggleswitch.ischecked = false; } } private void button_click_1(object sender, routedeventargs e) { try {

jquery - change fancybox design - add another div without window shaking -

i have jw player on fancybox window. works well, have 1 design problem: when player window shown (when fires), moves "bottom up", down window. because added div under player. how can fix this? here demo example: http://teodore.ge/test/demo/ i have made that: <script> $(".fancybox").fancybox({ fittoview: false, // show videos in own size content: '<div></div>', // create temp content scrolling: 'no', // don't show scrolling bars in fancybox afterload: function () { // dimensions data attributes var $width = $(this.element).data('width'); var $height = $(this.element).data('height'); var link=$(this.element).context.attributes.yutubelink.nodevalue; this.content = ' <embed type="application/x-shockwave-flash" src="player.swf" width="640" height="383" style="

Capturing shift key state on Windows 8 tablet in MFC App -

our mfc-based windows application has functionality depends on state of shift key. shift exposes power-user menu commands , shift-dragging has different behavior normal dragging. exploring our options in supporting windows 8 tablets, , seems there no straightforward way detect state of windows 8 soft keypad shift key. using getasynckeystate(vk_shift) (our current method) doesn't detect key. experimenting examining incoming keyboard messages, find: a single isolated tap of shift key produces no keyboard event a double tap of shift key produces caps lock key event, indistinguishable normal caps lock key event a single tap of shift key followed keystroke (eg. 'q' key) produces shift key event, keystroke, , shift key (up?) event. are there other ways try detect state of soft keyboard shift key? has else had success detecting state of keypad on windows 8 tablet soft keyboards. the external keyboards plug these devices have normal behaving shift keys. pro

Exporting Collection of Trends: Excel -> C# -

i encountered problem of working excel trends , transferring them. it's easy work usual things formulas/values, because these things might exported csv file, can not figure out way work trends. i'd mention, need not usual trend() function, trend-lines these: exponential linear logarithmic polynomial power . i'd glad receive example code, because it's possible find parts of non-working code in google. thought these functions give me result want, got similar trends simple trend() little differences. i'd know if there libraries can me if want impossible thing excel's trends , c#. i grateful can provide.

sql server ExecuteReader requires an open and available Connection. The connection's current state is closed -

i using multithreaded application extract data database , after few minutes of running start exception or sql timeout exception. code below: public static list<flightinfo> flightinfoallpricesperdayforroute(string from, string to) { // create object array datareader list<flightinfo> arr = new list<flightinfo>(); using (var conn = new sqlconnection(sconnectionstring)) { using (var command = new sqlcommand("flightinfoallpricesperdayforroute", conn) { commandtype = commandtype.storedprocedure }) { conn.open(); command.commandtimeout = 150; command.parameters.addwithvalue("airportfrom", from); command.parameters.addwithvalue("airportto", to); // command.parameters.addwithvalue("date", dt); //execute stored procedure using (idatareader

Facebook post data has empty privacy field -

we having issue 1 facebook users account privacy field returned posts blank. have tried reproducing account or test account, in cases privacy filled in. here sample using graph api tool (some fields removed brevity): { "id": "<deleted_for_privacy>", "from": { "name": "joe blog", "id": "<deleted_for_privacy>" }, "story": "joe blog added new photo.", "picture": "<deleted_for_privacy>", "link": "<deleted_for_privacy>", "icon": "<deleted_for_privacy>", "privacy": { "value": "" }, "type": "photo", "status_type": "added_photos" }, according documentation privacy field should contain value. my initial thoughts was related blackberry app being used , old mobile version setting, posting desktop

I can't get Jetty8 etc/jetty-webapps.xml extractWars="false" to work -

i migrating application jetty 7 jetty 8 , not going well. battle @ etc/jetty-webapps.xml. prior migration, our configuration set value "false" <configure id="server" class="org.eclipse.jetty.server.server"> <ref id="deploymentmanager"> <call id="webappprovider" name="addappprovider"> <arg> <new class="org.eclipse.jetty.deploy.providers.webappprovider"> <set name="monitoreddirname"><property name="jetty.home" default="." />/webapps</set> <set name="defaultsdescriptor"><property name="jetty.home" default="."/>/etc/webdefault.xml</set> <set name="scaninterval">1</set> <set name="contextxmldir"><property name="jetty.home" default="." />/contexts</set>

How to properly use string formatting in Python 2.7? -

ok, please bear me, i'm new this. school, , exact syntax isn't important here assignment, own personal knowledge want know little more string formatting. whenever use %f defaults 2 decimal places. there string format can use on float show float number of decimals has? for instance list contains 2.0, 2.01, 2.001, 2.0001 , want use string format print them look. format code use or how use %f if possible? this in python 2.7 on windows 7(if matters). %g may you're looking for: >>> "%g, %g, %g, %g" % (2.1, 2.01, 2.001, 2.0001) '2.1, 2.01, 2.001, 2.0001'

bash - Unable to escape $0 in awk script within 2 ssh sessions. Works in 1 ssh session -

i having trouble getting script run. the following script works (awk within ssh session): ssh root@db01 "cat /tmp/$togo \ |openssl aes-256-cbc -d -salt -pass pass:aaaaaaaaaaaaa \ |gunzip \ |gawk -v envbucket='design.test.bucket' -v prodbucket='design.bucket' '{gsub(prodbucket,envbucket);print \$0}' \ |gawk -v envbucket='data.test.bucket' -v prodbucket='data.bucket' '{gsub(prodbucket,envbucket);print \$0}' \ | mysql -u root -p'secret' appdb" but when try run exact same thing inside ssh session within ssh session, fails: ssh root@intermediateserver "ssh root@db02 \"cat /tmp/$togo \ |openssl aes-256-cbc -d -salt -pass pass:aaaaaaaaaaaaa \ |gunzip \ |gawk -v envbucket='design.test.bucket' -v prodbucket='design.bucket' '{gsub(prodbucket,envbucket);print \$0}' \ |gawk -v envbucket='data.test.bucket' -v prodbucket='data.bucket' '{gsub(prodbucket,envbucket);prin

css3 - CSS - Is it possible to assign the same specification of a class to an id -

i working application auto-generates html pages , need write css files these pages. want reuse several classes (generated jquery-ui theme), i can not change html element . so, possible assign same specification of class id? if possible, create mapping between classes , ids. example: <html> <head><style> #charlieid { /* want #charlie identical .alphaclass */ /* assume can not change html (it auto generated application)*/ } .alphaclass { font-size: small; color: lime; } .betaclass { font-size: medium; color: blue; } </style></head> <body> <p class="alphaclass">alpha</p> <p class="betaclass">beta</p> <p id="charlieid" class="charlieclass">charlie</p> <body></html> i have hundreds (maybe thousand) ids manage in whole application not in 1 single page. so, have total freedom when comes css, therefore can break down in

html - unwanted margin with css -

i'm working on simple webpage , i'm little bit dusty could've made obvious mistake please stick me. i'm getting thin (maybe 5-10px) margin on sides of document. i'm including abbreviated version of code. can tell me why i'm getting , how rid of it. html: <body> <div id="wrap"> <div id="video"> </div> <div id="para"> <p>hello, i'm ...</p> </div> <div id="footer"> <ul id="social"> <li></li> <li></li> <li></li> <li></li> </ul> </div> </div> </body> css: #wrap { background: url(andres/images/background-bg.png); margin: 0 auto; } #para p { padding: 20px; } #footer { background:url(andres/images/footer.png); height: 80px;} #footer #social li { float: left; padding: 10px; list-style: none; } its default margin on <body> element - browsers include 8px on

Need to count number of lines from the first line of a file up to a unique character (batch) -

i'm new in batch. think question simple you. need batch script count number of lines first line of file unique character "a015" contained file (this number should take account blank lines). thank you. try this: for /f "delims=:" %%i in ('findstr /n "a015" "file.txt"') if not defined linenumber set "linenumber=%%i" if defined linenumber (echo "a015" found @ line %linenumber%) else echo "a015" not found if there more 1 "a015" in text file, show first line number.

c# - WCF Rest Service in JSON and jQuery -

i'm getting problems exposing wcf rest service in json , trying consume jquery. the first , desired approach took similar this . faced problem returning json isreference=true annotation wasn't ok, althought if returned xml ok. the second approach returning xml , playing in jquery it. jquery likes json don't option. another 1 may have been trying json.net following this solution in description author says isn't recommended production. what have first approach annotation isreference=false, kinda dangeourous think, , solve circular references have manually delete cycles example: var queryresult = in dbcontext.programs.include(x => x.radios) programsids.contains(a.id) select a; foreach (program p in queryresult) { p.radio = null; p.messages = new list<message>(); } i don't solution don't know 1 less bad. i suppose many people may have had problem, solution did take? thanks!! edit 1: another solution make cal

ruby - Perform a loop for a certain time interval or while condition is met -

i trying have check fire off every second 30 seconds. haven't found clear way ruby yet. trying currently: until counter == 30 sleep 1 if condition break else counter +=1 end problem has use sleep, stops thread in tracks full second. there way achieve similar above without use of sleep? there way have cycle though on time based interval? you can approximate you're looking along these lines: now = time.now counter = 1 loop if time.now < + counter next else puts "counting second ..." end counter += 1 break if counter > 30 end

sql - ASP.NET SqlDataSource, like on SelectCommand -

i'm working on asp.net. have sqldatasource query hardcoded on selectcommand: <asp:sqldatasource id="datasource1" runat="server" cancelselectonnullparameter="false" connectionstring="<%$ connectionstrings:s.properties.settings.connectionstring %>" selectcommand="select * [table] ([col1] case @col1_param when null col1 else @col1_param end) , ([col2] case @col2_param when null col2 else @col2_param end)" selectcommandtype="text"> <selectparameters> <asp:controlparameter controlid="textbox1" name="col1_param" propertyname="text" type="string" /> <asp:controlparameter controlid="textbox2" name="col2_param" propertyname="text" type="string" /> </selectparameters> what want if enter data on 1 textbox only, data display according textbox

android - How to refresh the ListView in Drag-Sort ListView? -

Image
i have implement drag-sort listview(dslv) , lazylist in project, download demo lazylist , drag-sort listview github integrate , modify per requirement , i use dslv drag , sort items of listview , lazylist displaying image url, implement "basic usage playground" dslv drag , sort, i have implement search in testbeddslv.java, problem when search content list, can't update list, have tried notifydatasetchanged method not works, create new adapter , pass listview lv.setadapter(adapter) , here set listadapter, cant lv.setadapter(adapter) testbeddslv.java package com.mobeta.android.demodslv; import android.os.bundle; import android.support.v4.app.fragment; import android.support.v4.app.fragmentactivity; import android.text.editable; import android.text.textwatcher; import android.view.menu; import android.view.menuinflater; import android.widget.button; import android.widget.edittext; import com.mobeta.android.dslv.dragsortcontroller; import com.mobeta.android.d

css - Making Borders with background images -

the question looks like, asking code, that's not so. googled plenty of times , landed in pages did not told wanted. may bad part not find in google. i've seen somewhere, on site, don't recall i have 6 png files, namely, top_right.png, top_left.png, bottom_right.png, bottom_left.png, horizontal.png, verical.png what want make box, borders using images above. i think has background position , percent, couldn't find how it? separate them using commas ex: body { background-image: url(bottom.png), url(top-right.png); background-position: center bottom, right top; background-repeat: no-repeat; }

reference - vb.net imports does not contain any public member -

i have working , buildling sln multiple projects in vb.net. in virtual pc running xp , visual studio 2010. builds , runs fine. copy files windows 8 pc vs2010 sp1 , vs 2012. several of projects reference helper project. referenced dll project. changed actual project reference remove dll issues. now in windows 8 pc every import or code reference helper project failing. helper project building fine. cannot figure out why imports failing works fine in xp machine , none of references erroring on windows 8 pc. if unload referenced helper project builds , runs fine on windows 8. clean entire solution , deleted every dll the helper project created. positive helper project creating new dll , being used other projects. so.. why work if unload project. should same thing? i had recreate sln file after worked in win 8

php - getimagesize() expects parameter 1 to be string, array given -

i using getimagesize validate image type don't know how write script multiple file. basically, have form allow upload of multiple image files below. <input type="file" name="photo[]" class="file" /> <input type="file" name="photo[]" class="file" /> <input type="file" name="photo[]" class="file" /> then using validate , send via phpmailer. <?php ob_start(); require("class.phpmailer.php"); $errors = array(); if ('post' === $_server['request_method']) { $firstname = sanitize($_post['firstname']); $lastname = sanitize($_post['lastname']); $email = sanitize($_post['email']); if (empty($firstname)) { $errors['firstname'] = "please provide first name."; } if (empty($lastname)) { $errors['lastname'] = &q

iis 7 - Hosting Sql Server reporting service to iis -

i have created 1 solution in business intelligence studio (sql server reporting). want deploy on iis server . possible ? ssrs, in recent versions, including 1 mention, no longer use iis service component. instead connect directly windows http.sys, mentioned in comments. if have built reports in business intelligence development studio (bids), need deploy server install of ssrs. installed optional component of sql server. can install ssrs (the server) on machine not have other components of sql server installed, restricted license agreements. mentioned, ssrs not require iis installed; can specify bindings , configuration through sql server reporting services configuration tool installed ssrs.

pointers - C++ Linked List -- how to read without repeating to same nodes -

i'm trying read in word word (and keep track of line numbers -- that's why i'm using getline that's separate problem) text file , getting repeat of last line of file. think it's because i'm using getline() i'm setting new node every time when displayall() prints last line of file. (example of file , error @ bottom). included node class because that's relevant issue whereas linkedlistoffiles functions support full list of words once created. class node { public: string getnode(){return node;} void setnode(string s){node=s;} string getfile(){return file;} void setfile(string s){file=s;} int getnodenumber(){return nodenumber;} void setnodenumber(int ln){if(ln<0)ln=0;nodenumber=ln;} friend class linkedlistoffiles; int number; char name; node * next; node() {pleft=null;pright=null;} node(node * ps) {pleft=null;pright=null;pdata=ps;} friend class bstofwords; private: node * pdata; node

date - Python: Adding method for number -

being tempted ruby want add syntactic sugar in working dates in python. how can implement method: (3).days.ago() or (4).days.from_now()? to create syntax close want, subclass int add new methods (the built-in int type unmodifiable subclass option extending integer behaviors). compute date offsets using timedelta in datetime module : >>> datetime import date, timedelta >>> class int(int): def days_ago(self): return date.today() - timedelta(days=self) def days_from_now(self): return date.today() + timedelta(days=self) >>> int(3).days_ago() datetime.date(2013, 4, 5) >>> int(4).days_from_now() datetime.date(2013, 4, 12)

c# - Outlook changes & to &amp; -

i habe asp website, , want send email using template. in template have 2 placeholders inside <a href=""> (%code% , %email%) supposed query strings it looks kinda <a href="http://www.foo.com?qs1=example&code=%code%&email=%email%" /> i use .replacement() method replace 2 fields. the problem after receiving email, & characters replaced &amp; , the query string becomes invalid. i don't know if outlook problem (2013) or if can fixed within code. thanks ampersands aren't valid in context. if "encode" them before outlook can.. switch normal you: <a href="http://www.foo.com?qs1=example&amp;code=%code%&amp;email=%email%" /> so you use amp; , , outlook fix it. browsers same thing. even if doesn't in page source.. if click link amp; replaced normal ampersand.

c# - Opening login page on two tab in browser and login in by one after another, getting "The page isn't redirecting properly" in second tab login time -

visible i getting following error in page , page isn't redirecting . firefox has detected server redirecting request address in way never complete. this problem can caused disabling or refusing accept cookies. error generated when open login page on 2 tab of same browser , logging in first tab , when try logging in second tab time getting error message. can me fix error? want solve error asp.net, c#. to solve problem there no need delete of cookies, delete ones associated google , youtube accounts. here's how: - click tools/options/privacy - click "remove individual cookies" - in cookies window type "accounts" (no quotes) search box

asp.net - c# , Mysql data comparison issue -

i using mysql asp.net save data in db . when save data in db after using server.htmlencode(), data saved after removing \ . how saving data insert users(id,name) values(1,server.htmlencode(user.identity.name)) in case if name xxx\abc , being saved xxxabc. slashes removed while saving in db. next time when read same , need check if logged in user 1 against whom saved data following if ( existingroweditor == server.htmlencode(user.identity.name)) { } but issue above condition false because have following values existingroweditor="xxxabc" , server.htmlencode(user.identity.name) =xxx\\abc . so how can check if above condition true? html encoding not suitable encoding data storage in database. the reason backslashes disappears pasting sql code, , encoding text display in web page instead of escaping being text in sql query. backslash used escape character in mysql, bacslashes in string escape next character. preferrably should use parameterised que

jquery - Making a refresh function refresh only certain parts of a page -

in listview have several list of questions, right try make when click on refresh button, question in listview refresh in random order. wondering if can refresh list part of page not whole page? <ul id="list" data-role="listview" data-filter="true" data-filter-reveal="true" data-filter-placeholder="search questions..." data-inset="true" ></ul> <script> var jsonfile = 'data.json'; var qdata = []; var qhint = []; $.getjson(jsonfile, function(data) { while (data.activity.length) { var index = math.floor(math.random() * data.activity.length); qdata.push(data.activity[index].question); qhint.push(data.activity[index].hint); data.activity.splice(index, 1) } (var = 0; < 8; i++) { question(qdata[i], i); hint(qhint[i], i); $('#text' + (i + 1)).textinput(); $('#submit' + (i + 1)).button(); $('#cancel' + (i + 1)).button(); }

java - Removing Specific Entries from ArrayList -

i have array list following sample entries (name & disease): 1. name: aimee cholmondeley. disease: german measles 2. name: colin anissina. disease: diphtheria 3. name: colin anissina. disease: malaria 4. name: aimee cholmondeley. disease: typhoid fever 5. name: isaias cheung. disease: haemophilus influenza 6. name: isaias cheung. disease: scarlet fever 7. name: sebastian cutting. disease: gingivitis 8. name: juan weiss. disease: acquired immunodeficiency sydrome (aids) 9. name: kaelyn nauman. disease: amebiasis 10. name: kaelyn nauman. disease: human pulmonary syndrome (hps) 11. name: lyndsey stapleton. disease: chlamydia 12. name: lyndsey stapleton. disease: chlamydia same name, different disease -> remove both! one instance -> keep same name, same disease -> keep, 1 copy! now, reason, .equals isn't working. can't if (arraylist.get(i).equals(arraylist.get(j)) remove . i'm comparing names , diseases

jquery - add tabs which are closable with dynamic content -

hi asked question. didn't perfect solution this. want add closeable tabs come dynamically . see plugin demo plugin . pl z need dis. code $(document).ready(function(){ $('ul.url_list > li > a').click(function(){ var me = $(this); var url = me.attr('data'); var ppr = me.html(); $('.dynamic_content > iframe').remove(); $('.dynamic_content').append('<iframe src="' + url + '" width="100%" height="300px"></iframe>'); $('ul.maintabs') .append('<li><a href="#" data="'+url+'"> ' + ppr + ' </li></li>') }); $('ul.maintabs > li > a').click(function(){ var re = $(this); var vrl = me.attr('data'); $('.dynamic_content > iframe').remove(); $('.dynamic_content').append('<i

Android FTP Server -

i using following code make android device ftp server (android internal storage). getting exception of os.android.networkonmainthread . have tried put onstart code in asynctask app never executes , crashes on launch. regarding ftp server on android great have no idea how working. here mainactivity code package com.googlecode.simpleftp; import java.io.ioexception; import java.net.serversocket; import java.net.socket; import java.util.concurrent.executorservice; import java.util.concurrent.executors; import android.app.activity; import android.app.alertdialog; import android.app.dialog; import android.content.context; import android.content.dialoginterface; import android.os.bundle; import android.view.menu; import android.view.menuinflater; import android.view.menuitem; import android.widget.textview; import android.widget.toast; public class ftpserver extends activity { private static int command_port = 2121; static final int dialog_alert_id = 0; private sta

flash - AS2 Accessing instance names in for loop with numbers at the end -

so right here code var binaryarray:array = [ 1,0,0, 0,1,0, 0,0,1] for(i = 0; < binaryarray.length; i++){ if(binaryarray[i] == 1){ light + i.gotoandstop(2); } } i have 9 movieclips on stage instances of light0, light1, light2, etc... but can't seem work assuming light0, light1, etc on stage need go: this["light" + i.tostring()].gotoandstop(2);

assembly - Any idea why this code is not loading my data properly? -

i new assembly, , working on simple kernal raspberry pi in assembly. have function prints 16-bit characters binary file including .incbin directive. reason though, can't print characters. here snippets of have context: i have .incbin directive .align 4 loads binary 16-bit font file kernal. places beginning of font characters @ 0x9010. i passing 0x41 character function capital 'a'. letter begins @ 0x9420. i loading font base address ldr instruction: ldr fontaddr, =font then, multiplying character 16 , adding address 0x9420 address. add fontaddr, fontaddr, r0, lsl #4 r0 input of character code. in loop, getting 1 byte @ time , drawing pixels based on each bit in byte. incrementing fontaddr after each load. ldrb row, [fontaddr], #1 my loop , other code works perfectly. tested separately hardcoded data, , printed every pixel of 8x16 character block. also, if change above statement to: mov row, #0b10101001 or that, prints 4 vertical lines 16 pixels tal