Posts

Showing posts from September, 2012

Effect of internet speed on PHP/MySQL execution -

in wordpress client creating large galleries (300+/- images) , using wordpress uploader reorder images. can filename, or numbers can applied , sorted ascending/descending etc he has terrible internet connection speed , when makes edits file order won't execute correctly - images reordered, not how has specified. if him on internet connection works more or less fine - 95% of images reordered, not bad considering quantity (i've told him use smaller galleries!). i'm novice on scripting , database interaction, seems me due poor connection not enough data sent before server closes request , executes. if assumption correct how go extending period of time server allows execute request using php or mysql configuration? yes. can change max_execution_time on php.ini. default 30 seconds , request taking longer 30 seconds interrrupted. it happens when try upload file php , uploader's upload speed pretty low exceeds execution duration. php stop , image corrupt.

telephony - Query Hunt Groups with TAPI and Avaya IP Office -

i using tapi 2.x develop solution avaya ip office 500 v2 pbx 3th party application control it. right know can make calls, hangup, intrude, open lines , on. need query witch lines acting queue because have default queue (200, main in ipo called hunt group) in tapi shown line single device connected it. can give hint or show me kind of option it? thank you. not sure if avaya tsp that, standard way set lineaddrcapflags_queue bit in dwaddrcapflags field of lineaddresscaps structure: http://msdn.microsoft.com/en-us/library/windows/desktop/ms734843%28v=vs.85%29.aspx if you're using our addtapi dll can check tapiaddress.isqueue , tapiaddress.isroutepoint properties.

ios - Text file updated only device is connected with xcode only -

i created text file in ios , stored in data files in following location. sandbox => documents => mylogfile.txt. this file updates when connected device mac , xcode only.if eject device, , connect again see updated text file. not updated. same old file. log file not updated when disconnected pc. how update text file on time. my code: -(void)logme:(nsstring *)mymessage { nsstring *content = mymessage; //get file path nsstring *documentsdirectory = [nssearchpathfordirectoriesindomains (nsdocumentdirectory, nsuserdomainmask, yes) objectatindex:0]; nsstring *filename = [documentsdirectory stringbyappendingpathcomponent:@"locationlog.txt"]; //create file if doesn't exist if(![[nsfilemanager defaultmanager] fileexistsatpath:filename]) [[nsfilemanager defaultmanager] createfileatpath:filename contents:nil attributes:nil]; //append text file (you'll want add newline every write) nsfilehandle *file = [nsfilehandle fileh

python - How to remove duplicate values from a beautiful soup result set whilst preserving order? -

i have scenario searching through values in beautiful soup result set , treating them differently depending on contents, eg: for in bs_result_set: if 'this unique string' in i.text: print 'aaaa' else: print 'bbbb' however have realised unique condition occurs twice in result set not need second replicate value , therefore want remove result set in first place. i have tried approaches removing duplicate values in list (whilst preserving order) these not seem work on object beautiful soup result set. eg used logic this post try: from collections import ordereddict ordereddict.fromkeys(bs_result_set).keys() but didn't seem remove duplicate values. so question how remove duplicate values beautiful soup result set whilst preserving order? what about: h = {} in bs_result_set: if not in h: if 'this unique string' in i.text: print 'aaaa' else: print &

issue in parsing html in java -

i want parse html , next tag value after matched pattern. doing searching pattern , find it. want next value printed . my current code is: public class match { /** * @param args */ public static void main(string[] args) throws ioexception { system.out.println("nothing display"); string pattern = "planned start<br>date"; pattern regpat = pattern.compile(pattern); matcher matcher = regpat.matcher(""); bufferedreader reader = new bufferedreader(new filereader("c:/users/606787145/desktop/test.htm")); string line; int count=0; while ((line = reader.readline()) != null) { matcher.reset(line); if (matcher.find()) { system.out.println(line); } } }

regex - Powershell extract text from string with unknown length -

i don't think can use standard cmdlet this. have following string backup job indeterminable string here completed successfully i need extract indeterminable string here length , number of words. text left backup job , text right either completed or failed errors. how go this? here go, makes use of $matches automatic variable . $regex = "backup job (.*)(completed successfully|failed errors)" $good = "backup job indeterminable string here completed successfully" $bad = "backup job indeterminable string here failed errors" if ($good -match $regex) { $matches[1] } if ($bad -match $regex) { $matches[1] }

java - convert radio button functionality into checkbox -

i have 2 radio buttons <span class="text_content">td:</span> <input type="radio" name="lasttetanustype" value="td" <c:if test="${emergencycontactinfo.lasttetanustype == 'td' || emergencycontactinfo.lasttetanustype == null}">checked</c:if> > <span class="text_content">tdap:</span> <input type="radio" name="lasttetanustype" value="tdap" <c:if test="${emergencycontactinfo.lasttetanustype == 'tdap'}">checked</c:if> > now want convert these radio buttons checkboxes functionality both can null 1 null 1 checked or both checked. if checked single checkbox value emergencycontactinfo.lasttetanustype=td ,if select second 1 value of emergencycontactinfo.lasttetanustype=tdap and if select both value of emergencycontactinfo.lasttetanustype=td/tdap . what trying buddy ? understood want change radio buttons

c# - SelectSingleNode to Evaluate LowerCase NodeSet value -

i trying value of xpath expression in lower case using selectsinglenode, there xpath can give me lower case value of evaluated xpath expression? it possible having xsl transform sheet, possible below? the function expects have nodeset type, below evaluates string throws exception. possible convert returning string nodeset make selectsinglenode happy string xml = "<bac><test>val</test></bac>"; string xpath = "/bac/test/text()"; var transpath = "translate(/bac/test/text(),'abcdefghijklmnopqrstuvwxyz', 'abcdefghijklmnopqrstuvwxyz')"; stringreader sreader = new stringreader(xml); xmlreader xreader = new xmltextreader(sreader); xpathdocument xmlpathdoc = new xpathdocument(xreader); xpathnavigator nav = xmlpathdoc.createnavigator(); xpathnodeiterator nodeiterator = nav.select("/"); xpathnavigator navnode = nodeitera

javascript - autocomplete with categories and custom display -

i using jquery ui autocomplete 1.10.2 problem cannot both categories feature , custom item display work together. this code not working $.widget("custom.catautocomplete",$.ui.autocomplete,{ _rendermenu: function( ul, items ) { var = this, currentcategory = ""; $.each( items, function( index, item ) { if ( item.category != currentcategory ) { ul.append( "<li class='ui-autocomplete-category'>" + item.category + "</li>" ); currentcategory = item.category; } that._renderitem( ul, item ); });

java - Servlet mapping is not working -

i have created simple program using jsp , servlets. after all, have set , mapped servlet in web.xml below. getting blank page always. <servlet> <servlet-name>example</servlet-name> <servlet-class>exampleservlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>example</servlet-name> <url-pattern>/exampleservlet</url-pattern> </servlet-mapping> my jsp file looks this. <html> <head></head> <body> <form action ="exampleservlet" method="post" enctype="multipart/form-data"> <table width="500" style="margin-top:100px;"> <tr> <td>subject</td> <td><input type="text" name="subj" id="subj"/></td> </tr> <tr> <

Customize redis commands using C -

which best way write custom redis commands? preferred language? redis supports 'custom commands' via lua scripts executed using eval(). see http://redis.io/commands/eval

c++ - Faster than xlib -

i've searched lightweight guis , found several (e.g. fltk) want fast library on linux/ubuntu. not need cross-platform. has fast. my application simple. have canvas 800x800 , on am: - drawing 200x200 squares in grid - few strings of text - hotspots person can press mouse. i'm trying push frame rate fast can. i've found sample x11 c++ code. is there faster library x? tia update: here sample code in glut. looks can 1 frame in 20ms on laptop (sony vaio i7-3632qm 2.2ghz running ubuntu 12.04). aside, looks tv "snow" when runs... i not equivalent sample run xlib. keeps terminating errors similar to: "xio: fatal io error 11 (resource temporarily unavailable) on x server ":0" after 86 requests (86 known processed) 10 events remaining." #include <gl/glut.h> #include <cstdlib> #include <pthread.h> #include <unistd.h> int win_w = 0.0; int win_h = 0.0; #include <pthread.h> #include <iostream> void

winforms - Simulating mouse events? C# -

i'm trying create windows forms program makes computer act if pressed mouse-button. want control events manually (timing not decided in advance) , needs possible press , hold, mouse-button release should separate event. the following information should not change code, further understand situation: the purpose allow user input xbox 360 controller (compatible pc) steer/control computer connected to. the best solution have far found "windows.forms.sendkeys" method works keyboard events. thanks in advance! :d i simulate mouse events this [dllimport("user32.dll", charset = charset.auto, callingconvention = callingconvention.stdcall)] public static extern void mouse_event(uint dwflags, uint dx, uint dy, uint cbuttons, uint dwextrainfo); private const int mouseeventf_leftdown = 0x02; private const int mouseeventf_leftup = 0x04; private const int mouseeventf_rightdown = 0x08; private const int mouseeventf_rightup = 0x10;

performance - SQL server - estimate execution time and get progress of alter table command -

i have big table , time time need change schema, add new columns, or change type of existing column example. this takes lot of time (hours), , wonder if there's way know beforehand how time (approximately) take, or alternatively, when alter running, i'd know current progress (i.e. 30% done). is possible?

ios - Compare ValueForKey of an array with an NSString -

i have nsstring contains foldername , have array looks this, data ( { foldername = posteingang; id = 13000; }, { foldername = freigaben; id = 13001; }, { foldername = "my drive"; id = 13002; }, { foldername = gsb; id = 13164; }, { foldername = "my folder"; id = 13183; } i compare array data nsstring can remove values string not match. for (nsstring *filename in parseddata) { nsrange filenamerange = [filename rangeofstring:searchtext options:nscaseinsensitivesearch]; if (filenamerange.location == nsnotfound) { [searchdata removeobject:[searchdata valueforkey:@"foldername"]]; } } i have fast enumeration method , have array searchdata. enumeration method looks data in array , if data not found should remove array.the searchdata array displayed in tableview. i have been trying above method doesn't work. nsstring *searchtext = @

javascript - How to add a domain-switching selector to International Google sites? -

i writing greasemonkey script change top-level domains of google.com. the complete code below. testing code in dev tool, did display choosebox , button. but, when clicked button, page reloaded, did not switch language sites. // ==userscript== // @name googlefieldexpress // @namespace http://example.gg/ // @version 1.0 // @description change field database // @match http://www.google.*/ // @match https:/www.google.*/ // @copyright 2013,matthew // ==/userscript== //database domains , varibles var domains=new array; domains=["gg","jp"]; var current=""; if (typeof this.href === "undefined") { current = document.location.tostring().tolowercase(); } else { current = this.href.tostring().tolowercase(); } var inner='\ <center>\ <strong>\ choose field below: <br />\ </strong>\ <form id="choose" >\ <select id="select_item">' (va

asp.net - How to get a specific row from database in MVC 4 -

i have model called pagemodels public class pagemodels { public int id { get; set; } public string title { get; set; } [datatype(datatype.multilinetext)] [allowhtml] public string content { get; set; } public int parent { get; set; } [datatype(datatype.date)] public datetime created_at { get; set; } [datatype(datatype.date)] public datetime updated_at { get; set; } [datatype(datatype.date)] public datetime published_at { get; set; } } and based on model have controller called pagescontroller. here have method: public actionresult showpage(string mytitle) { var query = in db.pages a.title.contains(mytitle) select a; return view(db.pages.firstordefault()); } i want able in return value content property of page has title given in mytitle. haven't been able find way of doing that. //edit that error kept getting fault ... between trying fix problem ,

yii - Disabling a controller page from being viewed -

i absolute newbie in world of yii , mvc. question : if have made crud of model , have modified "_form.php" partial used place else, example comment form used "post" view, , example if link creation of comment : http://localhost/example/comment/create how stop page being accessed , called view of "posts" page only? would have use rbac this? there other method? using "get" methods maybe? you can try checking if referrer page 1 want, using geturlreferrer() or magic property urlreferrer : http://www.yiiframework.com/doc/api/1.1/chttprequest#geturlreferrer-detail e.g.: if(preg_match('/post\/view/', yii::app()->request->urlreferrer) === 1) { // } place in comment/create action.

vim, ed or sed multiple search and replace on a given file -

i want series of "search , replace" on given file, file.txt. example, s/foo/bar/g s/abc/xyz/g s/pqr/lmn/ g/string-delete/d and on. how shuld write these actions in script file , run them on single go on target file.txt save newfile.txt? i saw post search , replace variables in file using bash/sed somehow couldn't work me. edit: prefer vim/ed based solution thanx tempora you write function wrap commands, , call function. note !! the function below example, added % in front of s cmd. because guess want substitution on whole buffer, not on "current" line. have careful, in way, previous replaced result replaced again latter command, if latter pattern matched. adjust needs. e.g. think about: text: fooc have %s/foo/ab/g , %s/abc/def/g fun! execthem() %s/foo/bar/g %s/abc/xyz/g %s/pqr/lmn/g g/string-delete/d endf source function, then :call execthem() will job. you of course create command that: command

java - Cancel alarm with different context -

i've alarm created in onbootreceiver this: public class onbootreceiver extends broadcastreceiver { @override public void onreceive(context context, intent intent) { calendar cal = calendar.getinstance(); cal.add(calendar.second, 10); intent = new intent(context, alarmreceiver.class); pendingintent pendingintent = pendingintent.getbroadcast(context, 0, i, pendingintent.flag_cancel_current); alarmmanager alarmmanager = (alarmmanager) context.getsystemservice(context.alarm_service); alarmmanager.setrepeating(alarmmanager.rtc_wakeup, cal.gettimeinmillis(), savedintervalautomaticmilisint, pendingintent); } } but cancel it, use code in activity: intent intent = new intent(this, alarmreceiver.class); pendingintent pendingintent = pendingintent.getbroadcast(this, 0, intent, pendingintent.flag_cancel_current); alarmmanager alarmmanager = (alarmmanager) getsystemservice(alarm_service); alarmmanag

mysql - unexpected results of join and count in jpa query -

i want retrieve count of tags used among posts specific user. e.g. if 1 user has 3 posts written , 2 posts tagged 'sometag', query should written count 2 tag 'sometag' there 1 many relationship between user , post. there many many relationship between post , tag using eclipselink jpa wrote jpa query follows select count(tag.tagname) post post, tag tag join tag.posts posts post.user = :user , tag.tagname = :tagname but giving me multiplication of tag , posts have tagged 9 posts tag 'friends , have total 17 posts , result getting 153 i.e. multiplication. i tried simple mysql query follows select count(*) tag t join post_tag pt on pt.idtag = t.idtag join post p on pt.idpost = p.idpost join user u on p.iduser = u.iduser u.username = 'prasadkharkar' , t.tagname = 'friends' this works fine , gives me result 9. i want result in jpa query. can please explain me wrong thing doing? by selecting post , tag, you're doing cartesian

alfresco share duplication of document releated issue in alfresco repository -

in alfresco share how can avoid duplication of file when 1 file share between 2 different folder. example suppose 1 file abc.txt shared 2 folders folder , folder b.now when checked out 1 file folder editing how can lock same file 1 never checkout file folder b. if saying abc.txt literally same object linked multiple folders (which possible in alfresco repository) checking out abc.txt in either folder lock in other folder because same object. if saying folder a/abc.txt , folder b/abc.txt 2 different objects have same name, you've got lot of work do. write customization would: replace out-of-the-box checkout ui action in share own. new action query custom service (see next step) on repository file check out. repository respond whether okay or not. the custom service on repository implement above logic have know how find matching files. matching on file name bad idea. better idea follow association. downside require users link files association. of course raises

jquery - jCanvas's clearCanvas does not seem to work with layers -

Image
i've organized jcanvas code render method fires on window.resize: <script type="text/javascript"> var middlex; var middley; var canvas; var ctx; var isloaded = false; $(document).ready ( function () { init(); isloaded = true; render(); $("canvas").fadein(2000); } ); function scaletowindowdimensions() { ctx.canvas.width = window.innerwidth; ctx.canvas.height = window.innerheight; middlex = $canvas.width() / 2; middley = $canvas.height() / 2; } function init() { $canvas = $('canvas'); ctx = document.getelementbyid("canvas").getcontext("2d"); scaletowindowdimensions(); } $(window).resize ( function () { scaletowindowdimensions(); render(); } ); function render() {

programming languages - How to add a trendline (exponential) in R? -

okay, working daily closings of dow jones industrial average (djia) index january 1979 december 1989. have plotted time-evolution of index, stumped how add trendline (specifically, exponential). can data here: http://research.stlouisfed.org/fred2/series/djia/downloaddata i downloaded excel , imported r csv file , plotted it. in addition that, how can add trendline @ specific place? say, wanted trendline year 1985 1988? if that's literally want (i suspect isn't), have plot , add curve specified function of x: plot(y~x) par(new=true) curve(0.0629*exp(0.0003*x)) if want fit curve based on in r, you'll have generate kind of model , plot fitted values using same thing instead of curve use lines .

ssh - zsh - show if git branch have unpushed commits -

actually im using modified version of oh zsh theme blinks . show ssh statement optical difference local terminal. show branch , little star if there uncommitted changes in branch. is possible show there unpushed commitments? maybe little indicator. # https://github.com/blinks zsh theme function _prompt_char() { if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); echo "%{%f{blue}%}±%{%f%k%b%}" else echo ' ' fi } case ${solarized_theme:-dark} in light) bkg=white;; *) bkg=black;; esac zsh_theme_git_prompt_prefix=" [%{%b%f{blue}%}" zsh_theme_git_prompt_suffix="%{%f%k%b%k{${bkg}}%b%f{green}%}]" zsh_theme_git_prompt_dirty=" %{%f{red}%}*%{%f%k%b%}" zsh_theme_git_prompt_clean="" prompt='%{%f%k%b%} %{%k{black}%b%f{green}%}%n%{%b%f{blue}%}@%{%b%f{cyan}%}%m%{%b%f{green}%} %{%b%f{red}%}!!ssh!! %{%b%f{yellow}%k{black}%}%~%{%b%f{green}%}$(git_prompt_info)%e%{%f%k%b%} %{%k{black}%}$(_

eclipse - TOMCAT - HTTP Status 404 -

Image
this question has answer here: tomcat started in eclipse unable connect http://localhost:8085/ 5 answers i set server in eclipse , when run console prints: mai 02, 2013 4:05:13 pm org.apache.catalina.core.aprlifecyclelistener init info: apr based apache tomcat native library allows optimal performance in production environments not found on java.library.path: c:\program files\java\jre7\bin;c:\windows\sun\java\bin;c:\windows\system32;c:\windows;c:\windows\system32;c:\windows;c:\windows\system32\wbem;c:\program files (x86)\microsoft application virtualization client;c:\program files (x86)\open text\view\bin;c:\windows\system32\windowspowershell\v1.0\;c:\program files\thinkpad\bluetooth software\;c:\program files\thinkpad\bluetooth software\syswow64;;c:\program files (x86)\intel\opencl sdk\2.0\bin\x86;c:\program files (x86)\intel\opencl sdk\2.0\bin\x64;c:\program file

Force SQL Server to respond slowly in order to test client application response to timeout -

is possible somehow force microsoft sql server slow down or queries can test client application on how acts when sql queries run extended time? example, limiting i/o or cpu 1%. unfortunately not possible modify data in database add more rows. i tried forcing query timeout in sql server unfortunately client application issues select (nolock) ignores locks create. to force query timeout error select ... myschema.mytable (nolock) queries: select ... myschema.mytable (nolock) still requires sch-s lock. according lock compatibility (database engine) , sch-s lock has conflict sch-m lock. 1) so, create new query in ssms , execute next script: begin tran alter table myschema.mytable add dummycol int null default 0 -- requires sch-m lock --rollback 2) execute queries (from client app. or ssms query) nolock table hint: select * myschema.mytable d with(nolock) -- requires sch-s lock 3) now, have wait.

payment gateway - PayPal Direct API alternative for non-US merchants -

i have paypal merchant account registered in germany , seems direct api not available in case: when trying use direct api (dodirectpayment) error: 10565 merchant country unsupported. it there other mechanism / api can use allow customers pay credit card without leaving web site ? thanks ! update: i'm wondering though: why able create api credentials (username, password , signature) in paypal profile if i'm not able use api in germany !? strange .. maybe clarify ? yes, paymill such service (and based in germany).

asp.net - Why is the DataItem property null for this DataGridItem here? -

problem i have buttoncolumn edit row defined this: <asp:buttoncolumn datatextfield="job_code" buttontype="linkbutton" headertext="job code" commandname="edit"></asp:buttoncolumn> and in onitemcommand handler datagrid have code: if e.commandname = "edit" dim o listdatamodel = ctype(e.item.dataitem, listdatamodel) if o nothing exit sub end if ... end if but e.item.dataitem null here. i've looked through related questions , verified following: the itemtype of e.item set listitemtype.item , therefore should allowed house dataitem . jives msdn documentation . i leveraged data binding -see code section below. i have set datakeyfield attribute on asp:datagrid this: datakeyfield="job_code" . data binding code (happens in search method) using reader sqldatareader = cmd.executereader() dim list list(of listdatamodel) = new list(of listdatamodel) wh

ios5 - Core Data: move object from one persistent store to another -

i'm using core data in app , export of data , import on other device. to avoid migration issues, i'd following: export: create second export.sqlite-file same database model, empty add file addpersistentstorewithtype copy managedobjects on .sqlite remove added persistent store import: - copy export.sqlite-file app - add .sqlite-file addpersistentstorewithtype - copy data on - remove added persistentstore but how achieve that? i.e. how can tell managed object copy other store? how can tell managed object copy other store? you can't, not directly anyway. you'll have like: for each object in origin data store, create new object in target store same entity type assign new object's attributes same values original object once you're done creating new objects, second pass set relationships. the relationships need done separately, because of objects in relationship need exist before can create relationship.

vbscript - Constantly look for file, when file exist, run command -

i need vbscript monitors folder specific file, when file found needs execute command delete file continue monitor folder again same file incase needs run again. this... set fso = createobject("scripting.filesystemobject") while 1>0 if fso.fileexists (file.txt) fso.deletefile (file.txt) createobject("wscript.shell").run "c:\windows\notepad.exe" end if wscript.sleep 1000 loop gave me "object required: file" error update, worked... filename = "c:\vbscript\cat.txt" set fso = createobject("scripting.filesystemobject") if fso.fileexists(filename) fso.deletefile filename createobject("wscript.shell").run "c:\windows\notepad.exe" end if wscript.sleep 1000 loop simply create script infinitely loops, testing file existence , if delete it. filename = "path\to\filename" set fso = createobject("scripting.filesystemobject")

asp classic - IsNumeric() not working with Request.QueryString -

i'm having problems trying isnumeric work request.querystring. the server windows 2008 r2 / iis7.5 my code not simpler: <%@ language=vbscript %> <% response.write "isnumeric: " & isnumeric(request.querystring("")) %> my url: http://localhost.com/default2.asp?44hjh the output: isnumeric: true if change code this, desired outcome: <%@ language=vbscript %> <% response.write "isnumeric: " & isnumeric(request.querystring("test")) %> my url: http://localhost.com/default2.asp?test=44hjh the output: isnumeric: false why isnumeric not work when don't specify specific querystring element? , more importantly, how can fix it? request.querystring("") doesn't exist , returns null -- there isn't parameter blank. isnumeric of null value return true. instead of using request.querystring("") , can either supply

html - Resizing divs and background images to fit page with CSS -

say want have couple of divs on page images in background (like this: http://www.ubudhanginggardens.com/ ). know how set size of divs, problem background image stays same if make web browser smaller... want background image scale up/down web browser. css body, html { height: 100%; width: 100%; margin: 0px; } #container1 { float: left; height: 100%; width: 50%; background-image: url(../img/1.png); } #container2 { float: left; height: 100%; width: 50%; background-image: url(../img/2.png); } this can done pure css , not require media queries. to make images flexible, add max-width:100% , height:auto . image max-width:100% , height:auto works in ie7, not in ie8 (yes, weird ie bug). fix this, need add width:auto\9 ie8. source css: img { max-width: 100%; height: auto; width: auto\9; /* ie8 */ } and if want enforce fixed max width of image, place inside container, example: <div style="max-width:50

soapui - Continue after failed assertion -

Image
once assertion fails( typically api response ), remaining test steps in test case not executed. how soapui continue on , complete rest of test steps? looking way retry step again same set of data. if not possible, skip , proceed next set of items. idea on ? 1- double click on test case (not test step) look @ provided picture , find 1 shown below:

hadoop - Convert HDFS SequenceFile from SnappyCodec to DefaultCodec -

given choice, i'd love can run hadoop shell vs mr job. have few files need converted. some code untested should trick (obviously file names made - sequence files don't typically have extensions): configuration conf = new configuration(); filesystem fs = filesystem.get(conf); path inputpath = new path("part-r-00000.snappy"); path outputpath = new path("part-r-00000.deflate"); fsdataoutputstream dos = fs.create(outputpath); sequencefile.reader reader = new sequencefile.reader(fs, inputpath, conf); writable key = (writable) reflectionutils.newinstance( reader.getkeyclass(), conf); writable value = (writable) reflectionutils.newinstance( reader.getvalueclass(), conf); compressioncodecfactory ccf = new compressioncodecfactory(conf); compressioncodec codec = ccf.getcodecbyclassname(defaultcodec.class .getname()); sequencefile.writer writer = sequencefile.createwriter(conf, dos, key.getclass(), value.getcla

How to use a javascript variable in url.action with ASP.NET MVC WebForms view engine -

i want redirect user url in javascript function. editclick: function () { var myid = 1; location.href = '<%= url.action("actionname", "controllername", new { id = myid})%>'; }; but 'myid' not exist in current context. how use js variable in url.action? an approach i've taken in past generate link in view so: <div class='clickmaster'> <div class='clicker' id='@url.action("actionname", "controllername", new { id = model.id })'> show here </div> <div class='clicker' id='@url.action("actionname", "controllername", new { id = model.id })'> show here </div> </div> then in javascript defined function this: $(function() { $('.clickmaster').on('click', '.clicker' , function() { location.href = this.id; }) });

sql - Calculating current school year -

i trying calculate current school year is, based off of sysdate. since academic school years run (approximately) august - may, need @ current month determine school year in. for example, if current month may of 2013, 2012-2013 school year. however, if current month september of 2013, 2013-2014 school year. i suspect approach way off , there easier way accomplish this, here portion of sql code working now: where to_date(ps_customfields.getstudentscf(s.id,'voltran_expdate'),'mm/dd/yyyy') between case when to_char(sysdate,'mm') < '08' '08/01'||(to_char(sysdate,'yyyy')-1) , '08/01/'||to_char(sysdate,'yyyy') when to_char(sysdate,'mm') >= '08' '08/01'||to_char(sysdate,'yyyy') , '08/01/'||(to_char(sysdate,'yyyy')+1) end the ps_customfields.getstudentscf(s.id,'voltran_expdate') field plain text field, why i'm casting date. the error i

Use of sub report in Crystal reports -

can tell me when use sub-report in crystal reports? have not used them long time. in past, use them, if needed run 1 report first , based on output first report, need run sub-report. seems not needed anymore. also cross tab grid? some thoughts on subreports brij mohan: subreport link seems cover key points. as cross tabs .... reports 1 dimensional list. cross tab 2 dimensional table.

Does Caliburn.micro simplecontainer supports property injection? -

does caliburn.micro simplecontainer supports property injection? how can injection? yes via bootstrapper.buildup() - call container.buildup(instance) in bootstrapper: simplecontainer _container; protected override void configure() { _container = new simplecontainer(); // register stuff: _container.registersingleton(typeof(iwindowmanager), null, typeof(windowmanager)); base.configure(); } // property inject: protected override void buildup(object instance) { _container.buildup(instance); } calls ioc.buildup in code pass through bootstrapper.buildup method

delphi - How do I use DrawText DT_CALCRECT properly? -

i generating report has caption in footer. use drawtext find out caption's dimensions. problem text clipped, when have carriage return @ end of text, text appears perfectly. lclientrect := rect(0, 0, 4770, 59); lflags := dt_calcrect or dt_expandtabs or alignments[alignment] or wordwraps[wordwrap] or dt_noprefix or dt_top or dt_externalleading; drawtext(lcanvas.handle, pchar(lscaption), length(lscaption), lclientrect, lflags); i examined rect after call drawtext, , (0, 0, 4366, 59), when have carriage return, (0, 0, 4366, 118). i don't have clue on happening. appreciated. the carriage return adds second line of text string, doubling height of calculated rectangle. (windows flexible whether line-feed or carriage-return character starts new line.) as why text clipped (on bottom edge, assume), might you're calculating size using different font have when draw text.

php - singleton nasty object, unable to use other objects -

i'm trying use singleton design pattern create object , consume it. first have system class [the factory] object system class class system { public function require_($file) { if( file_exists($file) ){ require( $file ) ; }else{ $this -> config_erros['require'][] = $file ; } } public function call($object , $object_name = '') { if( $object_name == '' ) { return $this -> {$object} = new $object() ; }else{ return $this -> {$object_name} = new $object() ; } } public function __autoload($class , $object_name = '') { if( is_array( $class ) && !empty( $class ) ) { $class = array_unique($class) ; foreach( $class $f ) { $this -> require_( classes_path . $class .'.php' ) ;

c# - PictureBoxSizeMode has no effects -

i trying manipulate images using c# (vs 2010) . have form has tab control 7 tabs. under each tab, have 900 x 750 picture box , trying display images of size 1800 x 1500 in each of them using paint event. i tried setting sizemode through property window i tried setting sizemode property programmatically before painting picturebox i tried setting sizemode property programmatically after painting picturebox neither of methods seem have effect on images !! still see top left quarter of images. guess sizemode property defaulting normal mode. doing wrong here?

php - Is this Twitter Search API code Deprecated? -

i'm new twitter search api , wondering whether code snippet below deprecated? $json = json_decode(file_get_contents('http://search.twitter.com/search.json?q=to%3astackexchange')); if so, can give me example of version not deprecated? in advance. yes, this code deprecated . the manual page links twitter api v1.1 version .

c# - Is it possible for a wcf service to take an SQLcommand object as an input? -

i'm asking because store command objects in appfabric cache , execute them @ later stage through batch once day. (to reduce number of uneven database hits). these pure update statements , don't return anything. the short answer yes. wouldn't recommend doing it. instead pass query string , create sqlcommand in service. this question explains how pass object client app wcf service; how pass client objects wcf service basically if create sqlcommand object client side you're; 1) allocating/initializing object 2) having object serialized , deserialized equivalent object in service. if pass string you're instead; 1) allocating/initializing string 2) passing service allocates , initializes sqlcommand object. the latter simpler , more efficient.

ibm mobilefirst - LTPA token propagation from App to Adapter to final service -

i'm trying use , understand use of ltpa security in worklight , propagation of ltpa cookie. i'm able authenticate agains , using sniffer can see worklight returns me ltpatoken2 cookie when invoke http adapter, invokes service in other in same machine worklight server, adapter not propagate cookies. i think have set right configuration. (at end) is possible configure worklight server automatically propagate ltpa token app adapters , adapters final service? if not possible automatically how can retrieve ltpa cookie inside adapter code add headers parameter of wl.server.invokehttp() method. this security configuration: for work have had add login.html hand in customized war generated in worklight studio. application-descriptor: <ipad bundleid="xxxx" securitytest="bpmapp-strong-mobile-securitytest" version="1.0"> adapter-descriptor: <procedure connectas="enduser" name="getrest" securitytest="bpm

ios - Present Modal view over Modal view not showing -

i've had on , can't find answer this. i'm presenting modal view from: - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { [tableview deselectrowatindexpath:indexpath animated:yes]; icobservationeditcontroller *controller = [[icobservationeditcontroller alloc] initwithobservation:[self.observations objectatindex:indexpath.row]]; uinavigationcontroller *navcontroller = [[uinavigationcontroller alloc] initwithrootviewcontroller:controller]; navcontroller.navigationbar.barstyle = uibarstyleblackopaque; navcontroller.navigationbar.tintcolor = [uicolor graycolor]; [self.editcontroller presentmodalviewcontroller:navcontroller animated:yes]; } once presented, option want present text message on top messageui framework: mfmessagecomposeviewcontroller *controller = [[mfmessagecomposeviewcontroller alloc] init]; if([mfmessagecomposeviewcontroller cansendtext]) { nslog(@"presented");

c# - app stops responding with no apparent reason -

Image
my dice roller app contains 7 text boxes (three pairs of 'no. of dice' , 'dice type' , bonus one) , button. intended each pair of text boxes read separately, , if doesn't contains valid numbers ('fate' , '%' read numbers app reasons) ignores it. the problem when not enter valid numbers in 1 of 'no. of dice' text box app stops responding, , returns loading page. note i've tested each method separately already. here code: namespace diceroller { public sealed partial class mainpage : diceroller.common.layoutawarepage { public mainpage() { this.initializecomponent(); } random r = new random(); //regular, untouched basic page code here private void btnroll1_click(object sender, routedeventargs e) { //the problem number boxes. list<int>[] results = new list<int>[3]; if (!(readinput(textboxnumber1.text) == 0 || readinput(textboxtype1.text) == 0)) {

PHP file with html and javascript inside of Joomla with JUMI doesnt show anything - duplicate header and body? -

the google maps javascript api contains simple example if put copy/paste html file , place on server works nicely. however want 'copy/paste' code php file , able call javascript functions 'add markers' map (eventually) - in order need understanding how html code works - because not understand how displaying page. https://developers.google.com/maps/documentation/javascript/examples/map-simple below current php file see no php code other opening , closing php @ time , copy paste of google maps example - yet divs, , believe meta doesn't 'work' because can't have head? or body? in joomla article? what expect see when run file in joomla same thing see if open php file - yet nothing shows (other hello world text)... <?php ?> <head> <title>simple map</title> <meta name="viewport" content="initial-scale=1.0, user-scalable=no"> <meta charset="utf-8"

c# - How would I extend WebAPI to support returning controller action results via an HTTP callback? -

i'm trying extend webapi support returning response through http callback. workflow: webapi receives http request callback url. webapi handles url , if operation completes in less time configured timeout result sent synchronously. if timeout exceeded server needs send http response indicating went async, processing continues. when processing (eventually) completes response of controller posted pre-negotiated callback url. controllers need remain synchronous , unaware of async/callback functionality. it appears messagehandlers candidate returning multiple http responses (one 'long task' response , 1 callback) not appear supported. can provide guidance on areas of webapi extensible , relevant scenario? i think httpmessagehandler trick not way think you're asking for. one url main 1 , return either result or redirection , other handle redirections. this common scenario. in cases you'll ask list of , receive managed amount of results , c

c - Passing array into function not giving correct answer -

this question has answer here: why isn't size of array parameter same within main? 13 answers i wrote function : string par(int a[]){ int s=sizeof(a)/sizeof(*a); cout<<s<<endl; /* ..do */ } the main function written as: nt main(){ int a[]={1,5,11,5}; cout<<sizeof(a)/sizeof(*a)<<endl; cout<<par(a)<<endl; } the output is: 4 1 while believe should same passed same array. kindly point out mistake..thanks.. in c++ when pass array argument function, you're passing pointer array. since size of pointer , int 4 or 8 (depending on abi, , since you're getting 1 guess have 32-bit machine) you're getting 4/4 1. so int s=sizeof(a)/sizeof(*a); 1. you should pass size argument instead of trying calculate inside function: string par(int a[], int size)

kinect - Error LINK2019 using OpenNI and Visual Studio -

i trying built .cpp file using openni in visual studio 2012. using code of simpleviewer sample (it included in openni). when try build .cpp file got error lnk2019 seems problem when compiler has link openni library. wrong? errors (55 in total): > error 1 error lnk2019: unresolved external symbol __imp__onishutdown > referenced in function "public: static void __cdecl > openni::openni::shutdown(void)" > (?shutdown@openni@openni@@saxxz) c:\develop\visualstudioworkspace\projects\my > programs\openni2_test\openni2_test\viewer.obj openni2_test error 2 error lnk2019: unresolved external symbol __imp__oniwaitforanystream referenced in function "public: static enum openni::status __cdecl openni::openni::waitforanystream(class openni::videostream * *,int,int *,int)" (?waitforanystream@openni@openni@@sa?aw4status@2@papavvideostream@2@hpahh@z) c:\develop\visualstudioworkspace\projects\my programs\openni2_test\openni2_test\viewer.obj openni2_

c# - Is it bad design to have access to the UnitOfWork in the Repository? -

background: entity framework4.1 , mvc4 my setup has model entities, , generic repository , model specific repositories userrepository, productrepository inherit generic repository. i have service layer use these repositories along business logic, , unitofwork object accessible here call commit. with unit of work pattern, , quesiton is: is poor design let repository layer have access unitofwork object? to me seems 'leak' because things may commit when don't realize it. is correct? e.g. public class productservice { public void saveproduct(product product) { try { productrepository.save(product); statsrepository.update(product); this.unitofwork.commit(); } catch(..) { // } finally() { // } } } now if 1 of calls fails, commit won't called. but if in abcrepository layer had access uofw object , called commit, behave in inconsistant manner.

java - How to get a socket object without a reference variable? -

i've been thinking day, dont think if title correct 1 here goes, let me explain situation: im working on project, server made in java clients made in delphi. conections good, multiple clients own threads, i/o working good. clients send strings server read bufferedreader. depending on reserved words server receives, makes action. before client sends string, inserts information sql server database server can go , check after getting order/command via socket. server obtains information in database, process it, , send to... let's call "the dark side". at moment transaction done, , info sent dark side, server inserts information... cough cough, dark information database table client can go , take requested. but, need report client! ("yo, check again database bro, want there :3"). the conection, socket made in other class. not 1 want use answer client, if dont have socket, dont have outputstream, need talk back. class, 1 processing , sending information da

amqp - Celery not connecting to Redis broker: Connection to broker lost -

i'm trying redis work broker celery 3.0.19 install on django. see redis-server running on port 6379. when run simple celery test, following stack trace: ubuntu lucid 10.0.4 celery 3.0.19 celery -a tasks worker --loglevel=info [2013-05-02 18:56:27,835: info/mainprocess] consumer: connected redis://127.0.0.1:6379/0. [2013-05-02 18:56:27,835: error/mainprocess] consumer: connection broker lost. trying re-establish connection... traceback (most recent call last): file "/usr/local/lib/python2.6/dist-packages/celery/worker/consumer.py", line 394, in start self.reset_connection() file "/usr/local/lib/python2.6/dist-packages/celery/worker/consumer.py", line 744, in reset_connection self.connection, on_decode_error=self.on_decode_error, file "/usr/local/lib/python2.6/dist-packages/celery/app/amqp.py", line 311, in __init__ **kw file "/usr/local/lib/python2.6/dist-packages/kombu/messaging.py", line 355, in __init__ self.revive(self.channel) fi