Posts

Showing posts from April, 2010

asp.net mvc - MVC RememberMe Validation Glitch -

in mvc project validator unintentionally requires rememberme checkbox checked upon logging in. on ie8, not allow user login unless tick remember me box. other browsers fine including ie7. <input id="rememberme" type="checkbox" value="true" name="rememberme" data-val-required="the remember me? field required." data-val="false"> i tried change property in entity framework nullable bool? produces error: the best overloaded method match 'webmatrix.webdata.websecurity.login(string, string, bool)' has invalid argument so, doesn't able change fix issue. have tried on writing property jquery gets changed back. random , i'm suprised got on looked out of box technology. appreciated. here login model: public class loginmodel { [emailaddressattribute] [required] [stringlength(80)] [display(name = "email address")] public string username { get; set; } [required] ...

JQuery UI - Datepicker - Display date in another element -

i have following code on codepen. http://codepen.io/anon/pen/pnyvg my aim allow users input own dates , gets outputted element in more readable format e.g. type date or choose date, , display date in paragraph tag in following format "wednesday 7th august". also, have few additional pieces of functionality require, awesome if give me direction; once date outputted paragraphs each input, output number of nights in between 2 dates element be able use same date picker both inputs. similar behaviour used on following form; http://www.hipmunk.com/hotels-search it great if guys me out. thanks in advance, b look here started: $(function() { $( "#datepicker" ).datepicker({ altfield: "#alternate", altformat: "dd, d mm, yy" }); });

Copy Database in assets to data/database work in emulator but not work in device -

i have code: working in emulator fail in devices. want copy database stored in assets data/data/.... when load app apears "error file" (filenotfoundexception e) -> error public void copiardb() { try { string destpath = "/data/data/" + getpackagename() + "/databases/mibd"; file f = new file(destpath); if (!f.exists()) { copydb(getbasecontext().getassets().open("datosejer"), new fileoutputstream(destpath)); } } catch (filenotfoundexception e) { e.printstacktrace(); toast.maketext(mainactivity.this, "error file", toast.length_short) .show(); } catch (ioexception e) { e.printstacktrace(); toast.maketext(mainactivity.this, "error io", toast.length_short) .show(); } adaptadorbd db = new adap...

c# - Formatting of detail section in SAP Crystal Report -

Image
i using sap crystal report in wpf , want formatting (bold, color) of detail section’s last record of every group. is possible, please help. use snippet in formatting formulas. onlastrecord //if last record in report next() not work or next({table.group_field}) <> {table.group_field} //the next record starts new group for example, if wanted change last detail section's background color yellow in each group, use formatting formula: if (onlastrecord or next({table.group_field}) <> {table.group_field}) cryellow else crnocolor

orm - How to set default values for foreign keys in Entity Framework code-first models -

i'm using entity framework 5, code-first. i have poco looks this: public class order { public int id { get; set; } public string name { get; set; } public virtual status status { get; set; } public order() { this.status = new status() { id = 1 } } } this mapped fluently like: public class ordermap : entitytypeconfiguration<order> { public ordermap() { totable("order"); haskey(x => x.id); property(x => x.id); property(x => x.name).isrequired(); hasrequired(x => x.status) .withmany(x => x.orders) .map(x => x.mapkey("statusid")); } } in database, order table has default value of statusid set 1 . however, when adding new order , error: violation of primary key constraint 'status_pk'. cannot insert duplicate key in object 'dbo.status'. duplicate key value (1) if remove assignment status in order ctor, instead: cannot insert value null co...

How do modules work in Python? -

i wondering how module work in python.for example have code import requests r = requests.get("http://www.google.com") print r.status_code now according understanding, requests module should have python file containing class called "get" , within "get" class there must member variable called "status_code" when create object "r", variable status_code it. however, when looked @ files come in package, not find class named "get". find function called "get", under class called "response". since did not create object instance of "response" class, how can access "get" function inside it? i think missing key concept here, can point out me please? thanks when import requests file __init__.py is executed, if examine file in case, find line: from .api import request, get, head, post, patch, put, delete, options which means api.py importing get() function: def get(url,...

blackberry - Does porting Android application to BB 10 causes performance issues? -

i new blackberry 10 development. reading of documents understand possible port android applications bb 10. in fact way 1 can develop apps bb 10 using java language. i wonder porting apps ever cause performance issues in bb 10. client particular performance of application developing. can of experts here tell me whether there chance ported application slow in bb 10? thank in advance. awaiting reply jayakrishnan salim regarding performance, no issue reported. works fine, on mid-end android 2.3 device. however, not not every application can ported, restrictions applies: in particular, application can't contain native (c/c++) code.

inheritance - Extending functionality to object PHP -

i creating class in php want extend class can have many basic functionality. problem functionality different , not want mix different methods in 1 class. due organization , extensibility prefer separate them logically. let's imagine have 3 classes: class user{ } class tracker { } class lister { } user main class representing real-life object. without minding on concrete functionality of classes, both tracker , lister provide methods must appliable in user because kind of helpers. if use inheritance able inherit once time having create many classes "extends" add , finishing hierarchy class user. there option avoid doing this? mean possible extend user class functionality of other classes without having in way have said knowing php not support multiple inheritance? thank you! it classes or decorate user class, may better use implementation of decorator pattern. $user = new user(); //default behavior $user->getmethod(); $tracker = new tracker($...

javascript - Tinymce toggle format, formats the button not the editor -

so im having little issue tinymce4 api, iv created custom format want tigger button. happens when button clicked, style applied button instead of actual contenteditable field.. tinymce.init({ selector: '#editable', inline: true, menubar: false, toolbar:false, statusbar: false, }); settimeout(function(){ tinymce.activeeditor.formatter.register('mycustomformat', { inline : 'span', styles: {color: 'red'} }); },200); $('.js-toggleformat').on('click', function(e) { tinymce.activeeditor.formatter.apply('mycustomformat'); }) and html: <button class="js-toggleformat">toggle</button> <div id="editable" contenteditable="true"></div> take @ example. tinymce plugin "textcolor" uses function "applyformat" applying color. looks this: function applyformat(format, value) { editor.focus(); editor.formatter.apply(...

html - special characters with Net::Twitter::Lite -

i try send characters ü, ä, ß, à , on twitter. if use unicode characters in scripts come out wrong in twitter. if use html (which possible in twitter's web-interface , used work previously) see &#252; rather "ü" in post. there parameter or have set? call encode/decode? using: use net::twitter::lite::withapiv1_1; i find myself checking out test suite of perl modules quite source examples. net::twitter expects decoded characters, not encoded bytes so, sending encoded utf8 net::twitter result in double encoded data. source: https://metacpan.org/source/mmims/net-twitter-lite-0.12006/t/unicode.t

Encryption in Android equivalent to php's MCRYPT_RIJNDAEL_256 -

i using below php code encryption: $enc_request = base64_encode( mcrypt_encrypt(mcrypt_rijndael_256, $this->_app_key, json_encode($request_params), mcrypt_mode_ecb) ); now trying encrypt in android , getting different encrypted string. below android code: public void enc(){ byte[] rawkey = getrawkey("my_key".getbytes()); secretkeyspec skeyspec = new secretkeyspec(rawkey, "aes"); cipher cipher = cipher.getinstance("aes"); cipher.init(cipher.encrypt_mode, skeyspec); byte[] encrypted = cipher.dofinal("my_message".getbytes()); string result=base64.encodetostring(encrypted, base64.default); } private static byte[] getrawkey(byte[] seed) throws exception { keygenerator kgen = keygenerator.getinstance("aes"); securerandom sr = securerandom.getinstance("sha1prng"); sr.setseed(seed); kgen.init(256, sr); secretkey s...

Eclipse segmentation fault with --launcher.openFile -

i'm running eclipse (with own plugin in it) --launcher.openfile option active: /path/to/eclipse/eclipse -data /home/workspace --launcher.openfile myfile.ext but, instead of opening file, eclipse crashes (before showing splash image) , writes "segmentation fault" terminal. any idea of cause problem or how more meaningful error message? it's bug in eclipse due relative path names. i've analyzed what's going on. https://bugs.eclipse.org/bugs/show_bug.cgi?id=439459

c++ - How to use bucket sort to sort a set of strings -

i have set of strings set s = {string1, string2 ... upto n } . need sort them lexicographically. how use bucket sort ? also tell other efficient method can used solve question. sort first character. gives number of "buckets." sort each nonempty bucket starting second character. repeat until whole thing sorted.

networking - How are IP packets reassembled -

let's have ip packet total size of 12000 bytes , send packet station station b on data-link layer. single ethernet frame can carry 1500 bytes of payload data, in total, need 8 ethernet frames transmit 12000 bytes ip packet, correct? let's assume first ethernet frame (carrying ip header) gets garbled during transmission , totallength field of ip header no longer contains actual length nonsense value. if station b realizes header checksum no longer valid , discards frame, how can station b know next ip packet starts in incoming data stream? not know how many bytes of payload first ip packet had, right? or size of ip packet limited maximum length of payload underlying data-link frame can handle? okay after doing more researching, case maximum size of ip packet determined maximum transmission unit (mtu) of data-link. for care, website breaks down pretty well: http://aa.net.uk/kb-broadband-mtu.html

Exception Devart.Data.Linq on a server "Devart.Data.Oracle.Linq.Provider" -

i trying deploy application on windows server 2007 32 bit application give me exception error on opening dbconnection. bei devart.data.linq.linqcommandexecutionexception.canthrowlinqcommandexecutionexception (string message, exception e) bei devart.data.linq.provider.k.a.g() bei devart.data.linq.provider.k.a.b(iconnectionuser a_0) bei devart.data.linq.provider.k.b(iconnectionuser a_0) bei devart.data.linq.provider.dataprovider.executequery(compiledquery compiledquery, object[] parentargs, object[] userargs, object lastresult) bei devart.data.linq.provider.dataprovider.executeallqueries(compiledquery compiledquery, object[] userarguments) bei devart.data.linq.provider.dataprovider.compiledquery.devart.data.linq.provider.icompiledquery.execute(iprovider provider, object[] userargs) bei devart.data.linq.dataquery 1.i() bei system.collections.generic.list 1..ctor(ienumerable 1 collection) bei system.linq.enumerable.to...

sdk - Unity 3d android building error -

when try build .apk file gives me following 2 errors: error building player: win32exception: applicationname='c:/users/teodor/appdata/local/android/android-sdk/platforms/android-18\aapt.exe', commandline='package -v -f -m -j gen -m androidmanifest.xml -s "res" -i "c:/users/teodor/appdata/local/android/android-sdk/platforms/android-18\android.jar" -f bin/resources.ap_', currentdirectory='temp/stagingarea' unityeditor.hostview:ongui() and exception: error building player: win32exception: applicationname='c:/users/teodor/appdata/local/android/android-sdk/platforms/android-18\aapt.exe', commandline='package -v -f -m -j gen -m androidmanifest.xml -s "res" -i "c:/users/teodor/appdata/local/android/android-sdk/platforms/android-18\android.jar" -f bin/resources.ap_', currentdirectory='temp/stagingarea' unityeditor.buildplayerwindow.buildplayerwithdefaultsettings (boolean a...

ios - TTTAttributedLabel not displaying the last line when having Emoji symbols -

we using "tttattributedlabel" displaying labels. calculating correct rectangle size, use nsstring's "sizewithfont" method, "constrainedtosize" width of field. calculation fine, unless there emoji symbols in text, , text multi line (for example: smiley-newline-smiley). in case, returned size small (vertically), , last line not shown. if text not contain emoji (e.g. x-newline-x) - size correct. our font "helveticaneue" size:16.25, in case makes difference. there better way calculate needed size, work emoji well? thanks i had same situation when making auto-height label according contents of label. seems fine, except when there emojis in label content. it because did't use correct settext method attributedstring. [label settext:text afterinheritinglabelattributesandconfiguringwithblock:^ return mutableattributedstring; }]; this correct way set attributedstring, did [label setattributedtext:text]; so getting wr...

Fade an element in on load with jQuery -

i'm trying fade in element in jquery , despite simplicity, isn't working me. here's code: <table><tr><td>blah</td></tr></table> $(document).ready(function () { $("table").css('color','green'); $("table").fadein(2000); }); and here's example in jsfiddle: http://jsfiddle.net/heukn/1/ it won't fade in unless it's hidden first. try instead: $(document).ready(function () { $("table").css('color','green'); $("table").hide().fadein(2000); }); here i've used hide() jsfiddle you could, alternatively, not display using css: table{display: none;} the downfall being that, if user doesn't have javascript enabled (unlikely, know, possible) table never displayed.

asp.net mvc - Multiple forms in MVC view: ModelState applied to all forms -

running trouble multiple forms on single view. suppose have following viewmodel: public class changebankaccountviewmodel { public ienumerable<bankinfo> bankinfos { get; set; } } public class bankinfo { [required] public string bankaccount { get; set; } public long id { get; set; } } in viewmodel, want bankinfos displayed underneath eachother, inside separate forms each. to achieve this, i'm using partial view _editbankinfo: @model bankinfo @using (html.beginform()) { @html.hiddenfor(m => m.invoicestructureid) @html.textboxfor(m => m.ibanaccount) <button type="submit">update stuff</button> } as actual view bankinfo: foreach(var info in model.bankinfos) { html.renderpartial("_editbankinfo", info); } last, here 2 action methods: [httpget] public actionresult bankinfo() { return view(new changebankaccountviewmodel{bankinfos = new [] {new bankinfo...}); } [httppost] pub...

javascript - get values in pairs from json array -

firstly, json value getting php source: [{"oid":"2","cid":"107"},{"oid":"4","cid":"98"},{"oid":"4","cid":"99"}] after that, want , oid value along corresponding cid value example, oid=2 , cid=107 @ 1 go, oid=4 , cid=98 @ , on. trying use jquery, ajax this. i have tried many answers this, like: javascript: getting existing keys in json array , loop , key/value pair json array using jquery don't solve problem. i tried this: for (var = 0; < l; i++) { var obj = res[i]; (var j in obj) { alert(j); } but did return key name, again did not work on being used. so, have array of key/value pairs. loop array, @ each index, log each pair: var obj = [{"oid":"2","cid":"107"},{"oid":"4","cid":"98"},{"oid":"4","cid"...

shieldui - Relating two shield UI ASP.NET Charts -

i want create 2 related shield ui asp.net charts. when users clicks on first one, data on second 1 changed. looked @ available events in visual studio, find events related data binding, loading , on. see there group of properties- clientevents. , seriesclick event declare seriesclickfunction. located in c# code: protected void seriesclickfunction() { } however when run application in debug mode , put break on function, never gets triggered. why that? how take use of these events? in c# code module may not place clientevents functionality. need place on html source of page. here 1 example of how may relate 2 charts in manner want: https://demos.shieldui.com/aspnet/rangebar-chart/related-charts

Javascript minimizing this if statement possible? -

i'm trying learn shorthand javascript stuck following one. if (windowwidth >= 960){ widthofwindow = 1; yooucandoit() } else { widthofwindow = 0; $('#topbar').remove(); } that code looks fine. it's unterstandable , has little duplication of code. you can make short, if yooucandoit function doesn't depend on widthofwindow variable, uses side effects in conditional operators, has pretty bad code smell... widthofwindow = windowwidth >= 960 ? yooucandoit(), 1 : $('#topbar').remove(), 0;

Encryption exception: you have not installed the Java Cryptography Extension (JCE) -

error: encryption exception: have not installed java cryptography extension (jce) unlimited strength jurisdiction policy files in java virtual machine i have read resolve this, 1 must download local_policy, us_export_policy jars , put in jre\lib\security folder did. overwritten ones existing. error still showing. restart vmware, redeployed app, republished, clean did not help. not have dependencies 1 have suggested somewhere java se 1.7 version. any suggestion might me resole other ones tried? thanks.

jquery click function always fires on second click -

i have click function in combination cookie.js: $("#mobilebar").show(); var cs = $.cookie("sidebar"); if(cs == "close") { $(".sidebar").css("left", "-44px"); $("#mobilebar") .css("left","0px") .addclass("active"); $(".sidecontent") .css("left","-225px") .hide(); } $("#mobilebar").on("click", function(){ var $theelem = $(this); if (!$theelem.attr('data-toggled') || $theelem.attr('data-toggled') == 'off') { $theelem.attr('data-toggled','on') .animate({left: "0px"}) .addclass("active"); $.cookie("sidebar", "close", { expires: 7, path: "/" }); ...

c# - Store unknown size data to table -

i realise there have been debates this, although can find real definitive answer. a lot of times, question leads definition of varchar(max) etc is, actual limits, , not use. what want find out this: giving user option type/paste in whatever want in text box, without limit. word, byte array dump of image. i need able reference data @ later stage, using title or id. what best way go storing data db? have read using varchar(max) stops indexing, , should not used. i'm not well-off in sql, imagine possible solution split string arrays of 4000, , store them that. is lead? or missing obvious? general model: public string a_title { get; set; } public string a_content { get; set; } public string a_additionalinfo { get; set; } where a_content stored unknown. varchar(max) intended cases yours. even if chunk data nvarchar(4000) (or varchar(8000) ) byte segments allow indexes built, worth indexes have? you'll opening headache of figuring ...

css - how to place image tags in a select imput bar -

i have select box below works perfectly; want place little colour box in each of option groups. tried using span tag within not seem work. i don't want use anchor tags or images. prefer if possible have kind of container tag. i have enclosed code below. <select name="search-legend"> <option value=""></option> <option value="1"<?= $this->returnsearchvalue == "1" ? 'selected' : '' ?>> <span id="redbox"> </span> value1 </option> <option value="2"<?= $this->returnsearchvalue == "2" ? 'selected' : '' ?>> <span id="bluebox"></span> value2 </option> <option value="3"<?= $this->returnsearchvalue == "3" ? 'selected' : '' ?>> <span id="greenbox"></span> value3 </option> </se...

linux - Scrubbing files from the shell -

my shell skills bit rusty, trying take 2 files , 'scrub' 1 other based on matching field. that's important part rest of line can different, if key field matches removed. example files pipe delimited , second field key field. file 1 ------ acme|widg001|green|plant a|<timestamp> acme|widg102|blue|plant b|<timestamp> acme|widg002|yellow|plant a|<timestamp file 2 ------ acme|widg001|blue|plant a|<timestamp> acme|widg701|blue|plant a|<timestamp> when scrub file 2 file 1 want resulting file contain is new file ------ acme|widg102|blue|plant b|<timestamp> acme|widg002|yellow|plant a|<timestamp> ideally solution allow me specify more 2 files ie scrub files 2, 3 & 4 file 1. any assistance great! since asked bash decided give go using bash. no external programs @ all. ifs='|' declare -a scrub while read f1 f2 rest; scrub[$f2]=0 done < file2.txt while read f1 f2 rest; if [ ! ${scrub[$f2]} ]; ...

database - How to "explore" group of servers? -

i need check group of servers (unix, linux) know kind of services, software (also version) running there (check once while , store in database). idea have fresh info whole environment - changing. perhaps can suggest solution there? thinking using nagios or cacti + plugins not sure if solution optimal. nagios powerful monitoring solution (the best me) : open source, compatible both linux & windows, reporting & notifications via emails/sms, nice interface, many many plugins...etc i've worked & satisfied. check nico largo's forum install. if not familiar linux command search fan : automated nagios .iso nagios in. if have trouble during install or configuration post questions there : https://serverfault.com/

java - Eclipse plugin: Copy/Export dependencies -

i have plugin in need of .dll-files. debug eclipse-applicatoin , try load these .dll files receive filenotfoundexception since application not inside project folder in actual eclipse folder running in. so not c:\eclipseworkspace\myproject\fileineed.dll c:\eclipse\fileineed.dll instead. of cource copy .dll there , that's sure can tell eclipse export these files debugging eclipse. does know how? please read paragraph "native code , class loaders" @ http://www.eclipsezone.com/articles/eclipse-vms/ . tell important steps: put dll @ root of plugin project. include in build.properties. use either system.loadlibrary() or osgi headers dll loaded @ runtime.

Sample arbitrary amount of numbers from Haskell list -

i'm starting learn haskell ruby background. i'm looking able arbitrary number of items list: sample [1,2,3,4,5,6,7,8,9,10] => 7 sample 3 [1,2,3,4,5,6,7,8,9,10] => [4,2,9] this available in ruby , i'm hoping same functionality. haven't been able find after googling, figured ask here. available or function have implement myself? thanks! based on code @ http://ruby-doc.org/core-2.0/array.html sample, chooses n random indices array, came following: import system.random import data.list import control.applicative sample1 xs = let l = length xs - 1 idx <- randomrio (0, l) return $ xs !! idx sample 0 xs = return [] sample n xs = let l = min n (length xs) val <- sample1 xs (:) <$> (pure val) <*> (sample (l-1) (delete val xs)) alternatively, use control.monad instead of control.applicative , liftm2 (:) (return val) (sample (ct-1) (delete val xs)) using delete incur eq constraint on type of list elements, though, h...

haskell - C Header Files and ABI -

i'd know how c header files , abis relate. sizes of various types architecture , compiler-dependent. how can 1 reliably link c library? for more specific problem: when using haskell's ffi, 1 uses haskell types cdouble define (duplicate definition of) c library interface. don't know binary type size information coming from. trick making linking work? please see link https://code.google.com/p/tabi it may avoid difficulties possible abi differences between haskell , c.

ios - trouble with UIAppearance and UIButton subclassing -

i have custom button, standard uibutton, cagradientlayer added in. in custom button, have defined 2 properties: @property (nonatomic, strong) uicolor* topcolor ui_appearance_selector; @property (nonatomic, strong) uicolor* bottomcolor ui_appearance_selector; if 2 values set, button draws nice linear gradient. works great. i put interfacebuilder possible. so, on of these buttons, in ib's "identity inpsector" add in "user defined runtime attributes" these properties. again, works great. next, thought i'd try using uiappearance proxies. of custom gradient buttons have same colors. there few different. so, figured use appearance-proxy stuff set default colors class, , buttons different, set values in intefacebuilder. fails. apparently, what's happening it's reading runtime attributes storyboard file first, afterwards values overwritten appearance proxy. wouldn't expect work way, does. any tips on how accomplish this? or should give ...

html - jquery scrollTop offset issue -

i trying build anchor link allows panel 2 slide cover panel 1, leave black header visible: http://jsfiddle.net/xmpu4/19/ i'm setting offset with: 'scrolltop': $target.offset().top - 140 it milisecond , jump top of page. how can set stops in right place? it works have written: $('html, body').stop().animate({ 'scrolltop': $target.offset().top - 140 }, 600, 'swing', function () { window.location.hash = target; }); the first part animates scrolling, , when finished, tell window jump specific hash. notice happens when click function has this: window.location.hash = target; remove callback function , prevent page jumping hash. on unrelated note, suggest don't use hard-coded values in animation function. try instead: 'scrolltop': $target.offset().top - $("#a").offset().top;

c# - How to catch new processes starting and stopping? -

this question has answer here: how detect process start & end using c# in windows? 1 answer .net process monitor 2 answers i wanted know if knows of way catch new applications starting or stopping on computer. instance, user logs in , opens word, outlook, or ie. want catch instance opening. have been working process. i building service runs in background , writes event log. public string applicationid() { process p = new process(); string application = p.processname.tostring(); return application; } i know foreach process list. pointers or samples great. once have process object, can add handler "exited" event detect when stops. note "enableraisingevents" property must set "true" work, can s...

iphone - Show UIAlertView during UIActivity:activityViewController -

i have set of uiactivities prepare data given format , attach email user can send. i'm using subclass of uiactivity , i'm doing work in -(void)activityviewcontroller : - (uiviewcontroller *)activityviewcontroller { [self.alert show]; nsstring *filename = [nsstring stringwithformat:@"%@.gpx", self.activity.title]; __block mfmailcomposeviewcontroller *mailcomposevc = [[mfmailcomposeviewcontroller alloc] init]; mailcomposevc.mailcomposedelegate = self; [mailcomposevc setsubject:[nsstring stringwithformat:@"gpx export %@ activity", self.activity.title]]; [mailcomposevc setmessagebody:@"generated slopes" ishtml:no]; dispatch_sync(dispatch_get_global_queue(dispatch_queue_priority_low, 0), ^{ cbcfileexporter *exporter = [[cbcfileexporter alloc] init]; nsdata *exportcontents = [exporter exportactivity:self.activity infileformat:cbcfileexporttypegpx error:nil]; [mailcomposevc addattachmentdata:expo...

javascript : send file to php script for user to download -

in website i'm building, i'm trying provide users ability export , download data in kml format. i've built php script generate kml file string. works reasonably well, until requests long , 414 errors. the thing is, i'm pretty sure i'm going @ wrong way (i'm new php). rather sending data string, can multiple tens of thousands of characters long, should sending file generated javascript php script send user or this. possible? if not, other options have? here's php script : if($_server['request_method']=='post') { $text = $_post['text']; $text = str_replace('\r\n', php_eol, $text); $text = str_replace('\n', php_eol, $text); $text = str_replace('\t', "\t", $text); $text = str_replace('_hash_', "#", $text); $filename = $_post['filename']; $tmpname = tempnam(sys_get_temp_dir(), $filename); $file = fopen($tmpname, 'w'); fwrite($file, $text); fclose($file)...

python - Trouble downloading most recent version of my package from pip -

i started out using pypi packaging of few tools useful in everyday life, i'm having trouble making sure can download recent version of package. the package in question pyfuzz , upgraded version 0.1.1 , reason when pip install it, --upgrade flag can pull down 0.1.0 . the file recognized on pypi site (see: https://pypi.python.org/pypi/pyfuzz/0.1.1 ) , if try upload again error saying i've uploaded 0.1.1. this setup file: try: setuptools import setup except importerror: distutils.core import setup setup( name="pyfuzz", version="0.1.1", author="slater victoroff", author_email="slater.r.victoroff@gmail.com", packages=["pyfuzz"], url="http://pypi.python.org/pypi/pyfuzz/", license="license.txt", description="simple fuzz testing unit tests, i18n, , security", long_description=open("readme.txt").read(), install_requires=[ "l...

excel vba - VBA: Selecting array which depends on variables for use in lookup formula -

i trying write vba code writes formula cell. formula hlookup array being fixed, on worksheet, , size depending on variables defined. here relevant part of code (the variables have been defined , integers): range("c2").select activecell.formula = "=hlookup(a2,visits!range("c2",cells(" & rowsforlook & ", " & rowsforauto & " + 1))," & rowsforlook & " - 1)" i have checked there no problems variables. have realised haven't $fixed array because not sure how this. think page reference "visits!" not correct, code did not select array without this. array trying use selected region appear if typed range("c2",cells(" & rowsforlook & ", " & rowsforauto & " + 1)).select thanks. to fix range suggest - instead of using range() method - build range in string. imagine want produce result looking like: "=hlookup(a2,visits!c2:d10...

haskell - What are Alternative's "some" and "many" useful for? -

alternative , extension of applicative , declares empty , <|> , these 2 functions: one or more: some :: f -> f [a] zero or more: many :: f -> f [a] if defined, some , many should least solutions of equations: some v = (:) <$> v <*> many v many v = v <|> pure [] i couldn't find instance some , many defined. what meaning , practical use? used @ all? i've been unable grasp purpose definition. update: i'm not asking alternative , some , many i tend see them in applicative parser combinator libraries. a :: parser [string] = (string "hello") and see many used purpose in default definitions of parsing in parsers . i think parsec being primary example of parser combinator library hides use of some / many since redefines things (<|>) .

Using an implemented ontology(Protege) in Netbeans through Java -

step 1 : have created ontology using protege. store rdf/xml file. step 2: have created user interface using netbeans & java. i want import ontology in netbeans project , interact it. how can that? suggested me should use jena. have installed latest jena version in netbeans project. im not sure if have done correctly. after adding jena libraries tried that: ont m = modelfactory.createontologymodel(ontmodelspec.owl_mem, null); and when try run program: log4j:warn no appenders found logger (com.hp.hpl.jena.util.filemanager). log4j:warn please initialize log4j system properly. log4j:warn see http://logging.apache.org/log4j/1.2/faq.html#noconfig more info. i have knowledge of java have im new ontologies , have never done before. please me understand im doing wrong or should make things right. thank you! that warning get, might missing log4j library in netbeans project. can download in link http://logging.apache.org/log4j/1.2/download.html , try add...

semantic web - RDF - Distributing rdf:type to all items in the list -

consider following rdf: semapi:baseclass rdfs:class; rdfs:subclassof rdfs:class . semapi:haschainto rdf:property; rdfs:domain semapi:baseclass; rdfs:range semapi:baseclass . semapi:derivedclass rdfs:class; rdfs:subclassof semapi:baseclass . instances:instance1 semapi:derivedclass; semapi:haschainto ( [ semapi:derivedclass; semapi:haschainto ( [c1] [c2] ) ] ) if semapi:haschainto rdfs:range semapi:baseclass implies the list rdf:type semapi:baseclass . what mean each item in list rdf:type (ei. [c1] rdf:type semapi:baseclass , [c2] rdf:type semapi:baseclass , ...) how can this? need owl (prefer...

c - override mkdir with LD_PRELOAD -

i'm trying modify syscall mkdir(), filter users don't want them create directories, maybe not elegant way it, want know why it's not working. the mkdir() replacement code is: #define _gnu_source #define maxgrupos 30 #define dim(x) (sizeof(x)/sizeof(x[0])) #define true 1 #define false 0 #include <stdio.h> #include <stdint.h> #include <stdlib.h> // //me permite llamar al metodo original #include <dlfcn.h> //codigos de error #include <errno.h> //mkdir() #include <sys/stat.h> #include <sys/types.h> //para obtener los usuarios #include <unistd.h> //parser de la config #include <libconfig.h> //##################################################### #define ruta_config "/etc/samba/gruposhabilitados.txt" //##################################################### int *obtenergruposvalidos(){ int indice = 1; int (*gruposvalidos) = malloc(sizeof (int) * maxgrupos); config_t cfg, *cf; ...

mysql - Avoid default activerecord primary index creation -

i trying workout how advise/tell activerecord not create it's primary index default. anyone know how can achieve ? class createhouse < activerecord::migration def change create_table :houses |table| table.string :name, :null => false, :unique => true table.integer :number, :null => false, :unique => true table.string :category, :null => false table.timestamps(:null => false) end add_index :houses, [:category, :number], :unique => true end end thanks you can add id: false create_table definition. try following: class createhouse < activerecord::migration def change create_table :houses, id: false |table| table.string :name, :null => false, :unique => true table.integer :number, :null => false, :unique => true table.string :category, :null => false table.timestamps(:null => false) end add_index :houses, [:category, :number], :unique => tr...

javascript - jQuery .html() anonymous function return oldHtml -

fiddle: http://jsfiddle.net/bplumb/znmf5/1/ this lack of understanding on part, trying run anonymous function .html() custom code , return old html string value variable. isn't returning html expect returning jquery object based on selector used. var oldhtml = $('#test').html(function(index, oldhtml){ //some custom code here return oldhtml; }); console.log(oldhtml); i thought return html way works in normal function call. var someotherhtml = getoldhtml(); console.log(someotherhtml); function getoldhtml(){ return $('#test').html(); } what not understanding jquery when comes this? $(...).html(function) returns original jquery object, not html in selected element. what return in function set new html of selected element. $(collection).html(function(){ return "i'm new html!"; }); // results in elements in collection receiving html ("i'm new html!") // equivalent to: // $(collection).html("i...

php - Efficiently change website body depending on day? -

so have website, , have txt file multiple lines date, text. can find how parse txt file text goes date, there way make instead of every person tries load page having server logic , find out text display, make first person per day make server find out text display server automatically displays rest of day? you can write results file, sort of cache system. $today = date('y-m-d'); $path = '/path/to/cache/'; $file = $path.$today; // cache file exist? if not, make if ( ! is_file($file)) { // parse text file, content, write file file_put_contents($file, $txt_content); } $content = file_get_contents($file);

Delete a mailitem permanently in outlook -

i'm trying delete mailitem using outlook api. following, dim objmail each objmail in objfolder.items objmail.delete next obviously, deleting item straight away simple. outlook move "deleted items" folder instead of deleting it. tried "deleted items" folder using outlooknamespace.getdefaultfolder(oldeleteditems) and delete mail again, pst code working on not default mailbox , folder returned wrong deleted items folder. how can permanently delete mailitem? i tried loop through folders in current store, there's no way of telling folder deleted items folder except comparing names, can't since programs used in multiple languages , name different each version. ps: cannot use third party dll :( help! first problem of code not appropriate loop use. if want delete (almost in vba) need loop collection last element first. if not, change order of collection- after delete 1st element >> 2nd 1 moved 1st position , not deleted. theref...

post - An error occured submitting the edit - SQL -

i getting errors trying answer question , posting sql query. the unhelpful error message is: error occured submitting edit here tried submit: select empname, phone, email employee emptype = 'pt' , salary between 30000 , 50000 order city, faculty, empid; why post here? did mark code {} (the 4 space indent). it seems error caused in text used describe query. had phrase 'select list' when reworded work. phrase works here - strange.

xml - selecting nodes based on the attribute value -

i have been struggling days determine how take xml file of game results (teams , final scores) , generate team standings list shows each team along how many times won, lost or tied based on game status(played). able display team standings on both game status(played , pending). want display team standings played only.any appreciated. here xml code: <schedule> <game status="played"> <home_team>a</home_team> <away_team>b</away_team> <date>2013-06-15</date> <home_team_score>3</home_team_score> <away_team_score>3</away_team_score> </game> <game status="played"> <home_team>a</home_team> <away_team>c</away_team> <date>2013-06-17</date> <home_team_score>7</home_team_score> <away_team_score>4</away_team_score> </game> <game status="pl...

php - Prepared statement & binding the results to array -

i'm trying fetch rows database , put them array can't work out! so fetch data so: if ($archiveinfo = $mysqli->prepare('select date,title blog')) { $archiveinfo->execute(); $archiveinfo->close(); } but not sure best code bind results array. i'm guessing 2 dimensional array i.e. $archiveinfo[0]['date'] how bind array , start echoing selected sections of array? if ($archiveinfo = $mysqli->prepare('select date,title blog')) { $archiveinfo->execute(); $archiveinfo->bind_result($date, $title); /* fetch values */ while ($archiveinfo->fetch()) { echo $date." ".$title; } $archiveinfo->close(); } you use http://php.net/manual/en/mysqli-result.fetch-array.php instead , loop through array..

c# - Is there a way to pass Smartscreen filter when creating an application with installshield limited? -

i have created application want run desktop version on windows 8. created installer installshield limited in visual studio. when try run exe on windows 8, smartscreen filter error. did research on it, , went through following links: digitally signing install shield installer microsoft smartscreen & extended validation (ev) code signing certificates now not sure whether buy standard code signing certificate or 1 extended validation. comparison can found here . buying standard certificate ensure pass smartscreen filter first time installer run on windows 8? if can tell me cheaper options pass filter, great help. tia. the ev certificate make sure users won't shown screen if have couple download/installs. if more people install application standard cert not shown users aswell.

database - Trying to verify person specific url then bring up login screen in Android -

i'm trying make application person connects specific website , can access data it. first page asks them put in url. parse , need verify url's existence can move them login screen. how go doing this? i'm trying httpurlconnections i'm not having luck. thoughts? try below code : try { int status = 0; try { httpurlconnection httpconnection = (httpurlconnection) new url( "http://www.google.com").openconnection(); httpconnection.setrequestmethod("head"); log.e("statuscode",httpconnection.getresponsecode()); if ((httpconnection.getresponsecode() == 200)||(httpconnection.getresponsecode() == 302)) { status = 1; } } catch (exception ex) {} if (status == 1) { log.e("website","found"); } else { log.e("website","notfound"); } } catch (exception ex1) { log.e("error...

python - Starpy connection randomly closing itself -

i have application uses newest version of starpy , works of time on machines being used, randomly stops on of them. what happens: factory stops ( stopping factory ) , error thrown. error given is: " sequence index must integer, not 'str' ", doens't seem code. error preceded following error: file "/usr/lib64/python2.6/logging/__init__.py", line 797, in emit [amiprotocol,client] stream.write(fs % msg) [amiprotocol,client] ioerror: [errno 5] input/output error the code randomly throws error in 1 of 2 following partial codes: notes: i'm using " @defer.inlinecallbacks " decorator , variable client contains connection. try: dndextensions = [] dnd = yield client.command ( 'database show dnd' ) extension in dnd: if 'dnd' in extension: dndextensions.append ( extension.split ( '/dnd/' )[1].split (' ')[0] ) except exception, e: # error ... try: lunchextensions ...