Posts

Showing posts from January, 2015

How can I filter out profanity in base36 IDs? -

i want use base36 in web application developing... id visible users url, want filter out profanity. has solved this? or real problem? does make sense skip numbers in database sequence? well, rather try amass swear words possible, filter out vowels. that'll leave plenty of permutations in space. admittedly, you've cut down base 36 base 31, base 31 numbers valid base 36 numbers assuming same symbol set (a-z0-9). if bothers you, replace 5 vowels other non-magic 7-bit ascii !,@,$,% , (. granted, may end sh1t , fck, profanity in mind of reader. -oisin

jquery - Simplemodal Scroll Bar and Close Image Issue -

i have simplemodal jquery popup has have overflow set auto because resulting list can long. scroll bars show fine, close image gets shoved behind vertical scroll bars , simplemodal border. if comment out the overflow: 'auto', line close image shows fine on top of border. have tried setting z-index image high , did nothing. makes horizontal scroll bars show because close image behind vertical scroll bars. my jquery code jquery('#custlookupresults').modal({ containercss: { padding: 0, overflow: 'auto', maxheight: 800 }, onshow: function (dlg) { $(dlg.container).css('width', 650); $(dlg.container).css('height', 'auto'); }, overlayclose: true, opacity...

asp.net mvc - Set up staging and production environmets and minimizing downtime on simple hosting -

i have asp.net mvc 3 application, wouldbebetter.com , hosted on windows azure. have introductory special subscription package free several months surprised @ how expensive has turned out (€150 p/m on average!) have started paying it. way money site not going generate money time i've decided move regular hosting provider (discountasp.net). one of things i'll miss though, separated staging , production environments azure provides, along zero-downtime environment swap. my question is, how go "simulating" staging environment while hosting on traditional provider? , best shot @ minimizing downtime on new deployments? thanks. update: chose answer chose not because consider best method, because makes sense me @ point. i use discountasp myself. it's pretty basic hosting sure, little behind times. have found creating subdirectory , publishing beta/test/whatever versions there works pretty well. it's not fancy or pretty, job done. in order need...

java - spring mvc forward to jsp -

i have web.xml configured catch 404s , send them spring controller perform search given original url request. the functionality there far catch , search go, trouble begins arise when try return view. <bean class="org.springframework.web.servlet.view.contentnegotiatingviewresolver" p:order="1"> <property name="mediatypes"> <map> <entry key="json" value="application/json" /> <entry key="jsp" value="text/html" /> </map> </property> <property name="defaultcontenttype" value="application/json" /> <property name="favorpathextension" value="true" /> <property name="viewresolvers"> <list> <bean class="org.springframework.web.servlet.view.beannameviewresolver" /> <bean id="viewresolver...

asp.net - Custom validator only fired on first button click? -

i have custom validator , other validators on page. whenever click submit button first time fires custom validator , when click button second time it's validating rest of validators. please let me know if have solution. thanks check page_load make sure not hiding or enabling after second call. had similar problem before , confused heck out of me until realized manipulating panel in page_load contained validator. other that, need post code (your page_load , click event).

debugging - PHP Dates: Syntax Debug on PHP if conditional -

in following code $start start date manually entered datepicker , $end separate key also, entered via datepicker. these being compared against date('ymd'), today. early in code plugin have code (where same argument returns true): //parse end date if($end): $end = explode('-', $end); $end = mktime($hour, $_post['_date_minute'], 0, $end[0], $end[1], $end[2]); if ((date('ymd',$start) < date('ymd',$end)) && (date('ymd',$end) >= date('ymd'))) { $compare = date('ymd'); //overwrite start date $compare } else { $compare = date('ymd', $start); } endif; later in code, same argument returns false here: function event_list_date($start_or_end, $format, $echo = true){ global $post; // check end date, if it's greater today , start date less or equal today, round off it's today , doesn't event past // origi...

android - Error inflating class <unknown> -

i trying work way in ui. trying set statelistdrawable list entries. trying change color of list item's layout when item pressed, , while list item pressed want change color of text well. i getting following error stack: e/androidruntime( 360): fatal exception: main e/androidruntime( 360): android.view.inflateexception: binary xml file line #8: error inflating class <unknown> e/androidruntime( 360): @ android.view.layoutinflater.createview(layoutinflater.java:513) e/androidruntime( 360): @ com.android.internal.policy.impl.phonelayoutinflater.oncreateview(phonelayoutinflater.java:56) e/androidruntime( 360): @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:563) e/androidruntime( 360): @ android.view.layoutinflater.rinflate(layoutinflater.java:618) e/androidruntime( 360): @ android.view.layoutinflater.inflate(layoutinflater.java:407) e/androidruntime( 360): @ android.view.layoutinflater.inflate(layoutinflater.java:320) e/androi...

.net - HTML Helper/Text Box validation -

i have input on view: <%= html.textboxcurrentdatewithoutpermission("effectivedate", model.effectivedate.hasvalue ? model.effectivedate.value.tostring("dd-mmm-yyyy") : "", new string[] { permissions.hasicadvanced }, new { @class = "economictextbox", propertyname = "effectivedate", onchange = "parseandsetdt(this); ", datatype = "date" })%> here custom html helper: public static mvchtmlstring textboxcurrentdatewithoutpermission( htmlhelper htmlhelper, string name, object value, string[] permissions, object htmlattributes ) { foreach (string per...

asp.net - In IIS7, what happens between Application_BeginRequest and Application_PreRequestHandlerExecute? -

i've got tracing statements timestamps on asp.net iis application gets lot of traffic. i've got trace statements @ end of application_beginrequest , beginning of application_prerequesthandlerexecute in global.asax. there big delay between end of beginrequest , start of prerequesthandlerexecute, i.e. more 5 seconds. what going on in lifecycle of httprequest between these 2 method calls taking long? iis7 on windows server 2008. thanks. if beginrequest has happend , delay before prerequesthandlerexecute, might want log thread id. if different, suffer asp.net thread agility. a reason happen can use of sessions. asp.net uses reader-writer lock on httpcontext.current.session. if write variable, other request same session cannot run concurrently , parked in queue. .net uses polling mechanism check whether session lock released. i recommend checken you've build on release , system.web/compilation/@debug = 'false'

c# - 'List<T>.ForEach()' and mutability -

i want translate points in list<t> . works: for (int = 0; <polygonbase.count; ++i) { polygonbase[i] = polygonbase[i] + mousepos; } but using list<t>.foreach doesn't: polygonbase.foreach(v => v += mousepos); ideas? your current code re-assigning local variable v new value - doesn't refer original value in list. it's equivalent of writing: foreach(int v in polygonbase) { v += mousepos; } to write original value, use convertall : polygonbase.convertall(v => v += mousepos);

Jquery Plugin for animating numbers -

i making ajax call server , updating stats. want plugin animates numbers. e.g. initial value = 65 value after ajax call = 98 in span of 2 seconds, value displayed increases 65 98 , user able see - digital speedometers or tachometers. my search has not led me find plugin this. know of such plugin? it doesnt have duration, it's kinda close. i'm not sure how integrate duration @ moment, , had throw rather quickly. (function($) { $.fn.animatenumber = function(to) { var $ele = $(this), num = parseint($ele.html()), = > num, num_interval = math.abs(num - to) / 90; var loop = function() { num = math.floor(up ? num+num_interval: num-num_interval); if ( (up && num > to) || (!up && num < to) ) { num = to; clearinterval(animation) } $ele.html(num); } var animation = setinterval(loop, 5); ...

wordpress - wp_nav_menu change sub-menu class name? -

is there way change child <ul class="sub-menu"> generated wordpress custom class name? i know parent ul can remove or change name 'menu_class' => 'newname' i couldnt find... tried 'submenu_class' => 'customname' :d seems logic me, no right one.. any ideas? there no option this, can extend 'walker' object wordpress uses create menu html. 1 method needs overridden: class my_walker_nav_menu extends walker_nav_menu { function start_lvl(&$output, $depth) { $indent = str_repeat("\t", $depth); $output .= "\n$indent<ul class=\"my-sub-menu\">\n"; } } then pass instance of walker argument wp_nav_menu so: 'walker' => new my_walker_nav_menu()

configuration - Multiple Django Sites, one server -

i have multiple sites same client, on same server, running django, e.g. fooplumbing.com , bazheating.org . these 2 sites each have different django apps, plumbing site shouldn't able access heating apps, , vice versa. there no objects shared between 2 sites, , each needs own separate admin site. is possible through sites framework, or need have 2 separate apache instances running sites? (yes, need use apache - no choice) it's linux server, there clever way of using symlinks this? i'm pretty experienced basic django development, have no clue when comes server management. the sites framework won't - should served separate wsgi applications. but there's no need separate apache instances. configure apache serve separate virtualhosts, each own wsgi file.

iphone - Animating a pulsing UILabel? -

Image
i trying animate color the text on uilabel pulse from: [black] [white] [black] , repeat. - (void)timerflash:(nstimer *)timer { [[self navtitle] settextcolor:[[uicolor whitecolor] colorwithalphacomponent:0.0]]; [uiview animatewithduration:1 delay:0 options:uiviewanimationoptionallowuserinteraction animations:^{[[self navtitle] settextcolor:[[uicolor whitecolor] colorwithalphacomponent:1.0]];} completion:nil]; } . [self setfadetimer:[nstimer scheduledtimerwithtimeinterval:1 target:self selector:@selector(timerflash:) userinfo:nil repeats:yes]]; firstly not sure of method, plan (as can see above) set animation block , call using repeating nstimer until canceled. my second problem (as can see above) animating black (alpha 0) white (alpha 1) don't know how animate black again animation loops seamlessly essentially want text color pulse on uilabel until user presses button continue. edit_001:...

documentation - UML page connector -

Image
does know if there symbol page connector in uml's activity diagrams? common flowcharts have symbol represent process continues on page such as: this symbol has text in it. thanks. you can use uml interaction overview diagrams purpose. let use interactions defined elsewhere elements.

visual studio - how to get line number in code editor in vs2008? -

possible duplicate: how enable line numbers in vs2008? how line number in code editor in vs2008? tools...options...text editor....all languages... display... line numbers.

internet explorer - Can I set bookmarks in WP7? -

is possible set bookmarks in windows phone 7? there no programmatic api interact wp7's ie7 bookmarks. best thing can open website using webbrowsertask , user can add bookmark if choose so. normally on ie it's possible invoke javascript "window.external.addfavorite()" method ask browser add favourite, doesn't appear work in ie7 mobile.

Flash problem in Delphi application -

i create delphi application flash , perfect before today day. when start project send me error. if try add shockwave component project gives me error class not registered ? what mean? educated guess: upgraded flash, air, or installed else upgrades flash or air. in addition that, referenced guid old version of com object flash. the result app doesn't see version of flash installed. i had similar thing @ client while ago when called help: had hard reference msxml 6, test equipment had msxml 3 installed. boom! the first step use generic msxml com guid, messed because msxml 3 had base of search results off 1 (either 1-based or 0-based, or other way around, forgot). final solution make sure running minimum version of msxml (like described in test requirements). you should sort out version of flash need minimum, , guid must reference instantiate com objects. --jeroen

javascript - Modal HTML window popup that is run within 3rd party site -

i have need display our application widget within third-party website (think things getsatisfaction, uservoice , other feedback widgets people use). what safest , reliable way this? can think of criteria , issues already: the code needs framework , language independent. though app asp.net, 'launcher' run in html page belongs our customers. suppose limits me html , javascript only. the function needs easy call. implies <script scr='mywebsite.com/widget.aspx' ...> sole thing give customer. there no use of css. or rather, can style things, without css file, pull in styles conflict customer running. there must no use of libraries such jquery. mention because can imagine problems if pull in jquery version differs our customer's, ruining site our code. ideally, there established piece of code can use started? i wrote this. on github here - https://github.com/akshayrawat/js_iframe_modal

Debugging help - PHP include causes page refresh -

i'm having odd problem can't seem track down. regards debugging greatly appreciated! let me describe using scenarios. scenario 1 ( incorrect ) php calls out cas server (using curl_exec ) , gets user info back php checks database ensure user returned cas exists , fails (which correct, i'm testing non-existent user) , sets error message "user not found" (this correct error message) php includes top.php file the page randomly refreshes or redirects , starts process over...this can't figure out. php calls out cas server (using curl_exec ) , receives error since cas ticket has been used, setting new error message of "cas rejected credentials" (which not correct) php includes top.php file , doesn't refresh/redirect second time php prints out "cas rejected credentials" (which not correct) scenario 2 ( semi-correct ) php calls out cas server (using curl_exec ) , gets user info back php checks database ensure user ret...

c# - How to create objects dynamically with arbitrary names? -

so here's situation. designing program requires new image objects created in real-time on canvas, when user clicks button. seeing don't know how many of said images given user create, can't assign names in code each , every 1 of them. images need named "image0", "image1", "image2", etc, depending on how many images exist on page. kinda how visual studio works, each time drop control onto design view, automatically appends number name of control. does have code snippet capable of performing function? you don't have explicitly name controls. add them canvas "controls" list. create windows app single button , flowlayoutpanel. using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.windows.forms; namespace windowsformsapplication6 { public partial class form1 : form { int = 1; ...

Visual ++ print from main with inheritance on visual form in listbox -

i´ve made "main" class lets call a(veichle), , have 2 classes inherits lets call them b(car) , c(mc). have handler lets call "d" binds a,b , c. have form1 class lets call e(visual) i want print out private members on visual form "e" in listbox if try ex) this->listbox1->items->add(x.veichles[i]->getbrand()); it complains veichles private member in d. how can around that? the private means access not allowed other classes. you should create public accessor function. example, getvehiclebyindex(int idx) . your code this: a* pvehicle = x.getvehiclebyindex(i); if (pvehicle) // assuming null indicates error add(pvehicle->getbrand()); else // react on error

My regex for matching decimal numbers matches "1." How can I fix it? -

i got regular expression decimals: /^(\d{1,3})(\.{0,1}\d{0,2})$/ but allows "1." how fix this? the following regex matches 1-3 digits, optionally followed decimal point , 1-2 digits. /^(\d{1,3})(\.\d{1,2})?$/ note changed . \. . metacharacter matches anything, , has escaped.

Create a CSV download using silverlight 4 and c# -

i'm struggling find example or code able create csv or text file in silverlight downloadable link. i've done in asp.net can't figure out way using silverlight. spinning wheels? or should create asp page? there way of doing in c#? i'd right way , not hack job , appreciate feedback , advice. in asp of used: response.contenttype = "text/csv" response.addheader "content-disposition", "attachment;filename=""epic0b00.csv""" response.write.... i able solve similar code above, including required references there no assumptions made, plus actual working example. using system; using system.io; using system.windows; using system.windows.controls; .... private void btnsave_click(object sender, routedeventargs e) { string data = exportdata(); // data built savefiledialog sfd = new savefiledialog() { defaultext = "csv", filter = "csv files (*....

php - reCaptcha breaking my code -

i've been getting spam few weeks. able recaptcha on few of pages forms, there few don't work. of site done cms , other parts done scratch. so... there page called sign-up.php. page form gets hit most. form structure little odd. thing added php tag , recaptcha script inside of tag. i've found file form posts to, when add google recaptcha tells me add, crashes. i've tried adding few easy lines include_once(recaptchalib.php) , still crashes. <div class="big_box"> <form name="signup" method="post" action=""> <div class="container_shadowl"></div> <div class="container"> <div class="h1_title">sign up</div> <p class="cntp cntmleft"> .... <div class="cntcontact"> <div class="cntbox1a" style="width:285px;padding-top:35px; padding-left:120px !important"> <input type="hidd...

winforms - How do you create a Listbox on the fly (at runtime) in VB.net? -

i'm attempting create listbox when button clicked in visual basic 2008. can't seem find code works this. found few examples similar , said work: dim lstoutput listbox lstoutput = me.controls.add("vb.label", "list1") problem both of things inside parenthesis generate errors: for first one: value of type 'string' cannot converted 'system.windows.forms.control'. and second one: too many arguments 'public overridable sub add(value system.windows.forms.control)'. any ideas? this add empty listbox last control in page: dim lstoutput new listbox { .id = "list1" } page.controls.add(lstoutput)

iphone application design and animation also want to know if 3d possible in xcode -

i want know possible create 3d animation , want know other uiimage animation being use create iphone apps there other software or ways can use design/create iphone apps or ways create animation other usual way. i search web cannot manage find other ways other uiimage animation 1 have link of tutorial can use.. i want create apps high quality of animation , try compress apps size.. thanks... really help.. noob programmer abit lost everything.. appreciate can get.. follow jeff's series on opengl es here - http://iphonedevelopment.blogspot.com/2010/10/opengl-es-20-for-ios-chapter-1.html unity 3d option cost much

javascript - loading a new page without navigating from existing page? -

im having jsp page on clicking button open new page ones closed , need previous page . i tried open new page using window.open (javascript)& closed using window.close, im not getting previous page. any solution this? thanks in advance

c - Handling asynchronous sockets in WinSock? -

i'm using message window , wsaasyncselect. how can keep track of multiple sockets (the clients) 1 message window? windows supports several modes of socket operation, , need clear 1 using: blocking sockets. send , recv block. non-blocking sockets: send , recv return e_wouldblock, , select() used determine sockets ready asynchronous sockets: wsaasyncselect - sockets post event notifications hwnd. eventsockets: wsaeventselect - sockets signal events. overlapped sockets: wsasend , wsarecv used sockets passing in overlapped structures. overlapped sockets can combined iocompletionports , provide best scalability. in terms of convenience, asynchronous sockets simple, , supported mfc casyncsocket class. event sockets tricky use maximum number of objects passable waitformultipleobjects 32. overlapped sockets, io completionports, scalable way handle sockets , allows windows based servers scale tens of thousands of sockets. in experience, when using async socket...

php - inserting checkbox values to database -

i have php form textbox , checkboxes connected database want enter details database form.all textbox values getting entered except checkbox values.i have single column in table entering checkbox values , column name urlid.i want enter selected checkbox(urlid)values single column ,separated commas.i have attached codings used.can find error , correct me? note: (the urlid values in form brought previous php page.those codings included.need not care it) urlid[]: <br><?php $query = "select urlid webmeasurements"; $result = mysql_query($query); while($row = mysql_fetch_row($result)) { $urlid = $row[0]; echo "<input type=\"checkbox\" name=\"checkbox_urlid[]\" value=\"$row[0]\" />$row[0]<br />"; $checkbox_values = implode(',', $_post['checkbox_urlid[]']); } ?> $urlid=''; if(isset($_post['urlid'])) { foreach ($_post['urlid'] $statename) { ...

python - IOError: [Errno 13] Permission denied when trying to read an file in google app engine -

i want read xml file , parse it, had used sax parser requires file input parse. had stored xml file in entity called xmldocs following property xmldocs entity name name : property of string type content : property of blob type (will contain xml file) reason had store file had not yet provide billing detail google now when try open file in getting error of permission denied.. please me, have do... you can see error running app at www.parsepython.appspot.com it thinks data string providing filename. you may able pass file-like object wraps data, example instead of this: parser.parse(str(q.content)) try this: parser.parse(stringio.stringio(str(q.content)))

html - form_for called in a loop overloads IDs and associates fields and labels incorrectly -

rails likes giving of fields same ids when generated in loop, , causes trouble. <% current_user.subscriptions.each |s| %> <div class="subscription_listing"> <%= link_to_function s.product.name, "toggle_delay(this)"%> in <%= s.calc_time_to_next_arrival %> days. <div class="modify_subscription"> <%= form_for s, :url => change_subscription_path(s) |f| %> <%= label_tag(:q, "days delay:") %> <%= text_field_tag(:query) %> <%= check_box_tag(:always) %> <%= label_tag(:always, "apply delay future orders") %> <%= submit_tag("change") %> <% end %> <%= link_to 'destroy', s, :confirm => 'are sure?', :method => :delete %> </div> </div> <% end %> produces <div class="subscription_listing"> ...

c# - Help required with BizTalk mapping -

i trying data input xml message using functoids. doesn't seem work. below xml snippet <?xml version="1.0" ?> <root> <companies> <company> <name>foo corp</name> </company> <company> <name>acme corp</name> </company> </companies> <informations> <information> <testing> <tests> <name>1221</name> <test> <text>i sam</text> </test> </tests> <tests> <name>21</name> <test> <text>fadfdf</text> </test> </tests> <tests> <name>3001<...

popup message in android -

i m developing application.. i want create popup message stable while don't close... i want tutorial me alertdialog boxes. thanks in advance. i think searching "dialog" box thereby can show alert message, confirmation message, etc. user. for more info, refer this: http://developer.android.com/reference/android/app/dialog.html , here example on alert dialog box: http://www.androidpeople.com/android-alertdialog-example/ . from commented code: alertdialog.builder alt_bld = new alertdialog.builder(this).create(); alt_bld.setmessage("apprika target achieve..."); alt_bld.setcancelable(false); alt_bld.setpositivebutton("yes", new onclicklistener() { public void onclick(dialoginterface dialog, int which) { // todo auto-generated method stub } }); alt_bld.setnegativebutton("no", new onclicklistener() { public void onclick(dialoginterface dialog, int which) { // todo auto-generated method stub dialog.cancel(); } }); a...

bash - Function local read-only vs. global read-only variable with the same name -

i suprising behaviour when have function local read-only variable , global read-only variable same name. when read-only option removed global declaration. i.e. declare -r var="main" is changed to: declare var="main" i expected behaviour. i've been reading bash man page can't find explanation behaviour. please point me section(s) of manual explaining issue ? i think similar kind of issue how lexical scoping supported in different shell languages? more specific. details: $ cat readonly_variable.sh #!/bin/bash # expected output: # # bash_version = 3.2.25(1)-release # function # main # # instead getting: # # bash_version = 3.2.25(1)-release # ./readonly_variable.sh: line 6: local: var: readonly variable # main # main # # when read-only option (-r) removed global declaration (*), output # expected set -o nounset function func { local -r var="function" echo "$var" } declare -r var="main" # (*) echo bash_...

sql server - What does 'COLLATE SQL_Latin1_General_CP1_CI_AS' do? -

i have sql query create database in sqlserver given below: create database yourdb on ( name = 'yourdb_dat', filename = 'c:\program files\microsoft sql server\mssql.1\mssql\data\yourdbdat.mdf', size = 25mb, maxsize = 1500mb, filegrowth = 10mb ) log on ( name = 'yourdb_log', filename = 'c:\program files\microsoft sql server\mssql.1\mssql\data\yourdblog.ldf', size = 7mb, maxsize = 375mb, filegrowth = 10mb ) collate sql_latin1_general_cp1_ci_as; go it runs fine. while rest of sql clear quite confused functionality of collate sql_latin1_general_cp1_ci_as . can explain me? also, know if creating database in way best practice? it sets how database server sorts. in case: sql_latin1_general_cp1_ci_as breaks interesting parts: latin1 makes server treat strings using charset latin 1, ascii cp1 stands code page 1252 ci case insensitive comparisons 'abc' equal 'abc' as accent sensitive, 'ü' no...

Changing columns collation using batch sql in sql server 2005 -

i took on databases. appears @ point default database collation changed. result columns have old default collation, new columns, added after collation changed have new collation. there's great deal of stored procedure code uses unions. when code executes happens get cannot resolve collation conflict column 5 in select statement. error (for instance first select returns column in collation a, whereas second select returns column in collation b). there way write sql instance select columns collation sql_latin1_general_cp1_ci_as (old collation) new collation latin1_general_ci_as ? thanks something should trick look columns incorrect collation compose alter table statement & alter column statement per incorrect column declare @sql nvarchar(4000) , @tablename sysname , @name sysname , @datatype sysname , @length int , @precision int , @scale int , @is_nullable bit declare cur_collations cursor local read_only sel...

Can I get the type of copy protection on a CD/DVD in C#? -

i know there several tools out there can detect type of cd/dvd protection. there library or code sample me information in c#? cd , dvd copyright protection methods very different. far know, dvd has standardized copyright protection mechanism; dvd_copyright_descriptor structure , related api might helpful. (you may end needing send commands directly dvd drive, since windows doesn't support every feature drive supports. take @ my c# scsi library if need that, , let me know if need features aren't implemented yet. :) )

.net - replace default form instance -

i using vb @ moment , vb has annoying feature called "default form instance", creates default instance of form object when reference form class instead of form instance. ex: public class frmmain inherits system.windows.forms.form end class private sub sub1 frmmain.show() end sub the code above compiles , runs without error because runtime gives new instance of frmmain when call class name. the question is: is there way replace default instance instance have created? way put it: there way set instance created default instance? for ask "why on earth need ?": i have application, let's call myapplication.exe , windows forms application , frmmain main form. many references in application main form through default instance, working fine until now. making changes application. instead of running myapplication.exe directly, have load assembly dynamically , run through reflection. here how it: dim assembly reflection.assembly = lo...

c - What does this code do? -

#include<stdio.h> int main() { int i=4, j=8; printf("%d, %d, %d\n", i|j&j|i, i|j&j|i, i^j); return 0; } the output : 12,12,12 why above output displayed ? can explain me ? i | j&j | i bitwise or between i , i , j&j ( & has priority on | ). equivalent i | j , so: i = 0b00000100 = 4 j = 0b00001000 = 8 i|j = 0b00001100 = 12 i ^ j here same i | j since there no single bit set 1 both in j , i.

TinyMCE custom formatting for pre -

i have looked everywhere , can't figure out how add option tinymce's drop-down formatting. duplicate , modify formatting pre tag give class of .prettyprint can add code snippets posts. it should technically possible, how , file should amend. alternatively can add button applies formatting you may add following ( style_fomats setting) tinymce init function in order add new option styles dropdown. aware class applied should made available using the content_css configuration setting style_formats: [{ title: 'block styles' }, { title: 'name_to_be_displayed', block: 'p', classes: 'class_to_be_applied', exact: true }, { title: 'inline styles' }, { title: 'red text', inline: 'span', classes: 'red', exact: true }, { title: 'pre formatting', inline: 'pre', classes: ...

In Emacs, can we make one keystroke to do different command? -

i want make 1 keystroke, c-f12 , delete-other-windows or winner-undo . think it's easy if learning emacs lisp programming, , set boolean flag. is, if run delete-other-window , it'll run winner-undo . how do in emacs lisp? thanks try (setq c-f12-winner-undo t) (define-key (current-global-map) [c-f12] (lambda() (interactive) (if c-f12-winner-undo (winner-undo) (delete-other-windows)) (setq c-f12-winner-undo (not c-f12-winner-undo))))

d2 - What do these operators do in D 2.0: <>= !<>= !<= !>= -

what these operators in d 2.0: <>= !<>= !<= !>= they used values unordered, such nan floats , doubles. 1 <>= nan evaluates false, whereas x <>= y evaluates true pair of numbers, long neither number nan. other operators mention work same, mutatis mutandis .

c# 4.0 - How do I integrate a dll from an existing program into my c# windows application? -

i want use functionality of cygwin in c# windows application , want save output according user needs (my output files should location independent). how do this? i'm browsing input file cygwin folder , want execute cygwin command i.e. gcc main_jaxa.c sar-function.c nrutil.c complex16.c. possible execute command through windows application written in c#.net? then want call a.exe file convert input files in output files. have @ system.diagnostics.process.start(string,string) , allows launch arbitrary process set of command line parameters.

Drupal - bring node form from Create Content > [Node Type] to a custom menu -

at time, i'm able add software node type using node type form in create content > software menu. want place form custom menu. menu: 'software/add' => array( 'title' => 'add software', 'page callback' => '???', 'access callback' => true, ), i'm managed make admin form in custom menu using page callback , system_settings_form. guess must work around page callback, don't know how node type form. ok, need kind of menu items, code follows: $items['software/add'] = array( 'title' => 'add software', 'page callback' => 'node_add', 'page arguments' => array('software'), 'access callback' => 'node_access', 'access arguments' => array('create', 'software'), 'file' => 'node.pages.inc', 'file path' => drupal_ge...

embed google chart image in pdf with php -

how embed image generated google charts pdf through php ?? this depend on pdf libs used. take url param, others direct path. url type use url directly chart. local path check out this: https://github.com/infinitas/infinitas/blob/beta/core/google/views/helpers/google_app_helper.php#l26 and feed new path image.

java - What is the best way to use context-param in JavaScript -

in web.xml set context param "pathtoimages". in jsp files path images files use el, this: <img src="${initparam.pathtoimages}"/image.jpg" /> but have problem javascript. in js files have code: setinnerhtml("someplace", "<.img src='images/s.gif'>"); i know isn't beautiful code isn't mine :) cannot pathtoimages in same way jsp. best way this? pass parameter js function: function createimage(path) {..} , invoke createimage('${initparam.pathtoimages}') another, perhaps better option have js variable , initialize desired value. in js file: var imagepath; function init(config) { imagepath = config.imagepath; } and in header: init({imagepath: '${initparam.pathtoimages}'});

extjs - How to add a custom renderer when extending a Ext.grid.TemplateColumn class? -

i'd extend ext.grid.templatecolumn ( http://dev.sencha.com/deploy/dev/docs/?class=ext.grid.templatecolumn ) class use predefined xtemplate, i'd still able run renderer when 1 passed in. on understanding, templatecolumn doesn't accept custom renderer, hence i've modified class extend ext.grid.column instead. however, realized renderer passed in function itself. i'm pretty sure can't combine 2 functions one, i'm stuck trying apply xtemplate column, , yet apply passed-in renderer. i've tried createinterceptor doesn't work well. this.renderer.createinterceptor(function(value, p, r){ return tpl.apply(r.data); }); will post additional codes if necessary. the templatecolumn defines own renderer in constructor, override passed in renderer config option. here constructor templatecolumn: constructor: function(cfg){ ext.grid.templatecolumn.superclass.constructor.call(this, cfg); var tpl = (!ext.isprimitive(this.tpl) &...

Client Accepting strange problem. C++ Linux -

i'm making multi-threaded server , ran strange problem. when first client connects server (after run application), accept command returns ip address @ "0.0.0.0", next 1 , others after him addresses valid. im missing or doing wrong? im using gcc , code::blocks pic if dont understand me (http://i53.tinypic.com/16az1vp.jpg) libs are: #include <sys/timeb.h> #include <sys/select.h> #include <sys/socket.h> #include <sys/types.h> #include <sys/wait.h> #include <netinet/in.h> #include <fcntl.h> #include <arpa/inet.h> acceptation function , class header void tcpthread::executelistner() { int clifd, cid; socklen_t laddr_len; char ip[inet_addrstrlen]; printf("[tcpthread] listner thread executed!\n"); while (1) { clifd = accept(listenfd, (struct sockaddr *) &cli, &laddr_len); // akceptujemy polaczenie nonblockingmode(clifd); // ustawiamy tryb nieblokujacy ...

c - How does this code from "Network programming" examples work? -

i reading beej's " guide network programming ". in 1 of intro examples talks getting ip address hostname (like google.com or yahoo.com instance). here code. /* ** showip.c -- show ip addresses host given on command line */ #include <stdio.h> #include <string.h> #include <sys/types.h> #include <sys/socket.h> #include <netdb.h> #include <arpa/inet.h> int main(int argc, char *argv[]) { struct addrinfo hints, *res, *p; int status; char ipstr[inet6_addrstrlen]; if (argc != 2) { fprintf(stderr,"usage: showip hostname\n"); return 1; } memset(&hints, 0, sizeof hints); hints.ai_family = af_unspec; // af_inet or af_inet6 force version hints.ai_socktype = sock_stream; if ((status = getaddrinfo(argv[1], null, &hints, &res)) != 0) { fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(status)); return 2; } printf("ip addresses ...

How do I change the column width in a table using JavaScript? -

i'm trying switch width of 2 columns in table when user clicks on image. i'm using javascript on click , if put new column width % works doesn't seem work using px or em wht want use have better control on columns. code i'm using: <img alt="change widths" title="switch column widths" src="/*images_path*/*image*.png" onclick="for (j=1;j<=200;j++){document.getelementbyid('cola'+j).style.width = '60%'; document.getelementbyid('colb'+j).style.width = '28%';}" onmouseover="this.style.cursor='pointer';"/> i'm using firefox makes difference. can me? try using document.getelementbyid().width instead of .style.width

datetime - Convert from java.util.date to JodaTime -

i want convert java.util.date jodatime carry out subtractions between dates. there concise way convert date jodatime ? java.util.date date = ... datetime datetime = new datetime(date); make sure date isn't null , though, otherwise acts new datetime() - really don't that.

How can I determine which libraries are used in a Delphi program I don't have the source for? -

Image
i have windows .exe file, source code missing. developer not responsible , left our company. think delphi/pascal program. developer used many libraries not sure ones. there tool can tell me libraries used make exe? one application lists used units in delphi binary (similar rruz's demonstration ), xn resource editor . latest version here afaik. below sample screen shot instance (by luck :)), points particular 3rd party library: as 'worm regards' suggested in comments question, application displays 'dfm' contents, hence 1 can see class names of used components. that, i'd suggest dfm editor , because application displays used components in tree structure, 'structure pane' in delphi ide: xn or other resource editor can used export dfm resource file, examined dfm editor.

entity framework - I can't see stored procedures in DbContext with POCO classes -

why can't see stored procedure added in dbcontext? dbcontext generated template introduced ctp5 release (with poco classes). i added stored procedures said tutorial: http://thedatafarm.com/blog/data-access/checking-out-one-of-the-new-stored-procedure-features-in-ef4/ moreover searched if entry added in context , these results: <function name="getclientsforemailsend" aggregate="false" builtin="false" niladicfunction="false" iscomposable="false" parametertypesemantics="allowimplicitconversion" schema="dbo" /> <functionimport name="getclientsforemailsend" entityset="client" returntype="collection(dbmailmarketingmodel.client)" /> <functionimportmapping functionimportname="getclientsforemailsend" functionname="dbmailmarketingmodel.store.getclientsforemailsend"> a similar question is: why won't ef4 generate method support function i...

winapi - Detecting USB notification in Qt on windows -

in qt application want save application output data file in usb pen drive. need put following features in qt application detect usb drive insertion i have 1 usb slot. after insert want know drive number , letter , transfer file @ specific location in pc usb drive. can tell me winapi .lib , .h , .dll file hav use above functionalities ? if can provide code snippets, helpful me. handle wm_devicechange - see http://lists.trolltech.com/qt-interest/2001-08/thread00698-0.html how handle windows messages in qt. if wparam dbt_devicearrival cast lparam dev_broadcast_hdr * if structures dbch_devicetype dbt_devtyp_volume cast lparam again, time dev_broadcast_volume * now check dbcv_unitmask bit field, iterate on bits 0..31 , check if corresponding drive match usb drive. if (wparam == dbt_devicearrival) { if (((dev_broadcast_hdr *) lparam)->dbch_devicetype == dbt_devtyp_volume) { dword mask = ((dev_broadcast_volume *) lparam)->dbcv_unitmask; (in...

animation - Change ListViewItems Layout with a Right Swipe. Android -

i've got listview , it's touch actions , swipe actions working. i'm not sure how can implement swipe effect, it's in twitter app. i've found in internet it's possible animate 2 views viewflipper, possible animate 2 layouts in same way? anyone out there, knows how can implement such function? the thing want switch listviewsitem layout swipe. simple, set both item views in 2 separate thread , start both of them.

scripting - running shell script within shell script in a nested for loop -

hi i've got simple script executes script in nested loop my problem while double loop executing fine without addition of script needs run @ each iteration, if add script execution happens once. any ideas why? for ((i = 0; i<10; i++)) echo "outer forloop $i" ((j = 0; j<6; j++)) exec ./run.sh done done thanks andreas exec replaces current process new process. use ./run.sh

Windows 7 Command Prompt: Typing android.bat returns java.exe options -

when type android or android.bat in windows command prompt administrator, return java.exe options not android.bat options. for example: c:>android.bat [info] starting android sdk , avd manager usage: java [-options] class [args...] (to execute class) or java [-options] -jar jarfile [args...] (to execute jar file) where options include: -client select "client" vm -server select "server" vm when cd anywhere in path: c:\program files (x86)\android\android-sdk-windows\tools - android options. my system path set to: %systemroot%\system32;%systemroot%;%systemroot%\system32\wbem;%systemroot%\system32\windowspowershell\v1.0\;%java_home%\bin;%ant_home%\bin;%android_sdk_path%\tools;c:\program files\thinkpad\bluetooth software\;c:\program files\thinkpad\bluetooth software\syswow64;c:\swtools\readyapps;c:\program files (x86)\lenovo\access connections\;c:\program files\intel\wifi\bin\;c:\program files\common files\in...