Posts

Showing posts from May, 2010

android - Spinner onItemSelected called erroneously (without user action) -

i have spinner showing in dialog view, , moment dialog starts onitemselected called. don't want process when user makes selection. either need prevent (maybe because no default value set?), or need know not user making selection? androider, have found solution problem , posted here (with code sample): spinner onitemselected() executes when not suppose to

java - Determining Android VPN Interface/IP? -

i'm trying determine name of pptp vpn interface in android can list bind-able interface in application. since there no vpn api in android -- figured use straight java find it. when standard java list of interfaces, ie. arraylist<networkinterface> allinterfaces = collections.list(networkinterface.getnetworkinterfaces()); i see few interesting things: when phone on 802.11x wifi tiwlan0 (the wifi interface) ppp0 (the vpn) when phone on verizon only ppp0 (the vpn, usually) ppp1 (the vz network, usually) so - need way eliminate vz interface. can networkinfo objects android api this: connectivitymanager conman = (connectivitymanager)this.getsystemservice(context.connectivity_service); networkinfo[] infolist = conman.getallnetworkinfo(); there few problems method: the vpn doesn't show up the names/fields in network info objects don't correspond in java networkinterface object the way see there's few ways eliminate vz interface inter...

Casting or converting a char to an NSString in Objective-C -

how convert char nsstring in objective-c? not null-terminated c string, simple char c = 'a' . you can use stringwithformat: , passing in format of %c represent character, this: char c = 'a'; nsstring *s = [nsstring stringwithformat:@"%c", c];

http - How can I tell what preferences/configuration is forbidding a URl in Apache? -

i have url flash file. http://www.example.com/aff/banners/banner.swf?tag=http%3a%2f%2fwww.example.com it has param, consist of encoded url. when remove . in .com of encoded url in param, flash returned fine. however, when add period, 403 forbidden on me. replacing period %2e same thing. i have examined 2 .htaccess files in directory, both doing url rewriting , don't have flash file/directory in question. i have looked @ apache logs. how can figure out preference/configuration/etc making request forbidden?

How to interpret GDB "info frame" output? -

can please me understand this:- (gdb) info frame stack level 0, frame @ 0xb75f7390: eip = 0x804877f in base::func() (testing.cpp:16); saved eip 0x804869a called frame @ 0xb75f73b0 source language c++. arglist @ 0xb75f7388, args: this=0x0 locals @ 0xb75f7388, previous frame's sp 0xb75f7390 saved registers: ebp @ 0xb75f7388, eip @ 0xb75f738c what "ebp, eip locals @ , previous frame's sp " means? please explain (gdb) info frame stack level 0 frame num in backtrace, 0 current executing frame, grows downwards , in consistence stack. frame @ 0xb75f7390 starting memory address of stack frame eip = 0x804877f in base::func() (testing.cpp:16); saved eip 0x804869a eip register next instruction execute (also called program counter). @ moment, next execute @ "0x804877f", line 16 of testing.cpp. saved eip "0x804869a" called "return address", i.e., instruction resume in caller stack frame after returning ...

How do I fast-forward other tracking branches in git? -

we working model of single remote repository of use. branch new features , reintegrate trunk branch. our workflow should integrate trunk our working branches when other features integrated trunk. as such, it's not uncommon do: (branch) $ git commit -a -m"blah blah blah" (branch) $ git fetch # origin/trunk updated (branch) $ git checkout trunk (trunk) $ git pull # trunk fast-forwarded current version of origin/trunk. (trunk) $ git checkout branch (branch) $ git merge trunk (branch) $ git push i don't "git checkout trunk/git pull/git checkout branch" cycle. it's combined visual studio complaining files , projects have changed on disk, , should reload them. both checkouts. , pull. , merge. merge unavoidable, because of how git works, should able fast-forward on trunk without needing check out. but don't know command, , google-foo has failed me on this. know how? do need update local trunk branch? just fetch origin/trunk , merg...

mysql - Insert with Hibernate native query does not work for java.util.Date -

i using hibernate jpa , spring mysql database , want insert using sql statement this: date savedate = new date(); java.sql.timestamp timestampdate = new timestamp(savedate.gettime()); query persistablequery = entitymanager.createnativequery("insert task_assessment (active_flag, assessment_date, description, " + "title, needs_level_id, patient_id, user_id) values (" + true +", " + timestampdate + ", " + description + ", " + title + ", " + needslevelid + ", " + patientid + ", " + userid + " )"); persistablequery.executeupdate(); but after running following error: warn : org.hibernate.util.jdbcexceptionreporter - sql error: -11, sqlstate: 37000 error: org.hibernate.util.jdbcexceptionreporter - unexpected token: 15 in statement [insert task_assessment (active_flag, assessment_date, description, title, needs_level_id, patient_id, user_id) values (true, 2011...

MySQL select only two or more rows grouped -

i have table containing 2 fields: id , username. how make select query select rows minimal 2 rows grouped? this inside mysql table: id| username 1 | peter 2 | jack 3 | peter 4 | ann 5 | peter 6 | jack i want select in result this: peter (3) jack (2) username 'ann' ignored in selection cause it's 1 row. added: cannot implement situation. ok, show want do, this: (select ip ip1 ip_denylist) union (select count(user) sometotal entrances ip = ip1 , having count(sometotal) > 1) group user. but it's not working! show how must be? the idea of select first: select each ip address ip_denylist table, 2nd: select grouped user rows table entrances have same ip addresses. select username, count(username) sometotal table group username having count(username) > 1

javascript - jQuery: How to save my version of jQuery before third party script loads different version of jQuery? -

similar question reference: how run different versions of jquery on same page? i have situation have own version of jquery(1.4.2), sorts of custom functions defined. version of jquery loaded before third party script, loads own version of jquery (1.4.3), , when script loaded somehow destroys custom functions had. third party script uses noconflict after jquery loaded. because of noconflict code, assume problem fixed if load third party script before else, environment such cannot guarantee this, can run custom javascript before and/or after loading script if load dynamically. what wondering if there way can save/restore/protect own version of jquery custom methods accessible after third party script runs? if can run custom code before , after script loaded believe it: var $myjq = jquery.noconflict(); // load other script. should move away $ , jquery variables // if calls noconflict. var $ = $myjq; i believe gets you're after.

int - php sqrt function that returns an integer? -

i'm creating simple php program action if (and if) 3 random numbers compute integer. random numbers integers, created rand() function. without going specific details of computation, important thing (in terms of problem) includes taking of square root. not being experienced php coder, square root function know sqrt(). problem is, sqrt() returns float, when input integer , output exact. briefly thought converting output integer (using intval(), won't work because convert all outputs integers, making test useless! ideas on how this? thanks, if want determine if perfect square, determine if intval(result) * intval(result) == originalvalue i don't know php version of functions, perhaps do? :)

php - Passing or returning streams to/from a COM object -

perhaps i'm trying either impossible or simple there nothing (that find) written anywhere. @ general level, i'm trying determine how (if it's possible) pass stream or return stream com object. specifically, com object written in delphi , typically used php script. use-case returning large block of binary data stream com object web client via php; or writing large block of binary data received web client directly com object (instantiated php script). currently, i'm doing these functions having com object , php exchange these blocks of data through temp files--the overhead of creating these temp files i'm trying avoid. the typical way work streams , com via istream interface. i'm not sure php, don't it, if can work com using istream way go. there's article , sample code istream in delphi here .

ios - Rendering the layer of a UIWebView that contains an SVG file -

i attempting use method i've constructed save layer of uiwebview image. working svg have loaded uiview not getting rendered in image, background of uiwebview. + (bool)imagefromsvginwebview:(uiview *)theview usepng:(bool)usepng; { uigraphicsbeginimagecontext(theview.frame.size); [theview.layer renderincontext:uigraphicsgetcurrentcontext()]; uiimage *layerimage = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); nsdata *layerimgdata = nil; nsstring *pathcomponent = nil; if (usepng) { layerimgdata = uiimagepngrepresentation(layerimage); pathcomponent = @"png"; }else { layerimgdata = uiimagejpegrepresentation(layerimage,1.0f); pathcomponent = @"jpg"; } nsstring *appfile = [[ccfilemanagement conversionsdirectory] stringbyappendingpathcomponent:string(@"img.%@",pathcomponent)]; nserror *error = nil; bool returnbool = [layerimgdata writetofile:appfi...

recursion - Permutation of jagged array -

i'm trying create permutation of multidimensional array in classic asp (vbscript) , i'm stuck. i've tried several functions of own , tried copying several php versions over, end either goes buffer overflow / infinite recursion or results more combination permutation, if understand differences correctly. lets it's shirt. shirt can have colors, sizes, , styles. (the actual system allows number of "groups" of options (think color, size, etc) , number of options within each group (each particular size, each particular color,etc). for example: small med lg xl red blue green white pocket no-pocket note number of elements in either dimension of array unknown beforehand; also, not second dimensions have same number of elements. i need iterate through each possible unique option contains option each row. in particular example, there 32 options (because need ignore results have empty value given option, since asp doesn't ...

c# - Winform project migration question -

i have got few projects , when run them on computer, fires error says: debugging doesnt belong to... and opens browser dialog box if wants me point missing file.. how can overcome problem? "entering break mode failed following reason: source file:"d:document , settings..."(path old directory files were).. doesnt belong to project being debugged.." try here: "entering break mode failed following reason: source file xxx not belong project being debugged from above post: i found 2 things may have helped: 1) had moved folder location of dependent project, removed , re-added project solution. however, "references" of depending project still showed path old location. these properties unfortunately read-only within gui, removed , re-added project reference. 2) noticed visual c# 2005 express doesn't have "build", "clean solution" menu option. instead, closed visual c#, deleted ...

Running 32bit powershell on a 64bit server from c# -

i wondering if there way stipulate version of powershell initialised (32bit\64bit) on 64bit windows 2008 server using c# , the system.automation namespace? the reason have created ps1 script uses com object work in 32bit powershell environment. i not aware of way specify 32bit\64bit during runspace creation may wrong. thoughts or suggestions? thanks changing application's configuration "any cpu"/"x64" "x86" simplest way make sure powershell script runs in 32-bit. can check script these contents: if ([system.intptr]::size -eq 8) {'64-bit'} else {'32-bit'} configuring runspace 32-bit running in 64-bit application may possible, may more trouble it's worth.

asp.net - Add parameter to dataAdapter.fill() -

i trying add parameter sqldataadapter. have tried use parameters.add() adapter not sqlcommand. here of code. private sub converttocsv(byval sqlquery string) dim dt new datatable() dim sqlcon new sqlconnection("data source=db;initial catalog=productionservicereminder;user id=id;password=pass;") dim ada new sqldataadapter(sqlquery, sqlcon) ada.fill(dt) public sub excsp(byval reprtid integer, byval pgid integer) converttocsv(sql4) end sub basically trying this: ada.parameters.add(new sqlparameter("@pgid", pgid)) use selectcommand: ada.selectcommand.parameters.add(new sqlparameter("@pgid", pgid)) http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqldataadapter.selectcommand.aspx

java - Faster way than Scanner or BufferedReader reading multiline data from STDIN? -

note: coding in java. looking read input data string, 1 line @ time (or more), , expect lot of total lines. right have implemented scanner in = new scanner(system.in) while (in.hasnextline()) { separated = in.nextline().split(" "); ... } because within line inputs space delimited. unfortunately, millions of lines process slow , scanner taking more time data processing, looked java.io libraries , found bunch of possibilities , i'm not sure 1 use ( bytearrayinputstream , fileinputstream , bufferedinputstream , pipedinputstream ). 1 should use? to specify, data being piped in text file, every line has either 4 or 6 words ended newline character, , need analyze 1 line @ time, setting (4 or 6) words array can temporarily manage. data format: 392903840 c b 293 32.90 382049804 c 390 329084203 d e r 489 384.90 ... is there way scanner can read 1000 or lines @ time , become efficient or of these datatypes should use(to minimize speed)? sidenote: while e...

.htaccess - htaccess 301 redirection using regular expression -

this current .htaccess file rewritecond %{request_filename} !-f rewritecond %{request_uri} !(.*)/$ rewriterule ^(.*)$ $1/ rewriterule ^([^/]+)/$ index.php?p1=$1 [l] rewriterule ^([^/]+)/([^/]+)/$ index.php?p1=$1&p2=$2 [l] rewriterule ^([^/]+)/([^/]+)/([^/]+)/$ index.php?p1=$1&p2=$2&p3=$3 [l] rewriterule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/$ index.php?p1=$1&p2=$2&p3=$3&p4=$4 [l] rewriterule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/$ index.php?p1=$1&p2=$2&p3=$3&p4=$4&p5=$5 [l] basically, takes 5 "friendly url folders" , assign value varibles , then, send index.php page ie: http://www.example.com/ford/focus/grey/ $p1 = 'ford'; $p2 = 'focus'; $p3 = 'grey'; $p3 = 'grey'; so far, good. now, need integrate 301 instruction (regexp?) in same .htaccess because initially, had parameters : ie: http://www.example.com/ford/focus/grey/?lang=fr i need rid of variables because google sees duplicate conte...

MYSQL query, optimization -

this sql query using in page building. runs 8 seconds , returns 12000 records, correct wondering if make possible suggestion how make faster? select distinct advertiser.advertiserid, business.name, business.address1, business.address2, business.city, business.state, business.postalcode, business.country, business.phone, business.fax, business.email, advertisercategory.categoryid, advertisercategory.categoryname category, (select max(pubdate) pubdate newspaperad (advertiserid = advertiser.advertiserid) group advertiserid) pubdate business inner join advertiser on business.businessid = advertiser.advertiserid inner join tsheetrecipient on advertiser.advertiserid = tsheetrecipient.advertiserid left outer join advertisercategory inner join advertisercategoryjoin on advertisercateg...

url - Making a localhost apache webserver go live -

i have looked on internet , can't reasonable way make web-server running on apache go live unique ip , everything. how got making live , viewable other people? normally not this. you'd buy hosting account provider godaddy, bluehost, etc. , put software there, , make visible way. making localhost server viewable involve buying static ip, not cost effective people.

javascript - using a tag to replace div -

my site has 2 pages both have hyperlinks each other when user click on hyperlink need div of page replaced div on other page, please guide me how program it. structure page1.html <div id="no_replace"> <a href="page2.html">page 2</a> <div id="replace"> //page 1 stuff </div> </div> page2.html <div id="no_replace"> <a href="page1.html">page 1</a> <div id="replace"> //page 2 stuff </div> </div> so on page 1 when usr clicks on link "page two" ... want 'replace' div of page 1 replaced 'replace' div of page2.html you need use javascript trigger event content of div replace when button clicks. learn javascript w3schools. <script type="text/javascript"> function dosomething(){ //replace div content here } </script> <a href="somelink" onclick="dosomethin...

internet explorer - google calender not getting displayed in chrome and IE -

i have following iframe google calendar: <div> <iframe src="https://www.google.com/calendar/embed?src=bdeesh%40gmail.com&ctz=america/new_york" style="border: 0" width="800" height="600" frameborder="0" scrolling="no"> </iframe> </div> it displays on w3 online browser , firefox. in explorer following error occurs: to protect security of information enter website, publisher of content not allow displayed in frame. and in chrome doesnt show up. there way circumvent this? thank you. i figured out. need make public before can show on browsers. showed on firefox because had gmail open on tab. opened w3 in firefox too.

c# - Using HashSet and Contains to return TRUE if one or many fields is in the hash -

i wondering if possible use hashset , make method contains return true if 1 of field in hash giving object. this example of like static void main(string[] args) { hashset<product> hash = new hashset<product>(); // since id same, both products considered same if uri not same // opposite true. if uri same, both products considered same if id not same product product1 = new product("123", "www.test.com/123.html"); product product2 = new product("123", "www.test.com/123.html?lang=en"); hash.add(product1); if (hash.contains(product2)) { // want method "contains" return true because 1 of field in hash } } here definition of class product public class product { public string webid public string uri public product(string id, string uri) { webid = id; uri = uri; } public override bool equals(object obj) { if (referenceeq...

Get values from textfile with C# -

i've got textfile contains following data: name = sir age = 23 profile = none birthday= germany manufacturer = me and want profile, birthday , manufacturer value can't seem right. succeded including file program there stops. can't figure out how clean textfile up. here's current code: http://sv.paidpaste.com/hrqxbg using system; using system.io; using system.linq; class program { static void main() { var data = file .readalllines("test.txt") .select(x => x.split('=')) .where(x => x.length > 1) .todictionary(x => x[0].trim(), x => x[1]); console.writeline("profile: {0}", data["profile"]); console.writeline("birthday: {0}", data["birthday"]); console.writeline("manufacturer: {0}", data["manufacturer"]); } }

f# - use another matchings in some matching -

it's not hard trouble i'm learning language want code being sorta elegant , don't : match aver | 1 -> @" group datepart(year, dt.[date]), datepart(month, dt.[date]), datepart(day, dt.[date]), datepart(hour, dt.[date]), (datepart(minute, dt.[date]) / 10)" | 2 -> @" group datepart(year, dt.[date]), datepart(month, dt.[date]), datepart(day, dt.[date]), datepart(hour, dt.[date])" | 3 -> @" group datepart(year, dt.[date]), datepart(month, dt.[date]), datepart(day, dt.[date])" | 4 -> @" group dat...

ios - push uiviewcontroller from presentModalViewController -

i show view using presentmodalviewcontroller . , uiview want push uiview using uinavigationcontroller . tried below code [self.parentviewcontroller.navigationcontroller pushviewcontroller:objviewfullscreen animated:yes]; but did not works me. please can 1 suggest how push view modelviewcontroller . thanks first have present modal view controller inside navigation controller: myviewcontroller *vc = [[myviewcontroller alloc] initwithnibname:@"mynib" bundle:nil]; uinavigationcontroller *nc = [[uinavigationcontroller alloc] initwithrootviewcontroller:vc]; [self presentmodalviewcontroller:nc animated:yes]; [vc release]; [nc release]; then inside myviewcontroller can do: otherviewcontroller *vc = [[otherviewcontroller alloc] initwithnibname:@"myothernib" bundle:nil]; [self.navigationcontroller pushviewcontroller:vc animated:yes]; [vc release];

asp.net - Model Binding binding at more than one level -

i have several forms, require checkbox each province/state. therefore, i've made partial view render checkboxes inside form promote code re-use. when user submits form controller method, regionsviewmodel not binded. overall question is, how can multiple forms share partial view , view model? here's sample code of situation models public class form1viewmodel { /* properties */ public regionsviewmodel regions {set; get;} } public class form2viewmodel { /* properties */ public regionsviewmodel regions {set; get;} } public class form3viewmodel { /* properties */ public regionsviewmodel regions {set; get;} } public class regionsviewmodel { public bool on {set; get;} public bool qc {set; get;} /* continues provinces , states */ } controller [httppost] public actionresult form(form1vewmodel model) { //all properties except model.regionviewmodel not bind submitted form :( } form1viewmodel.aspx <% using (html.beginform()) ...

html - Table column resize -

i have such table structure(i can replace div if possible solve problem suing them) , set width of left column fixed size in pixels, example 300px , make right column auto width keep resized left column border of browser. solution not work in situation. <table> <tr> <td width="300"> fixed size </td> </tr> <tr> <td width="100%"> take free space </td> </tr> </table> using/suing divs: <div style="background-color: lime; float: left; width: 300px;">fixed size</div> <div style="background-color: cyan; margin-left: 300px;">take free space</div> demo here

How to make a Php response to Objective-C (iPhone)? -

my problem don't know how send data find (with select where) in php objective-c. know need make dataset how do it? people should use json can't find solution. indeed, don't know how make response in php? can me? this php code: $con = mysql_connect("url","username","password"); if (!$con){die('could not connect: ' . mysql_error());} mysql_select_db("appiness", $con); $bilgi= mysql_query("select c_id country c_name='$country'"); while($sutun= mysql_fetch_array($bilgi)) { echo $sutun["c_id"]; } mysql_close($con); this objective-c code: nsurl *url = [nsurl urlwithstring:@"someurl"]; asiformdatarequest *request = [asiformdatarequest requestwithurl:url]; [request setpostvalue:year1 forkey:@"year"]; [request setpostvalue:appy_level forkey:@"appy_level"]; [request setpostvalue:reasons forkey:@"reasons"]; [request setpostvalue:country forkey:@...

ios - Processing annotations from XML feed -

hee all, at moment i'm working on reading locations (valid) xml feed. <locations> <location> <title>supercoop</title> <category>supermarkt</category> <adres>something</adres> <latitude>52.8982342</latitude> <longitude>5.2449449</longitude> </location> <location> <title>thuis</title> <category>home</category> <adres>something</adres> <latitude>52.223482</latitude> <longitude>5.248282</longitude> </location> </locations> "no real data in example" i use touchxml parsing , works fine. my question is: preferred way of processing information mkannotation. i thought making object, example: mylocation , store there, have walk trough lots of mylocation objects. secondly want object / annotation accessible when use ...

c# - How to dynamically change a WPF control's template using a checkbox? -

i have error dialog (shown simplified below). i display report object in contentcontrol have defined template simpleerrortemplate . there checkbox on window use change template to/from detailederrortemplate . best way achieve this? <window x:class="core.errordialog" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <window.resources> <controltemplate x:key="simpleerrortemplate"> <textbox margin="10,10,10,5" textwrapping="wrap" verticalscrollbarvisibility="auto" text="{binding message}" /> </controltemplate> <controltemplate x:key="detailederrortemplate"> <textbox margin="10,10,10,5" textwrapping="wrap" verticalscrollbarvisibility="auto" text="{binding message}" /> ...

java - How should I write JDBC url for Oracle with LDAP and two LDAP servers? -

i have oracle database ldap, , can connect writing smth like: jdbc:oracle:thin:@ldap://oid0.wow.com:666/chost,cn=oraclecontext,dc=wow,dc=com but not failover (we have server oracle ldap - oid1.wow.com:666) how can use both servers reach failover? found solution , doesn't work: java.sql.sqlexception: io exception: invalid ldap url specified @ oracle.jdbc.driver.databaseerror.throwsqlexception(databaseerror.java:113) @ oracle.jdbc.driver.databaseerror.throwsqlexception(databaseerror.java:147) @ oracle.jdbc.driver.databaseerror.throwsqlexception(databaseerror.java:257) @ oracle.jdbc.driver.t4cconnection.logon(t4cconnection.java:389) @ oracle.jdbc.driver.physicalconnection.<init>(physicalconnection.java:454) @ oracle.jdbc.driver.t4cconnection.<init>(t4cconnection.java:165) @ oracle.jdbc.driver.t4cdriverextension.getconnection(t4cdriverextension.java:35) @ oracle.jdbc.driver.oracledriver.connect(oracledriver.java:802) @ com.mchange.v2.c3p0.drivermanagerdatasource...

Calling a method of a Ruby Singleton without the reference of 'instance' -

i call method of singleton object without reference instance singletonklass.my_method instead of singletonklass.instance.my_method i've came solution (using method_missing in class): require 'singleton' class singletonklass include singleton def self.method_missing(method, *args, &block) self.instance.send(method, *args) end def my_method puts "hi there!!" end end is there drawback ? there better solution ? recommendation ? thank you. update: my aim have module mixed-in singleton classes: module noinstancesingleton def method_missing(method, *args) self.instance.send(method, *args) end end end use in class: class singletonklass include singleton extend noinstancesingleton def method1; end def method2; end ... def methodn; end end i want able directly call: singletonklass.method1 using forwardable , def_delegators: require 'singleton' require 'forward...

flash - How to use a new movieClip as a Class or to copy it without reference to its class? -

i doing looping background 2 identical bg movieclip (b1 , b2). 2 "new" same class. var b1:movieclip = new bg(); var b2:movieclip = new bg(); but because bg class picture loader internet , picture rather big. when addressed loading using progressevent. picture loaded 2 times. there anyway create b2 based on b1 without using new bg() again? since makes new bg loader code inside. thank ^^ for bg class code: var urlvar:urlrequest; var bgloader : loader = new loader( ); urlvar = new urlrequest( "somewherelink.jpg" ); bgloader.load(urlvar); this.addchild(bgloader); is there way set if b1 loaded, copy b2? or other way achieve same goal? import flash.display.*; import flash.utils.*; var obj:class = getdefinitionbyname(“bluebox”) class; addchild(movieclip(new obj())); i found 1 in dynamically create class, dunno how use t_t, can explain me , can use in situation? thank time ^^ for answer i'm going assume going want have same image twice, rather...

ruby - How to log into amazon associate page with mechanized -

i want scrape associate data cant log into: https://affiliate-program.amazon.com/gp/associates/login/login.html i have tried various methods offered mechanized without success. amazon returns me login page. i have looked , amazon api not cover feature. any ideas how this? i don't know ruby, python try boto

wpf - is it Visual Studio 2010 IDE bug? -

making templete window contentpresenter. applying template. place control in window. the placed control's region(adorner decorator) not correct. (biased top left). control displayed right position. when project loaded in expression blend, window displayed properly. (adorner too) is visual studio 2010 ide bug? yes, problem visual studio. when apply template window, objects added window not display in correct position @ design time. not seem affect proper run-time behavior/display. an example: grid control (the design outline) displayed origin shifted upper-left corner, contents of grid displayed properly.

objective c - XCode/Instruments not showing memory leaks -

i'm following stanford ios development lectures , have calculator brain class has been alloc init in controller haven't release d in dealloc . - (calculatorbrain *)brain { if (!brain) brain = [[calculatorbrain alloc] init]; return brain; } i ran xcode -> run performance tool , app started , no leaks appeared, clicked home button in ios simulator , nothing, double clicked home button , closed app , still nothing. i did build & analyse , didnt spot anything could let me know why not picking up? it appears if there no detectable leak. @ line: brain = [[calculatorbrain alloc] init]; as long brain points object, object won't considered "memory leak". if @ point this, brain = nil; then leak register. deallocating container object achieve this, sure it's being deallocated? (it won't deallocated when program exits, example.) the problem: leak detectors cannot detect memory leaks -- mathematically p...

How to configure certain keywords to bring certain URL in Sharepoint Search? -

we have 20 sharepoint internal site. when people type coffee, sugar, show webportal first (portal.foo.com/kitchensupplies) in search. when people type computer, batteries, etc, bring site first in list (portal.foo.com/electronicsupplies) does call ranking keyword site (or portal in case)? the functionality looking called best bets. here's technet article on how add keyword terms best bets .

animate 3d plot with some further requirements in mathematica -

Image
i posted @ this post before, still not solve following problem completely. example: {pa, pb, pc, pd} = {{0, 0, sqrt[61/3]}, {sqrt[7], 4*sqrt[2/3], 0}, {0, -5*sqrt[2/3], 0}, {-sqrt[71], 4*sqrt[2/3], 0}}; axis={1,0,0};pt={0,1,0}; plotpolygon[{a_, b_, c_}] := {opacity[.4], polygon[{a, b, c}]}; graph=graphics3d[{plotpolygon[{pa, pb, pc}], plotpolygon[{pa, pb, pd}], plotpolygon[{pb, pc, pd}], plotpolygon[{pa, pc, pd}]}, axes -> true, axesorigin->pt]; animate[graph/.gg : graphics3d[___] :> rotate[gg, theta, axis], {theta, 0., 2.*pi}] i want rotate along axis axis={1,0,0} passes point pt={0,1,0} . don't know how specify point information. rotation animation seems chaotic in sense expect @ least 1 point (in case, origin?) not rotating. you need first change origin of vertices of polygon, rotate, , translate back. can hand (rotationmatrix[theta,axis].(#-pt) + pt)& /@ {pa, pb, pc, pd} or, can combine transformations using compo...

c# - What is the open generic type of the array []? -

when int[] , string[] , t[] - generic array. array object else. so actual open generic type of []? assume syntactic sugar on array<> haven't been able find of sort. bonus points if can somehow answer before jon skeet. it's system.array; isn't generic. see here brief discussion: http://blogs.msdn.com/b/ericlippert/archive/2007/10/17/covariance-and-contravariance-in-c-part-two-array-covariance.aspx

replication - PostgreSQL WAL. Is it possitble to rollback/rollforward changes in 1 concrete database? -

i have server 4 bases on in. wal registers changes in databases. if want rollback or rollforward changes in 1 database , excluding 3 others - how possible? no, not possible. wal segments hold changes databases in single cluster. if looking replication of single database using wal, have create seperate cluster database. use initdb create second cluster , different data directory, start second cluster , you're done, have 2 clusters running on single (virtual) machine. another option slony .

java - Convert date formats for storage -

all of code formats , displays dates this: 3-1-2011 3-15-2011 12-1-2011 12-15-2011 what's best way format yyyy-mm-dd storage in sqlite db? try string inputdate = "12-15-2011"; dateformat df = new simpledateformat("yyyy-mm-dd"); date date = df.parse(inputdate);

asp.net - UpdatePanel + Validators works! Stops async requests for sometime after validation tho -

this not same old question validators , update panel compatibility. here's scenario: i have aspx page script manager. page has ascx user control functionality. in control, have few panels , areas enabled/disabled or visible/hidden according visitor selects clicking on of radio buttons control behaviour. fine until point. validators , updatepanel not fighting against each other, however, if try submit page without filling form, validation message on summary , it's validation itself.. here's problem, radio buttons, responsible set visibility areas stops working, starts working again after 2nd or 3rd click. it's not delay or anything.. seems handlers not bound control, click again, , cleans summary , error notifications , starts working again.. don't know if adds issue, both user control , page have telerik controls such combo box load on demand, tooltips , loading panel.. i have searched lot , find question regarding validation controls not working inside u...

python - Method to sort a list of lists? -

i have list of lists (can't tuples since have generate dynamically) , structured list of lists of 1 int , 1 float so: [[1,1.0345],[2,5.098],[3,4.89],[2,5.97]] i want sorted have managed built in sorting function sort first element of lists or not anything, need sort them second element of list , don't want implement own sorting function. example of want is: [[1,1.0345],[3,4.89],[2,5.098],[2,5.97]] could tell me how 1 of built in sorting functions this? pass key argument. l.sort(key=operator.itemgetter(1))

javascript - Read the contents of a "file" object? -

so have "file" object (retrieved handling file drag , drop desktop). can send files server ajax, , throw them javascript handle them. possible read contents of without doing this? here, play around fiddle. drag file box , use variable file . i've tried of methods of object...no luck. can contents of file dragged browser? ps: send files server this: var ajaxrequest = new xmlhttprequest(); ajaxrequest.open("returnrawpostdata.php"); ajaxrequest.send(file); i might have missed in code above, that's because 1 doesn't use plain js ajax calls anymore. using links martin mally (thanks lot!), came this: var file = e.datatransfer.files[0],read = new filereader(); read.readasbinarystring(file); read.onloadend = function(){ console.log(read.result); } where read.result holds contents of file.

c# - Cast filestream length to int -

i have question safety of cast long int. fear method wrote might fail @ cast. can please take @ code below , tell me if possible write avoid possible fail? thank in advance. public static string readdecrypted(string filefullpath) { string result = string.empty; using (filestream fs = new filestream(filefullpath, filemode.open, fileaccess.read)) { int fslength = (int)fs.length; byte[] decrypted; byte[] read = new byte[fslength]; if (fs.canread) { fs.read(read, 0, fslength); decrypted = protecteddata.unprotect(read, createentropy(), dataprotectionscope.currentuser); result = utils.appdefaultencoding.getstring(decrypted, 0, decrypted.length); } } return result; } the short answer is: yes, way have problems file length >= 2 gb! if don't expect files big can insert directly @ start of using bloc...

javascript - .innerHTML vs. createElement() | setAttribute() vs. Direct* -

i told not "proper", did not worry until started getting run-time error in ie9. here code need converted use object properties. why innerhtml not considered best practice? var c=document.createelement('div'); c.innerhtml= '<a name="a1" class="b" href="' + d[2].value + '">' + d[1].value + '</a>'; it's strange you're putting a element inside a element below should work. var c=document.createelement('a'); c.name = "a1"; c.classname = "b"; c.href = d[2].value; c.appendchild(document.createtextnode(d[1].value)); this assumes d[1].value not known formed html trusted source more robust against xss innerhtml code.

javascript - anatomy of GDownloadUrl -

i using gdownloadurl send client data server.here sode used gdownloadurl( dwnld_url, function(data) { if(!empty(data)){ // parsing xml var xml_doc = gxml.parse(data); } else { alert ('could not genarate attractions. please try again!'); } }, tmp_xml_doc ); can please explain me function(data) means.i read documentation.but confused.can suggest me tutrial because new web programming.thanks in advance the function(data) {...} anonymous function. function called when response of dnwnld_url returned. function called response data , handle data in body of anonymous function. parse xml can xml result. hope made sense you. cheers!

Android performance problems with view animation (sliding in/out) -

i have fullscreen view flipper on galaxy tab containing 2 relative layouts, each of displaying between 5 , ten image views. i having problems when try slide 1 of view flipper viewso ut , other in, "animation" nothing , switches. if remove 1 of image views in each of view flipper children animation fine. can somehow force use mixed down version of image animation, or relative layout container causing performance problem? there should nothing going on @ time flipper animation occurs can't understand problem. thanks edit: of problematic code: perhaps might indicate areas causing performance problems? i have in onclick, 2 method calls, used switching backwards through views , forward. view "generated" before being added flipper , switched. so, on click of button (for example) have (amongst other things) .... nextview = new relativelayout(this); makeaview(selectedviewobjects, viewholder2); switchviewnow(-1); currentview = nextview; ... private...

configuration - Configuring directory aliases in Starman (or other PSGI servers) -

i used setting aliases different directories in apache httpd.conf. example, following works me alias /lib /path/to/lib then can include paths such <script src="/lib/jquery/plugin/funky.js"></script> no matter application path. i trying out starman (and other psgi servers such http::server::psgi), , can't figure out way set configuration parameters such alias directories. can done? how? it can done using plack::middleware::static. use plack::builder; builder { enable "static", path => sub { s!^/lib/!! }, root => "/path/to/lib/"; $app; }; and you'll "/lib/foo.js" loaded "/path/to/lib/foo.js". should work starman , psgi supported web servers. more information available in the online documenetation .

Users with duplicate logins in ASP.Net's Sql MembershipProvider -

we have asp.net (well, wcf) application uses sqlmembershipprovider authenticate users. log in using username , password. however, i'd group these users customer, every customer can have own "admin" or "demo" user. consequently, they'd log in using customer id, username, , password. i have not found decent way membershipprovider yet. have missed something? thanks! you trying go beyond functionality offered standard asp.net membership provider. doesn't have capabilities. asp.net membership , role system extremely simple. one option use active directory (possible active directory application mode keep things separate , avoid licensing). in ad have more possibilities group users different containers , delegate control on users in specific container "admin" user.

iphone - Problem with int in Objective C -

singelton.categoryid = (int)[categories.categoriesid objectatindex:indexpath.row]; nslog(@"%d", singelton.categoryid); singelton.categoryid type int . when try print number random, if nslog(@"%@", singelton.categoryid); printed value right. need print %d . can me? use intvalue method integer representation of nsstring/nsnumber . try, singelton.categoryid = [[categories.categoriesid objectatindex:indexpath.row] intvalue];

javascript - counter with multiple digits -

i'm new javascript , have been able far following tutorials , reading forums 1 stumped me while. basically wanted have counter numbers contain 7 digits, found few things none made sense me wrote this: imgnumber++; if (imgnumber < 10){function add(number){return '00000' + number}}; if (imgnumber > 10 && imgnumber < 100){function add(number){return '0000' + number}}; if (imgnumber > 100 && imgnumber < 1000){function add(number){return '000' + number}}; if (imgnumber > 1000 && imgnumber < 10000){function add(number){return '00' + number}}; if (imgnumber > 10000 && imgnumber < 100000){function add(number){return '0' + number}}; if (imgnumber > 100000 && imgnumber < 1000000){function add(number){return '' + number}}; it works far can tell. question this: foresee issues , if not there cleaner way write this? i'll appreciate , replys. cheers, colin ...

Jquery - toggle problem -

i have toggle function $('#togglebtn').toggle(function() { $('#panel').show(); }, function() { $('#panel').hide(); }); i have button close/hide panel $('#otherbtn').click(function() { $('#panel').hide(); }); all trying when hide panel #otherbtn event still active on #togglebtn , gives me click start toggle panel again. how can fix that? trigger click event on toggle button. $('#otherbtn').click(function() { $('#panel').hide(); $('#togglebtn').click(); //resets tooglebtn state });

jquery get url from div and insert it into span -

i url <div class="ms-vb itx"> , replace href within span below. doable in jquery? make sense? <td height="100%" class="ms-vb-title ms-vb-lastcell" onmouseover="onchilditem(this)"> <div eventtype="" perm="0x7fffffffffffffff" field="linktitle" id="5" ctxname="ctx6" onmouseover="onitem(this)" class="ms-vb itx"> <a target="_self" onclick="editlink2(this,6);return false;" href="/_layouts/rf.portal.web/detailactualite.aspx?4&amp;listid={5b770e71-5269-4f45-87a0-2defa1136e40}&amp;id=5&amp;contenttypeid=0x0100fbea8b5f8e1448f4b48c33a18522e2da01001677ea3c9b9802408d15440e3b1906de" onfocus="onlink(this)">icitait l'honneur d'être reçu,</a> <img class="ms-newgif" title="nouveau" alt="nouveau" src="/_layouts/1036/images/new.gif"> </div> <div on...

exc bad access - iPhone - Problem with “EXC_BAD_ACCESS” -

i've problem. serius problem. -.-'' i've app viewbased, mainview , flipsideview. when tap on info button flipsideview appears. when tap done button, sometimes, app terminates “exc_bad_access” , don't know have do!!! in flipside view i've iad banner, managed code - (void)viewdidload { [super viewdidload]; self.view.backgroundcolor = [uicolor viewflipsidebackgroundcolor]; [textview setfont:[uifont fontwithname:@"trebuchetms" size:12]]; adview=[[adbannerview alloc] initwithframe:cgrectmake(0.0f, 460.0f, 0.0f, 0.0f)]; adview.currentcontentsizeidentifier=adbannercontentsizeidentifierportrait; [self.view addsubview:adview]; self.adview.delegate=self; self.bannerisvisible=no; uidevice *thedevice=[uidevice currentdevice]; nsstring *ios; ios=thedevice.systemversion; float ios2 = [ios floatvalue]; if (ios2>=4.0) { self.bannerisvisi...

Positional grouping using XSLT -

i have xml contain documents: <document> <line id="0"> <field id="0"><![cdata[h:doc1]]></field> </line> <line id="1"> <field id="0"><![cdata[l:1]]></field> </line> <line id="2"> <field id="0"><![cdata[l:2]]></field> </line> <line id="3"> <field id="0"><![cdata[l:3]]></field> </line> <line id="4"> <field id="0"><![cdata[h:doc2]]></field> </line> <line id="5"> <field id="0"><![cdata[l:1]]></field> </line> </document> h=header of document , l=line-item. in example whe have 2 h means 2 documents number doc1 , doc2. doc1 have 3 line items , doc2 have 1 line item. how convert data...