Posts

Showing posts from July, 2011

javascript - Where to find a modal window/box that is similar to Pinterest's scrollable modal box? -

i having hard time looking modal box has similar functionality 1 on pinterest. i using simple-modal (jquery) problems height not dynamic (putting height: auto has problems) , modal box's position fixed @ center. hence, if content long, have scrollbar on own (inside modal box) instead of being scrollable using browser's main scrollbar. when use main browser's scrollbar, it's scrolling content behind modal (which actual web page) not intend happen. do have suggestions on use? if right click on object , open new tab/window, see pinterest overlaying on main page. that said, might achieve same effect expanding full viewport iframe semi-transparent background see underlying page. to sure, i've not come across lightbox clones similar pinterest's custom jquery version hidden somewhere in it's .js file . status update: if willing create own method, i've outlined process seen in answer here

javascript - How to transfer multiple rows output to another php file to process data? -

<form name="myform" action="docontrolacc.php" method="post" onsubmit="return validateform(this);"> <table cellpadding="0" cellspacing="0" border="20" class="display" id="acc" width="200"> <thead> <tr><h2>accessories summary</h2></tr> <tr> <th>type</th> <th>currently - ex factory</th> <th>minimum required stock</th> <th>update by</th> <th>last update</th> <th>re-stock amount</th> <th>stock out</th> </tr> </thead> <tbody> <?php $accessories = array() $query = "select description, current_stock, ...

javascript - jquery click event occurs twice for single click -

i have used jquery click function, basic wrking when click on 1 button div come down , on next click come back, based on visiblity check. have pagination implemented webpage , webpage displays search results. button displayed next each search result. when click on set of buttons in first page, work fine, when go second page, nt wrk, instead open , close. add code here $("#attachment").live("click", function() { attachmentrow = $(this).attr('class'); //class value==att0 - 9 unique each button attachmentrow = attachmentrow.replace('att', ''); if (typeof results.hits.hits[attachmentrow]._source.attachments != 'undefined') { if ($(".attdrop" + attachmentrow).is(':visible')) { $(".attdrop" + attachmentrow).empty(); $(".attdrop" + attachmentrow).hide(); } else { $(".attdrop" + attachmentrow).show(); var att...

javascript - mvc 3 razor cannot clear form value with validation class -

i'm using mvc 3 razor , using unobtrusive client validation. things working great, want able reset form if user decides wants start on or cancel action. seems there lot of meta data attached each form element when using validation. <input type="text" value="" name="user.firstname" id="user_firstname" data-val-required="the first name field required." data-val-length-max="50" data-val-length="the field firstname must string maximum length of 50." data-val="true" class="text-box single-line"> the jquery snippet here shows problem. when try manually reset value of text field, other javascript intercepting execution after clear value , sets was: $("#btnreset").click(function () { alert($("#user_firstname").val()); $("#user_firstname").val(""); alert($("#user_firstname").val()); }); i...

cursor - How to do this lookup more elegantly in Python and MySQL? -

i have bunch of files in directory named nameid_cityid.txt , nameid , cityid being ids of name (integer(10)) , city (integer(10)) in mydata table. while following solution works, doing type conversions since fetchall fetches 'l' , file name tuple of nameid, cityid strings,.. if can suggest pythonic or more elegant way of doing same, awesome, me , communtiy! what trying achieve : find files directory don't have record in database , file, parse/move/delete it. mysql table mydata : nameid cityid 15633 45632 2354 76894 python : for pdffile in os.listdir(filepath): cityid, nameid = pdffile.strip('.txt').split('_')[0], pdffile.strip('.txt').split('_')[1] cursor.execute("select cityid, nameid mydata") alreadyparsed = cursor.fetchall() targetvalues = ((str(cityid), str(nameid)) cityid, nameid in alreadyparsed) if (int(cityid), int(nameid)) in alreadyparsed: print cityid, nameid, ...

bash - How can I run a quick script on lots of remote servers? -

i need restart apache on dozen servers. can log each 1 , or can have 1 script on first 1 me. can me out? server 1 has access other servers through known hosts. manually can run this: ssh user@server2 service httpd restart exit ... ssh user@server100 service httpd restart exit how can script run server 1 restart servers? for in $(seq 2 100) ; ssh user@server$i 'service httpd restart' ; done

XCode 4.3 - perl can't find C compiler after upgrade from XCode 4.2 -

i upgraded lion , xcode 4.3 , perl requires c compiler failing build: root# perl makefile.pl couldn't find c compiler compilation failed in require @ makefile.pl line 5. begin failed--compilation aborted @ makefile.pl line 5. my c compiler set to: root# perl -v:cc cc='llvm-gcc-4.2'; is there changed on xcode 4.3?, how set c compiler perl now?. the new version of xcode doesn't install binaries (such c compiler) can found in $path . you'll need go "downloads" section of xcode preferences , elect install command line tools. more information from apple (look "command line tools optional").

php - Why do i get this result? -

select * afspraken user_id = '2' , datum > '2012-06-05' or ( user_id = '2' , datum = '2012-06-05' , begintijd >= '22:47' ) order datum desc , begintijd asc this above query.. , while should 0 result still 1 is: id user_id datum begintijd opmerking 114 2 2012-06-05 9:30 deze afspraak online gemaakt. now if have correctly, query has 2 options give results.. is: user_id must same , date has higher 2012-06-05.. since same date won't give result.. now second option when user_id same, date same , when beginningtime same or higher.. time in query shown 22:47.. time in database 9:30 morning.. how 9:30 morning higher or equal 22:47?? id int(10) user_id int(10) datum date begintijd varchar(5) opmerking varchar(8000) reminder int(10) the idea cast time columns , values time: select cast('20:05' time) > cast(...

MySQL optimization on join tables with range criteria -

i going join 2 tables using single position in 1 table range (represented 2 columns) in table. however, performance slow, 20 mins. have tried adding index on table or changing query. performance still poor. so, asking optimization of joining speed. the following query mysql. mysql> select `invar`.chrom, `invar`.pos, `openchrom_k562`.score -> `invar` -> left join `openchrom_k562` -> on ( -> `invar`.chrom=`openchrom_k562`.chrom , -> `invar`.pos between `openchrom_k562`.chromstart , `openchrom_k562`.chromend -> ); invar , openchrom_k562 tables used. invar stores single position in each row. openchrom_k562 stores range information indicated chromstart , chromend . invar contains 57902 rows , openchrom_k562 has 137373 rows respectively. fields on tables. mysql> describe invar; +-------+-------------+------+-----+---------+-------+ | field | type | null | key | default | | +-------+-------------+------...

Why am I getting an extra foreign key column with Entity Framework Code First Foreign Key Attributes? -

i came across strange problem entity framework code first. my class looks this public class status { [key] public int statusid { get; set; } public string name { get; set; } public int memberid { get; set; } [foreignkey("memberid")] public virtual member member { get; set; } public int posterid { get; set; } [foreignkey("posterid")] public virtual member poster { get; set; } public virtual icollection<statuslike> statuslikes { get; set; } public virtual icollection<statuscomment> statuscomments { get; set; } } my member class looks this public class member { [key] public int memberid { get; set; } public string firstname { get; set; } public string lastname { get; set; } public string bio { get; set; } public virtual icollection<membercoursetaken> membercou...

html5 - jQuery mobile page transition -

i using jquery mobile page transition feature in application (html5 mobile app) with: <a href="test.html" data-transition="slide">abc</a> page transition works fine (the slide animation) with: <a onclick="document.location.href = 'test.html';" data-transition="slide">abc</a> page transition doesn't works, navigates doesn't slide. i want page transition work second option. please help the reason in first case, jqm page change. in second case, manually change page changing location. pages gets changed jquery using ajax gets page transition. change transition slide can configure default settings $.mobile.defaultpagetransition = "slide"; . use $.mobile.changepage() function change pages. changepage() function page transitions you. <!-- html --> <a class="testlink" data-transition="slide">abc</a> //js $(document).off('pagecha...

java - How add external resource folder on JBoss7? -

following matter jbossas 7.1 developer guider: change resourcebundle location in previous versions of as, jboss_home/server//conf/ available in classpath. hence properties files in location available in classpath of application. in as7, properties available in classpath, package them within application. example, if deploying .war package properties in war web-inf/classes/ folder. if want properties accessible components in .ear, package them @ root of .jar , place jar in ear lib/ folder. but method not if there many resource files, can't package resource file jar or ear. for new class loading method - module. try following method: create module.xml file .. chose module name... instnace custom.myconfig <resources> <resource-root path="."/> <!-- insert resources here --> </resources> <dependencies> </dependencies> </module> in jboss-deployment-stru...

php - MySQL select specific entry from a table which is not in another table -

i have problem in mysql when trying select specific entry table not in table. know sentence sounds nuts here example trying do. table users: user_id,username,password (plus other columns not important this) table articles: article_is,user_id,content (plus others) table views (used store data if user viewed specific article): view_id,article_id,user_id,date now, trying select users has not read specific article, example article id 10. have no entry in views table. i hope makes more sense now. answers. v. select user_id users u left join views v on v.user_id=u.user_id , v.article_id = 10 v.user_id null

javascript - Posting Form via Jquery not passing data -

i using following code post form not getting form data passed code behind? <script type="text/javascript"> $(document).ready(function () { $("#submit").live("click", function () { var formdata = $("#createorder").serialize(); $.post("/orders/saveextra", formdata, function (result) { if (result.created) { alert("saved successfully!"); } else { alert("error!"); } }); }); }); </script> <input id='submit' type='submit' value='save extra' style="height: 30px; width: 130px; margin-top:8px;margin-right: 15px; float:right " /> <form id="createorder" method="post" action="/orders/create" enctyp...

iphone - Core Data Update in the AppStore -

i update 1 application me. app uses core data saving data, user puts in. now want fix bugs, aren't associated core data @ all. what have user gets data after downloading update? don't think lightweight migration, because haven't changed anything. have add new model versioning file? - don't know. you don't have to anything. if model , data not updated part of update, , storing user's data in documents directory, new version of app carry on using existing data.

Is there a Git Server Side Hook to put quota on repository sizes? -

i searched around , found related topics, related limiting file sizes or concerns there quotas. i built git server gitolite place students share course projects. functions under 1 username on server, git, wild card repositories "projects/creator/[a-za-z0-9].*". repositories have writers , readers defined user can modify can write , read repository. ssh key files implemented user can create repository by: git clone git@servername.edu:projects/bob/project1 git clone git@xervername.edu:projects/bob/someotherproj and on. "bob" folder created first time git clone (it's username). my issue that, being students, there abuse , need limit size of "bob" folder. disk quotas don't work because folders , files owned git, , that's limited. i can re-engineer serve projects linux home folders , able use disk quotas, however, i'd rather not have re-engineer server have working. essentially, looking hook did rough shell script: f...

count - Multiple where clauses in one row sql -

i want take below statement , fuse 1 query. select count(*) count1 month='11' , flag = 1 select count(*) count2 month='11' , flag = 2 select count(*) count1 month='12' , flag = 1 select count(*) count2 month='12' , flag = 2 i want display 1 query columns count1 , count2 , rows month 11 , month 12. is there syntax this? you can combine sum , case various counts in 1 go: select month, sum(case when flag=1 1 else 0 end) count1, sum(case when flag=2 1 else 0 end) count2 ... month in ('11','12') group month /* other columns? */

ruby - Check if two arrays have the same contents (in any order) -

i'm using ruby 1.8.6 rails 1.2.3, , need determine whether 2 arrays have same elements, regardless of whether or not they're in same order. 1 of arrays guaranteed not contain duplicates (the other might, in case answer no). my first thought was require 'set' a.to_set == b.to_set but wondering if there more efficient or idiomatic way of doing it. this doesn't require conversion set: a.sort == b.sort

c# - Get ListViewItem control in CodeBehind -

i have listview , each item has checkbox control part of itemtemplate. <listview x:name="tasklistview" grid.row="2" borderthickness="0" margin="30,0,0,0" itemssource="{binding childitems}"> <listview.itemtemplate> <datatemplate> <grid> <grid.columndefinitions> <columndefinition width="25"/> <columndefinition width="290"/> <columndefinition width="*"/> </grid.columndefinitions> <checkbox grid.column="0" horizontalalignment="center"></checkbox> <textblock text="{binding name}" maxwidth="270" grid.column="1" margin="0,0,10,0"/> <combobox selecteditem="{binding de...

real time - google appspot alternatives -

is there alternatives google appspot engine? tried google appspot turns out expensive , wondering if install daemon on server (vps) need similar google appspot. ideas yes, there projects (nearly) api-compatible gae: appscale (java/python), typhooneae (python)

linux - openssl Signature Verification Failure : "RSA_padding_check_PKCS1_type_1:block type is not 01" -

i trying verify signature of sample downloaded nist below. getting following error: retval=0 err='error:0407006a:lib(4):func(112):reason(106)' - rsa_padding_check_pkcs1_type_1:block type not 01 the signature verification supposed pass per data input have provided. not understand did wrong in code. appreciated. openssl version 0.9.8l here test code (please copy paste notepad view fully): /* vector source: csrc.nist.gov/groups/stm/cavp/documents/dss/rsavs.pdf b.1.3 sigverrsa.req., it's "result = p" per b.3.3 sigverrsa.rsp # cavs 3.2 # "sigver rsa (x9.31)" information "testshas" # mod sizes selected: 1024 1536 # sha algorithm selected:sha1 sha256 sha384 sha512 # generated on wed apr 28 08:35:11 2004 [mod = 1024] n = 9ec4d483330916b69eee4e9b7614eafc4fbf60e74b5127a3ff5bd9d48c7ecf8418d94d1e60388bb68546f8bc92deb1974b9def6748fbb4ec93029ea8b7bea36f61c5c6aeedfd512a0f765846fad5edacb08c3d75cf1d43b48b394c94323c3f3e9ba6612f93fe290013421743...

export - Exporting JIRA issues to a flat file -

i looking find way, whether through api's or plug-ins, export information captured in issue creation form in jira. process flow user create issue filling out entire form (textboxes, date values etc.) , when click create creates flat file (e.g. csv file), placed in specific folder. there way of accomplishing this? alternative methods? thanks in advance. many ways that, 1 simple solution: using jira scripting suite using post function on issue creation transition on project's workflow. simple example: from com.atlassian.jira import componentmanager # issue objects issuemanager = componentmanager.getinstance().getissuemanager() issuefactory = componentmanager.getinstance().getissuefactory() authenticationcontext = componentmanager.getinstance().getjiraauthenticationcontext() customfieldmanager = componentmanager.getinstance().getcustomfieldmanager() cf_example = customfieldmanager.getcustomfieldobjectbyname("custom field") # write file key = issue.getk...

xaml - Silverlight localization -

what avaliable options translating silverlight 5 application (prism + mef)? if possible to: not have resx files (i don't way managed) rather have xaml string extracted , translated (i think there tool microsoft, marked xaml nodes custom attribute , extracted strings) have translations in external assemblies (in prism modules) , load them when needed change language @ runtime i'm open suggestions , best practices on topic. edit: locbaml talking above, looks it's not avaliable silverlight i know number of traditional answers, put forward original tried (and succeeded) doing ourselves more efficient localisation of silverlight: localisation of silverlight projects after completion it uses attached properties provide hooks, in xaml, dynamic changing of localisation strings. when first parsed code gets chance make changes related elements, , language swap means reloading current page. the localisation strings come down server database using simple r...

c# - WeakReference understanding -

i want create dictionary of viewmodels. public static dictionary<string, weakreference> vmcollection = new dictionary<string, weakreference>(); adding this vmcollection.add(name, new weakreference(viewmodel)); and calling required method this.. ((vmcollection[viewmodel].target) baseviewmodel).newmessage(message); do need maintain weakreference ? consequences if don't maintain weakreference . the consequence of not using weakreference reference in dictionary prevent view model instances being garbage collected. weakreference allows garbage collection (assuming there no other solid references elsewhere). an item becomes eligible garbage collection when has no references it. weakreference not create "countable" reference, can keep sort-of-reference it, still let eligible if weakreference thing left looking @ it. whether need or not depends on sort of life-cycle view models have. if need disposing or otherwise "letting go ...

android - To make the xml file from string -

i want create xml file string i.e have 1 string want convert xml file,how ? try following code: string pathname="d:\\xml files\\text.xml"; //specify file path here filewriter out=new filewriter(pathname); out.write(str); // assuming str contains text writen in xml file i.e. formed xml string out.close(); if above not work, write : out.write(str.trim()); instead.

iphone - Navigationbar not showing on pushing view controller -

i have working on navigation base application. problem when push other view controller navigation controller .view controller viewwillappear not called. testcategoryhistory *testvc = [[testcategoryhistory alloc] initwithnibname:@"testcategoryhistory" bundle:nil]; [self.navigationcontroller pushviewcontroller:testvc animated:yes]; [testvc release];` here test's viewwillappear not called.and navigationbar not showing.. make sure current view controller "in" navigation controller. so, can push view controller show.

bash - Read a file line by line assigning the value to a variable -

i have following .txt file: marco paolo antonio i want read line-by-line, , each line want assign .txt line value variable. supposing variable $name , flow is: read first line file assign $name = "marco" do tasks $name read second line file assign $name = "paolo" the following (save rr.sh ) reads file passed argument line line: #!/bin/bash while ifs='' read -r line || [[ -n "$line" ]]; echo "text read file: $line" done < "$1" explanation: ifs='' (or ifs= ) prevents leading/trailing whitespace being trimmed. -r prevents backslash escapes being interpreted. || [[ -n $line ]] prevents last line being ignored if doesn't end \n (since read returns non-zero exit code when encounters eof). run script follows: chmod +x rr.sh ./rr.sh filename.txt ....

javascript - Convert Object Array to an Object -

i have returned object list: data.d[15] and 1 sample of it: data.d[3] = { cityid: 2, cityname: "ankara"} i want convert 1 object as cities{ 1: "istanbul", 2: "ankara", 3: "new york" } and should generic, dont know "cityid" , "cityname" field names. best method it? thank all... have send fieldnames field object -no dependencies important code-, has been resolved. var url = this.options.url + "/" + field.values, id = field.fieldid, title = field.fieldtitle; this.getjson(url, {}, function (rdata) { var obj = {}; (i = 0; < rdata.d.length; i++) obj[rdata.d[i][id]] = rdata.d[i][title]; $("#" + parentid).html(self.gethtmlofformdata(type, obj)); }); maybe need detect property contains name of city. maybe can work? var idprop, nameprop; (var prop i...

c# - How to construct a regex to match a fixed string separated by whitespace? -

i've never been able construct regular expression on own, , have simple application needs one. how construct simple regex matches: a fixed string no whitespace / whitespace the '=' char no whitespace / whitespace the '(' char currently i'm using following code match whole words, can see quite limited in functionality. regex.matches(data, @"\b" + regex.escape(columnid + "=(") + @"\b"); regex.matches(data, @"\b" + regex.escape(columnid + "= (") + @"\b"); regex.matches(data, @"\b" + regex.escape(columnid + " =(") + @"\b"); regex.matches(data, @"\b" + regex.escape(columnid + " = (") + @"\b"); “any” in regex means * quantifier (“kleene star”), means “the previous token, arbitrarily often”. note work can escape only fixed word , not rest. regex.matches(data, @"\b" + regex.escape(columnid) + @" *= *\(\b...

sql server - How do I use Dynamic SQL to Generate Groups of Columns? -

people different types , amounts of fruit , want them. have table looks this: name fruit count temp ----------------------------- jim apple 3 hot jim banana 7 cold jim orange 12 cold sam plum 5 hot sam peach 1 hot bob cherry 4 cold bob banana 11 hot bob orange 9 cold bob kiwi 6 hot each person have 1 or 1000 rows , not know how many ahead of time think requires dynamic column lists. need this: name fruit_1 count_1 temp_1 fruit_2 count_2 temp_2 fruit_3 count_3 temp_3 fruit_4 count_4 temp_4 ------------------------------------------------------------------------------------------------------- jim apple 3 hot banana 7 cold orange 12 cold null null null sam plum 5 hot peach 1 hot null null null null null null bob cherry 4 cold banana 11 hot orange 9 c...

iphone - Add Variable to writeToFile:atomically: -

i writing simple ios app saves tasks table. wanted expand app , allow people share there "lists" other people. before saving xml or url wanted try local file using writetofile:atomically:. worked great. needed file unique person using wanted make file unique title of the list. title field uitextfield. tasks mutable array here code: - (void)savetask:(id)sender; { nsstring * original = [titlefield text]; nsstring * file = [nsstring stringwithformat:@"%@.plist", original]; [tasks writetofile:@"/tmp/%@.plist",file atomically:yes]; } i error wanting me add ":" middle of automatically. how can use variable in writetofile:atomically:? if none of makes sense please let me know can add something. thank you. with you're doing, you'll end file has .plist.plist extension. beside, reason why error is, code should this [tasks writetofile:[nsstring stringwithformat:@"/tmp/%@.plist",file] atomically:yes]...

How to create image in php -

i creating image php code $src = array ("22.jpg","33.jpg","44.jpg","55.jpg","66.jpg","77.jpg"); $imgbuf = array (); foreach ($src $link) { switch(substr ($link,strrpos ($link,".")+1)) { case 'png': $itmp = imagecreatefrompng($link); break; case 'gif': $itmp = imagecreatefromgif($link); break; case 'jpeg': case 'jpg': $itmp = imagecreatefromjpeg($link); break; } array_push ($imgbuf,$itmp); } $iout = imagecreatetru...

concatenation - Concatenate strings, files and program output in Bash -

the use case is, in case, css file concatenation, before gets minimized. concat 2 css files: cat 1.css 2.css > out.css to add text @ one single position, can do cat 1.css <<somestuff 2.css > out.css end in middle. somestuff to add stdout one other program: sed 's/foo/bar/g' 3.css | cat 1.css - 2.css > out.css so far good. regularly come in situations, need mix several strings, files , program output together, copyright headers, files preprocessed sed(1) , on. i'd concatenate them in little steps , temporary files possible, while having freedom of choosing order. in short, i'm looking way in little steps possible in bash: command [string|file|output]+ > concatenated # note plus ;-) --------^ (basically, having cat handle multiple stdins sufficient, guess, like <(echo "foo") <(sed ...) <(echo "bar") cat 1.css -echo1- -sed- 2.css -echo2- but fail see, how can access those.) this works: ...

Dojo Tooltip only shows after first mousover event -

i'm using dojo's event delegation connect tooltip widget dynamically generated dom nodes. the dojo site explains event delegation way: "the idea behind event delegation instead of attaching listener event on each individual node of interest, attach single listener node @ higher level, check target of events catches see whether bubbled actual node of interest; if so, handler's logic performed." following code implementation. works beautifully ... except, tooltip shows after first mouse on event. when first mouseover node, event fires perfectly, tooltip doesn't render. show consequent mouseover events. on first mouseover event, can watch firebug console , see xhr.get go database , correct data. if comment out tooltip , throw in simple alert(), works first time. any suggestions on how tooltip show on first mouseover event? in advance! <div class="col_section" id="my_groups"> <div class="col_s...

user interface - How to set cursor position in the middle of CustomEditField? -

i have created custom edit field rounded border. cursor displaying @ top of customeditfield . how change cursor position center of field. need on issue. following code snippet implementation of customeditfield . public customeditfield() { this(0); setmaxsize(15); setcursorposition(axis_vertical); } public customeditfield(long style) { this(new xyedges(20, 10, 20, 10), field.field_hcenter | field.use_all_width | field.non_spellcheckable | textfield.no_newline | consume_input | style); } public customeditfield(string label, string initialvalue) { this(0); setlabel(label); settext(initialvalue); } public customeditfield(xyedges points, long style) { super(style); setpadding(points); } /** * paints editfield background specified format values */ protected void paintbackground(graphics graphics) { graphics.setcolor(color.white); graphics.fillroundrect(10, getpaddingtop(), getwidth() - 10, getheight()...

vba - Excel Macro / Module assistance - How to write a code to autofit Cell width -

i got module/macro excel form site: [macro send email of excel content][1] macro works, except cells small large amount of data in each cell, how write script within code adjust width of cell accordingly data inside cell. cells vary in terms of amount of data. thanks! sub send_row() ' don't forget copy function rangetohtml in module. ' working in office 2000-2010 dim outapp object dim outmail object dim cell range dim rng range dim ash worksheet set ash = activesheet on error goto cleanup set outapp = createobject("outlook.application") application .enableevents = false .screenupdating = false end each cell in ash.columns("b").cells.specialcells(xlcelltypeconstants) if cell.value "?*@?*.?*" , lcase(cell.offset(0, 1).value) = "yes" ash.range("a1:ae100").autofilter field:=2, criteria1:=cell.value ash.autofilter.range on error resume next set rng = .spec...

operating system - If one thread is busy on I/O will the entire process be blocked -

in multi-threaded process,if 1 thread busy on i/o entire process blocked? afaik, totally depends on programmer how manage threads inside programs. if thread there no i/o, processor never sit idle & start executing thread. however, process in split threads such 1 thread waits result of other, the entire process blocked. please comment if more information needs added. there exist other explaination? if process has 1 thread, yes. if process has multiple threads, no if operating system supports multithreading. this question can addressed in terms of underlying implementation of user threads. there different models multihreading models, in order implement user threads have mapped kernel thread: many-to-one : many user threads 1 kernel thread one-to-one : each user thread assigned kernel thread. many-to-many : many user threads split on different kernel threads. in many-to-one case, single block-operation (system call) within thread can block whole process....

asp.net - dropdown list bind from xml file -

i having issue binding dropdown data within xml file. xml file looks so; <agricultural> <file> <text>acreage_cotton_planted</text> <value>acrecotp index</value> </file> <file> <text>acreage_corn_planted</text> <value>acrecrnp index</value> </file> <file> <text>acreage_soybean_planted</text> <value>acresoyp index</value> </file> <file> <text>acreage_wheat_planted</text> <value>acrewhtp index</value> </file> </agricultural> i using code return list xml public shared function getagdatalist(nodestring string) list(of listitem) dim doc new xmldocument() 'load xml file xmldocument object doc.load("~\datafiles\dataxml.xml") 'this needs changed server path dim root xmlnode = doc.documentelement 'select nodes tag paramter indicated nodestring variable dim nodelist xmlnod...

css - How to create desktop widgets -

hy everyone, trying build desktop widgets o web application school projects using xhtml, css, javascript , ajax. question is: anyone know toolkit or framework or build desktop widgets? thank you! [edit] hy guys, know asked question 10 months ago, figure out how build apps html/css/javascript. simple, answers need create zip archive when finished , add widget win7 widgets. i sorry question asked 10 months ago, think info should shared lot of people might have problem! you can go adobe air create desktop widgets. the adobe® air® 3 runtime enables developers use html, javascript, adobe flash® software, , actionscript® build web applications run standalone client applications without constraints of browser.

java - Create a uniform random number based on a hash -

i need pseudo random number based on key consisting of string , long. should same random number when query using same key , also, should different number if query using different key, when long in key off 1. tried code , random numbers unique similar numbers seem correlated. import java.util.date; import java.util.random; import org.apache.commons.lang3.builder.hashcodebuilder; public class hashkeytest { long time; string str; public hashkeytest(string str, long time) { this.time = time; this.str = str; } @override public int hashcode() { return new hashcodebuilder().append(time).append(str).tohashcode(); } public static void main(string[] args) throws exception { for(int i=0; i<10; i++){ long time = new date().gettime(); hashkeytest hk = new hashkeytest("spy", time); long hashcode = (long)hk.hashcode(); random rgen = new random(hashcode); sy...

java - Seam security and prettyfaces redirect to a wrong url after login -

when log in page seam security, redirects me /web-inf/pages/index.xhtml instead of /. snippet of @viewconfig: public interface pagesconfig { public static final string pages_prefix = "/web-inf/pages/"; static enum pages { @viewpattern(pages_prefix + "index.xhtml") @urlmapping(pattern = "/") @loggedin @loginview(pages_prefix + "login.xhtml") index, @viewpattern(pages_prefix + "login.xhtml") @urlmapping(pattern = "/login") log_in, ... } ... } do know problem might be? i think bug: https://issues.jboss.org/browse/seamfaces-193 and think i've found fix, filed pull request on github: https://github.com/seam/faces/pull/75

html - php pdf generator supporting vector images -

we having application in have vector image , using dompdf convert html pdf. dompdf not support vector image. can 1 suggest me php based pdf generator supports table, background image , vector image. tcpdf have support vector images in pdf. that's pure php library pdf generation. look @ example #32 here on: http://www.tcpdf.org/examples.php http://www.tcpdf.org/examples/example_032.phps

oop - PHP singleton pattern -

hello there want learn singleton pattern in php, have class: class database { private static $instance; private function __construct() { } public static function getinstance() { if (!self::$instance) { self::$instance= new database(); } return self::$instance; } public function query($table) { $this->query = 'select * $table'; } public function result() { echo $this->query; } } $db = database::getinstance(); and , posible call result() method , print value set query() "select * $table" using singleton? i want code in like: $db->query('user_tb')->result(); //output select * user_tb; update: to able call like: $db->query('user_tb')->result(); you need put return $this; in method want chain, in case query method: public function query($table) { $this->query = "select * $...

c# - MSBuild Task for setting custom attribute in AssemblyInfo.cs -

is there msbuild task setting custom attribute in assemblyinfo.cs? found assemblyinfo task seems cannot set custom attributes, predefined ones. i'd set 3 custom properties have added file. any suggestion how solve this? writecodefragment task can help: <target name="beforebuild"> <itemgroup> <assemblyattributes include="assemblytitle"> <_parameter1>my assembly</_parameter1> </assemblyattributes> <assemblyattributes include="assemblydescription"> <_parameter1>my assembly</_parameter1> </assemblyattributes> <assemblyattributes include="assemblycompany"> <_parameter1>my company</_parameter1> </assemblyattributes> <assemblyattributes include="assemblyproduct"> <_parameter1>my product</_parameter1> </assemblyattributes> <assembly...

autoit - Can't retrieve links inside Frame -

i trying use autoit retrieve data website: http://www.acgme.org/adspublic/default.asp unfortunately, page uses frames , i'm having trouble navigating page data is. the link "accredited programs" #include <ie.au3> $url="http://www.acgme.org/adspublic/" $myiexplorer=_iecreate($url,1,1,1,1) local $theframe = _iegetobjbyid($myiexplorer,"control") msgbox(0,"the frame",$theframe.src) local $olinks = _ielinkgetcollection($theframe) msgbox(0, "link count", @extended & " links found") when run code above, able populate $theframe correct frame object houses "accredited programs" link, that's far can get. $olinks collection comes empty. frames rather special. use _ieframegetobjbyname instead. #include <ie.au3> $url="http://www.acgme.org/adspublic/" $myiexplorer=_iecreate($url,1,1,1,1) local $theframe = _ieframegetobjbyname($myiexplorer,"control") loc...

extjs4 - Javascript how to show each element of array on a new line -

i have string build form comma separated values use split each value , after want show each value on new line happens each value on new line except of last 2 shown on same line. make clear: value1 ,value2 ,value3 ,value4,value5 here function i'm using: _checkdates: function(dates) { if (dates != null) { var zzz = dates.split(','); var xxx = zzz.length; console.log(xxx); (var i=0; i<=xxx; i++) { zzz[i] = zzz[i] + '<br />'; return zzz; } } return dates; } just clear written in extjs 4, i'm sure in case problem pure javascript , not related extjs 4 anyways, maybe i'm wrong. so ideas why happen , how make last elemnt on new line well? thanks leron the for-loop suspicious. firstly, not process items (the last 1 missing, @sarfraz pointed out). sencondly...

How to get the user's own location on a Foursquare checkin from the API? -

i'd know if foursquare api allows @ user's own location during checkin, rather location of venue itself. venues difference negligible, if someone's checked into, say, yosemite national park, actual location may vary wildly. i'd know where were when checked in. the api's checkin endpoint has 2 relevant attributes: venue , location . location information within venue (obviously) relevant venue (where venue located). in cases, appears location information included. location attribute included venueless checkins, otherwise includes user's own location. seems me latter should available, if venue specified. am missing something? there (different) way @ user's own location via api regular checkin? you cannot retrieve user's physical lat/lng check-in. it's not exposed anywhere in api.

c# - DispatcherTimer with interval 0,0,1 is not exactly 1 second? -

(using wpf) in small application wrote, using count-down timers. have used dispatchertimer . counter01 = new dispatchertimer(); counter01.tick += new eventhandler(counter01_tick); counter01.interval = new timespan(0, 0, 1); but when test/use program, have noticed when it's set (for example) 60 minutes count-down, gets few minutes off compared real world time. could reason dispatchertimer not 1 second if use did above? timers never absolutely exact. after all, it's got run on dispatcher thread - expect happen if dispatcher busy processing other thread @ same time? it's close enough visibly ticking @ once per second - should take current time , subtract "target" time (or use stopwatch ) fairly-accurate count-down instead of counting number of times timer has ticked.