Posts

Showing posts from May, 2010

php - Cannot get POST variables -

i have php file posting variables same page not working. here snippet of page. <?php session_start(); require_once 'connect.php'; require_once 'protect.php'; //$_session['uid'] = 1; if(isset($_post['shout'])) echo 'posted'; if(isset($_post['submit'])) echo 'posted'; ?> <form method="post" action=""> <input type="text" name="shout"> <input type="text" name="name"> <input type="submit" value="shout!"> </form> <input name="submit" type="submit" value="shout!"> name attribute missing

javascript - JS: How to prevent losing session per refresh after logging in in SoundCloud API -

i'm making dashboard , pulling info soundcloud api. i'm relatively new api , got far being able pull soundcloud widget per track listed. problem everytime refresh, signed out (i think). there way session remain if user example refreshes page? have right now: function connecttosoundcloud(){ //intialize auth sc sc.initialize({ client_id: sc_client_id, redirect_uri: sc_redirect_uri }); //initiate auth popup sc.connect(function() { sc.get('/me', function(me) { if (me.username) { document.getelementbyid('btn-disconnectfromsoundcloud').style.display=""; document.getelementbyid('btn-connecttosoundcloud').style.display="none"; } $.ajax({ type: "get", url: "http://api.soundcloud.com/tracks.json?client_id="+sc_client_id+"", error: function(result, status){

java - Read value of outer class from inner class -

public class main { public static string s; string a="hello"; string b="world"; s=a+b; class demo{ string m; m=main.this.s; system.out.println(m); } } output should : hello world i here try understand main thing. main class android activity class extends listactivity , demo class extends asynctask. need read value static string s doinbackground method. an inner class can directly access variables without using object or class name. hence can directly refer outer class's variable without metioning name. instead of m=main.this.s; can directly access variable s m=s; its basic rule of object oriented programming inner class has full access of methods , variables of outter class.

jquery - html textarea replace br tag to \n -

i need edit row's cell in table using new lines characters. editation of these cells make textarea jquery. problem is, textarea using \n new line, html page using br tag. there code: $('#id_textarea').val(cell_string.replace(/<br>\*/gi,'\n')); i know, string has br tag likes ( note-1 ): <br></br> i tried: $('#id_textarea').val(cell_string.replace(/**<br></br>**\*/gi,'\n')); but still cannot understand, how regular expression works. and there picture of issue. note-1 - these br tags make by: content = content.replace(/\n/g, "<br>"); in db there is: <br> in firefox: <br></br> in chrome: <br> why? your regex not right, try: $('#id_textarea').val(cell_string.replace(/<br *\/?>/gi, '\n')); the demo.

iphone - Same facebook key for lite and pro apps -

i have lite , pro version of iphone app, lite app rejected appstore ,they cannot login through facebook. in development mode can able login both pro , lite version through fb. i have used same fb developer key both lite , pro. issue rejection? if need use different developer key lite , pro version of same app? thanks, please check so post . may you. urlschemesuffix string of lowercase letters appended base url scheme used sso. example, if facebook id "350685531728" , set urlschemesuffix "abcd", facebook app expect application bind following url scheme: "fb350685531728abcd". useful if have multiple ios applications share single facebook application id (for example, if have free , paid version on same app) , want use sso both apps. giving both apps different urlschemesuffix values allow facebook app disambiguate url schemes , redirect user correct app, if both free , app installed on device. urlschemesuffix supported on version 3.4.

asp.net - Access files/ folders remotely by authentication via browser/ web -

we have requirements want allow our clients/ users download files/ folders our file server via browser/ web. we have many different directories created on our file server mapped different clients. means that, every client has own directory on our server. have main (root) directory every single client/user. means that, every client’s files/folder created under respective main directory. the thing need sure is, whenever our client make request access/ download file, first need validate credential (username/password stored in our sql server db) , need allow folder mapped specific folder. (the folder mapping again stored in our sql server db) which means that, after applying credential user/clients, can access directory/ files. cannot access other’s files/ directory. would please let me know how achieve this? suggestions appreciated highly. thanks in advance. since different users need authorized access different directories, cannot expose files directly on web. bu

c# - Why a unique synchronization context for each Dispatcher.BeginInvoke callback? -

i've noticed .net 4.5 each dispatcher.begininvoke / invokeasync callback executed on own unique synchronization context (an instance of dispatchersynchronizationcontext ). what's reason behind change? the following trivial wpf app illustrates this: using system; using system.diagnostics; using system.threading; using system.windows; using system.windows.threading; namespace wpfapplication { public partial class mainwindow : window { public mainwindow() { initializecomponent(); action test = null; var = 0; test = () => { var sc = synchronizationcontext.current; dispatcher.currentdispatcher.invokeasync(() => { debug.print("same context #" + + ": " + (sc == synchronizationcontext.current)); if ( < 10 ) {

utf 8 - W3C unable to validate -

sorry, unable validate document because on line 1200 contained 1 or more bytes cannot interpret utf-8 (in other words, bytes found not valid values in specified character encoding). please check both content of file , character encoding indication. the error was: utf8 "\xd8" not map unicode thankful know should do, website : http://dailysahara.com/ the issue, stated validator, have invalid utf-8 in document. appears in box on left of site 4 tabs "tags", "comments", "recents", , "popular". shows me black square this: �. if remove that, should able validate site.

jquery - How avoid style inheritance -

am using jquery. every page having tables.for table have default style particular page. every tr having child table. child tables not need parent table style informations. how prevent child table parent table style inheritance property.please if have solution. in advance. you use direct child selector separate tables: .somecontainer > table{ /* match parent tables */ } table table { /* match tables within table */ }

javascript - How to Calculate OffsetLeft from parent excluding parent's left padding & border -

is there easy way calculate offsetleft direct parent, excluding padding , border width of parent? when this, returned value includes left border , padding width of parent. child.offsetleft - parent.offsetleft jsfiddle i know can subtract left border+padding width of parent, means must use getcomputedstyle retrieve values, strip 'px' , convert int, subtract... isn't there better? look commented. wrote offsetleft property of each element doesnt not include border of offsetparent 2 exceptions wrote, here offsetparent document.body each element. calculation goes child.offsetleft - parent.offsetleft - parent.clientleft - parseint(getcomputedstyle(parent).paddingleft) because difference of 2 offsetleft properties including parent border.

c# - How I get the index of a DataTable Row with two calues of two other Column Values? -

to application: i have 2 datatables , want filter out first datatable second. columns user , modul first datatable , if not exist in second add new row. this structure second datatable: user | modul | time | department | status and want check 2 columns (user , modul) whether row values in second datatable exist. if entry exist need row index. how can linq? name of second datatable analyse_table. here code: private static datatable filterdatatable(datatable nofilter_datatable) { datatable analyse_table = new datatable("filter_analyse"); datacolumn user = new datacolumn("user", typeof(string)); datacolumn modul = new datacolumn("modul", typeof(string)); datacolumn time = new datacolumn("time", typeof(string)); datacolumn department = new datacolumn("department", typeof(string)); datacolumn status = new datacolumn("status", typeof

android - PopupWindow on CustomDialog -

i've 1 customdialog(it implemented in other package),like below customdialog = new customizedialog(this); customdialog.setcontentview(r.layout.student_register_form); and in customdialog have 1 button, when click on , popupwindow display countrypopupwindow = new listviewpopupwindow(context, r.layout.grade_popup_layout, values, ids, "country"); this custructor,and implemented every thing,i got popup window displaying on mainactivity,not on customdialog

How to parse xml by xmltable when using namespace in xml(Oracle) -

i want parse xml string web service response sent servier, xml looks this: <?xml version="1.0" encoding="utf-8"?> <soap:envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema"> <soap:body> <addresponse xmlns="http://tempuri.org/"> <addresult>20</addresult> </addresponse> </soap:body> </soap:envelope> i want value 20 between elements addresult. plsql code segment looks following: declare v_xml clob; begin v_xml := '<?xml version="1.0" encoding="utf-8"?> <soap:envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema"> <soap:body> &l

HAProxy: Backend with subdirectory / subpath / subfolder? -

i trying achieve this: http://front-end --> http://back-end/app-1 http://front-end/app-2 --> http://back-end/app-2-another-path so requests handled way: http://front-end/do-this --> http://back-end/app-1/do-this http://front-end/app-2/do-that --> http://back-end/app-2-another-path/do-that how can this? thank you. you can achieve "http://front-end/app-2/do-that --> http://back-end/app-2-another-path/do-that" following configuration: frontend http #match url ending /xxxxx/do-that acl do-that path_end -i /app-2/do-that use_backend server1 if do-that backend server1 reqirep ^([^\ :]*)\ /app-2/(.*) \1\ /app-2-another-path/\2 server server 168.192.x.x here more information on reqirep .

php - Best way to show number of results in a filter using Ajax -

first, quick explanation of current situation: my webpage contains list of (about 40, categorized) filters , list of 400+ products. i list of products using ajax. default 20 products shown, when scroll bottom more products added. users can filter results clicking desired option. it's simplified ebay . difference don't reload page when click on filter, instead use ajax products. now, ebay has these numbers next every filter option, shows amount of results you'd if click option. question is, what best way show these numbers? my approach run sql query ( select count(id) sometable filter='something' ) every filter option. means have run 40 queries on load, , every time user clicks option (using ajax). seems heavy server load, or wrong? i'm going first approach, i'm using union queries counts. way have run 1 query instead of 1 query every filter.

json - How to search all levels nested Javascript object -

i have javascript object represents nested json string this: http://pastebin.com/vwzb1xra there many levels contain "name" element. example "svi" or "population" or "human development index". i trying find way iterate on every level of object find name "svi" or "population" or "human development index". when match made want replace weight value this: if (data[key].name == name) { data[key].weight = 55; } you can recursively check each , every object, this function rec(currentobject, values, replacement) { if (values.some(function(currentvalue) { return currentobject.name === currentvalue; })) { currentobject.weight = replacement; } (currentobject.children || []).foreach(function(currentitem) { rec(currentitem, values, replacement); }); } rec(data, ["svi", "population", "human development index"], 55); console.log(dat

dll - Import library creation, C++/VisualStudio2013 -

i create set of c++ dlls , import libraries in visualstudio (2013). far, these generated @ same time linker. dlls use symbols other libraries, included additional dependencies in properties/link edition. sometimes, dll generation fails because of missing importation libraries, fine me, in such case there's no generated .lib file either. generate import libs (of dlls) if dlls cannot done, in order allow other projects rely on symbols shall export before i'm able provide whole stuff. i found workaround through pre-link event command line, with: lib /def:(...)\mylib.def /out:(...)\mylib.lib $(intdir)*.obj this generates need, when have .def file. the problem is, don't have such .def file rely on __declspec(dllexport) instructions instead, , in such case didn't find way correct result. i tried: lib /out:(...)\mylib.lib $(intdir)*.obj (#1) creates (static ?) lib file, not import library, not need. lib /def /out:(...)\mylib.lib $(intdir)*.obj (#2)

What is wrong with this ANTLR Grammar? Conditional statement nested parenthesis -

Image
i've been tasked writing prototype of team's dsl in java, thought try out using antlr. i'm having problems 'expression' , 'condition' rules. the dsl defined keep close current spec possible. grammar mydsl; // snippet of whole language, should give // decent view of issue. entry : condition eof ; condition : lparen condition rparen | atomic_condition | not condition | condition , condition | condition or condition ; atomic_condition : expression compare_operator expression | expression (is null | not null) | identifier | boolean ; compare_operator : equals | nequals | gt | lt | gtequals | ltequals ; expression : lparen expression rparen | atomic_expression | prefix expression | expression (multiply | divide) expression | expression (add | subtract) expression | expression concatenate expression ; atomic_expression : substr lparen expression

javascript - How to put json inner object into another same type of json object -

i have json object below. var obj = { "_id": "mand-configurations", "server-host": "0.0.0.0", "server-port": [1890, 1770, 2070], "server-rest-api-timeout-in-millis": 3020, "server-started": "server started successfuly", "stopped-snmp": "server shutdown", "connection-failed": "connection pgw-server failed", "request-time-out": "pgw-server request time out", "notify-connection-failed-snmp": "connection notification-server failed", "subscription": { "control-data": [ "app", "sp" ], "callback-url": "http://core.sdp:19980/notify", "post-notification": true }, "charging-start-time": "01:00", "charging-schedulers": [

ios - AVAudioPlayer crashes on play -

working on audio first time. may missing please guide i have added avfoundation framework. added #import and added in viewdidload. nsstring* docpath = [nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes) lastobject]; nsstring* audiopath = [docpath stringbyappendingpathcomponent:@"001.mp3"]; bool fileexists = [[nsfilemanager defaultmanager] fileexistsatpath:audiopath]; if (!fileexists) { nslog(@"audio file not exist!"); }else{ nserror *error; nsurl *url = [[nsurl alloc] initfileurlwithpath:audiopath]; nsdata *audiodata = [nsdata datawithcontentsofurl:url]; self.audioplayer = [avaudioplayer alloc]; // crashes @ line self.audioplayer = [self.audioplayer initwithdata:audiodata error:&error]; nslog(@"%@",self.audioplayer); } i using generic breakpoint exception. player making crash because of break point no details. removed breakpoint , worked fine. thank guys.

c++ - Check for null in std::shared_ptr -

i wondering if need check whether sp null before use it. correct me if wrong creating alias not increase ref counter , therefore entering method working shared pointer don't know if embedded pointer has been reset before.. correct assuming this? class::myfunction(std::shared_ptr<foo> &sp) { ... sp->do_something(); ... } most shared pointers normal pointers in respect. have check null. depending on function, may want switch using void myfunction( foo const& foo ); , , calling dereferencing pointer (which pushes responsibility ensuring pointer not null caller). also, it's bad practice make function take shared pointer unless there special ownership semantics involved. if function going use pointer duration of function, neither changing or taking ownership, raw pointer more appropriate, since imposes less constraints on caller. (but depends lot on function does, , why using shared pointers. , of course, fact you&#

html5 - Bootstrap form not working in Firefox -

i have found out forms on these pages not working. http://www.abado.dk/modtag-tre-tilbud/ http://www.abado.dk/kontakt/ http://www.abado.dk/bliv-partner/ i don't have idea wrong. can me? the issue on padding: 25px 15px; in .form-control you in put height 34px @ same time using padding-top( 25px ) + padding-bottom( 25px ) = 50px in 34px add in css properties .form-control{ height: auto; } or adjust padding value

php - Regex replace word while keeping capitalisation -

i'm trying create regular expression replace word. instance, want replace word "dog" "cat". don't want replace dogmatic or robodog. i'm using now: <?php $str = preg_replace("/dog\w/", "cat", $str); ?> but have multiple problems it. one, if use "i" note don't care capitalisation, replacement string doesn't use same capitalisation. furthermore, "the dog eats" becomes "the cateats" (without space). can me reliable solution replace words, including following cases: "dog" -> "cat" "a dog, sheep" -> "a cat, sheep" "my dog" -> "my cat" , dog becoming cat, etc the easiest way create 2 regular expressions , pass them array preg_replace : preg_replace(array("/\bdog\b/", "/\bdog\b/"), array("cat", "cat"), "dog eats dog"); returns: "cat eats

CSS animation not working when classname is applied in Safari -

if view codepen demo in chrome , scrolldown should see piechart animation kick in when comes view. yet in safari version 7.0.2 (9537.74.9) doesn't. ideas why isn't working in safari? http://codepen.io/s10wen/pen/czdbu this safari rendering bug triggered backface-visibility: hidden on .pie-chart > :last-child em . line doesn't appear necessary, works fine without it. this example doesn't have bug: http://codepen.io/anon/pen/ktkmu . i discovered removing bits of css & javascript until bug no longer happened, revealing single line causing it. reduction ftw!

java - -XX:+UseCompressedOops does not work in Eclipse -

my java (64bit) version information below: d:\workspace\s3-jerome\voice\nlp>java -version java version "1.7.0_09" java(tm) se runtime environment (build 1.7.0_09-b05) java hotspot(tm) 64-bit server vm (build 23.5-b02, mixed mode) my application has lot of instances, therefore consumes plenty of memory if each reference occupies 8 bytes. want use -xx:+usecompressedoops force jvm compress oop. in eclipse, have added -xx:+usecompressedoops in vm arguments in run configuration. but when profile program visualvm 1.3.7, still result size of each reference 8 bytes. instance size of following class still 32! public class aclinkedlist<e> { private e element; private aclinkedlist<e> next; public aclinkedlist(e element) { this.element = element; next = null; }; ....... } anybody knows problem? usecompressedoops enabled default on hotspot 7 when appropriate (heap size not large). jvisualvm not take setting acco

Loop for cleaning NAs in R -

is there way write code more effectively? for (k in 1:ncol(tr)){ temp=tr[[k]] temp[is.na(temp)] = mean(temp[!is.na(temp)]) tr[[k]]=temp } to replace loop matrices or dataframes, apply is idea: apply(tr, 1, function(temp) {temp[is.na(temp)] <- mean(temp, na.rm=true); temp}) more information apply -like functions here .

OCaml - Reverse a list -

i'm trying implement own list module follows : type 'a my_list = | item of ('a * 'a my_list) | empty i've implemented several functions , trying create list reversing function module : let rec rev = function | empty -> (*return reversed list*) | item(i, remnant) -> (*recursive call rev*) moreover, i'm not supposed use list operators such '::', '[]' , '@'. edit, tried : let rec rev_append l1 l2 = match l1 | empty -> l2 | item(i, remnant) -> rev_append remnant item(i, l2) let rev l = rev_append l empty;; but not working, there error @ second argument passed recursive call : "item(i, l2)" error "the constructor item expects 1 argument, here applied 0 arguments". parenthesis man ! let rec rev_append l1 l2 = match l1 | empty -> l2 | item(i, remnant) -> rev_append remnant (item (i, l2)) the compiler unders

Javascript Regex IE8 issue -

i have div defined below: <div id="bookmark_error" class="text-error">character '' not allowed in bookmark name.</div> by default hidden defined below: $("#bookmark_error").hide(); some of characters not allowed while saving bookmark on page e.g. < , > here validation check performed @ time of bookmark save: ... var bookmark_name = $("#bookmarks-form").find('input[type=text]').val(); var skipchars = ["<", ">", "&lt;", "&gt;", "&lt", "&gt", "&#60;", "&#62;", "&#60", "&#62"]; (var i=0; < skipchars.length; i++){ var skipchar = skipchars[i]; while(bookmark_name.indexof(skipchar) != -1){ $("#bookmark_error").html($("#bookmark_error").html().replace(/'[^]*'/g

c# - How to define element in the XML, without creating unnessecery class -

i want users write xml one: <root> <param> <int>134</int> </param> </root> or one: <root> <param> <string>134</string> </param> </root> and, want auto-generated c# code of xsd (i use xsd.exe) not generate new class param, use object . first try now, when write xsd, i've started markup: <?xml version="1.0" encoding="utf-8" ?> <xs:schema xmlns:xs="http://www.w3.org/2001/xmlschema"> <xs:element name="root"> <xs:complextype> <xs:sequence> <xs:choice> <xs:element name="int" type="xs:int"/> <xs:element name="string" type="xs:string"/> </xs:choice> </xs:sequence> </xs:complextype> </xs:element> </xs

java - Refresh/Update highlighter in JTable when changing search values -

Image
how can refresh highlighter in jtable after changing search value in jtextfield? works fine jtextarea under jtextfield, jtable won't refresh highlighter. suggestions?? this code: import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.table.*; import javax.swing.text.*; import javax.swing.text.defaulthighlighter.defaulthighlightpainter; public class beispieltabelle { jtextfield field; jtextarea textfeld = new jtextarea("hello world!"); string input="stefan"; //titel der tabelle string[] title = {"eins", "zwei", "drei"}; //tabellendaten object[][] playerdata = { {"34", "stefan", "mein name ist stefan"}, {"32", "dirk", "ich bin der dirk"}, {"99", "patrick", "ich heisse patrick"}, {"100", "anna", "ich bin die anna"},}; //tablemodel defaulttablemodel model = new default

twitter bootstrap popover on ajax loaded content -

i trying assign popover twitter bootstrap element wich loaded via ajax , have this: $(document).on("click", ".checkrezolvatatrecut", function(event){ switch(datachecktrecut[1]) { case '02': var luna = "februarie"; break; } $(".checkrezolvatatrecut").popover({ placement: "top", content: "<button class='btn btn-default mutatrecut' style='width: 100px;'>" + luna + "</button><button class='btn btn-default mutacurent' style='width: 100px;'>luna curenta</button>", html: true }); }); the problem on first click nothing happens. after first click works. mention, didnt understood bootstrap js well. ideas ? thanks! it's normal on first click nothing happens, because it's on first click setting popover, once set (in

java - why sonar:sonar needs mvn install before? -

official documentation http://docs.sonarqube.org/display/sonar/analyzing+with+maven says proper way of invoking sonar is: mvn clean install -dskiptests=true mvn sonar:sonar but doesn't why. how sonar work? need compiled classes? why not mvn clean compile ? or need jar file? why not mvn clean package ? sonar plugin? you can run sonarqube part of single maven command if meet requirements: as mithfindel mentions, sonarqube plugins need analyze .class files. , if run unit tests outside of sonarqube, of course testing plugins must read output test phase. got integration tests? need run after integration-test phase. if want run sonarqube true quality gate absolutely must run before deploy phase. one solution attach sonarqube run after package phase. can full build simple clean install or clean deploy . people not because sonarqube time-consuming, incremental mode added in 4.0 , improved in upcoming 4.2 solves this. as far official documentation goes, it&#

Google chart: Add style to axis's title individually -

Image
i have gantt chart created stacked bar chart. trying make h-axis titles different each others, in image below. i've api , not find solution. does know how accomplish this? individual styling not supported google api. if can handle risk of future code break can 'manually' change text properties. as example used simple example google docs , change stacked bar chart. the following elements created in dom labels on left (2004 - 2007): <g> <text text-anchor="end" x="147" y="139.9" font-family="arial" font-size="14" stroke="none" stroke-width="0" fill="#222222">2004</text> </g> <g> <text text-anchor="end" x="147" y="216.9" font-family="arial" font-size="14" stroke="none" stroke-width="0" fill="#222222">2005</text> </g> <g> <text te

java - Comparing SQL Dates from various components -

i have created java swing interface has 4 components spinner (jxdatepicker) //get date in format yyyy-mm-dd spinner_1 (jtimechooser) //get time in format 00-00-00 spinner_2 (jxdatepicker) //get date in format yyyy-mm-dd spinner_3 (jtimechooser) //get time in format 00-00-00 all final dates must sql date , sql time , not java.util i trying create 2 different dates: starting date , ending date here code: calendar startingdate = calendar.getinstance(); startingdate.settime(spinner.getdate()); //this deprecated //date dt = new date(spinner.getdate().gettime()); //dt.gethours(); //dt.getminutes(); //dt.getseconds(); calendar startingdatetime = calendar.getinstance(); //this example not point right year,month , day startingdate.set(startingdate.year, startingdate.month, startingdate.day_of_month, spinner_1.gethours(), spinner_1.getminutes(), spinner_1.ge

Implement SMS sending functionality in ASP.NET C# web application -

i have requirement send sms users asp.net web application. first want know whether any free service available this? when googled got lots of links (even stackoverflow) related sending sms via way2sms.com 160by2 , such sort of things unfortunately not single thing worked. tried smsclient.dll , ended same story again. i reliable reply has implemented same , how done since have spend lot of time googling , trying sample codes got internet. i had implemented project sms text generated after user selects text , forwarded mobile numbers fetched database. the sms gateway provider gave url in sms text , mobile numbers embedded parameter values , below string url =@"http://10.10.10.10/id=ourid&password=xyz&message="+smstext+"&mobilenum="+num[i]; this string string contained url called using webclient class using (webclient client = new webclient()) { client.downloadstring(url); }

xpath - Selenium returns "Element text does not match" even if it does match -

i have been using selenium builder create few front end user tests , have come across issue verifytext, cannot resolve. on checking element below string found close added item(s) i expected find recently added item(s) i confirmed x-path have passed defiantly correct using firefinder. selenium builder seems ignoring <span> tag in case. test changed string looking to close added item(s) and same message returned saying elements text "close added item(s)" not match "close added item(s)". <div id="topcartcontent" class="block-content" style="overflow: visible;"> <div class="inner-wrapper" style=""> <p class="block-subtitle"> <span class="close-btn" onclick="topcart.hidecart()">close</span> added item(s) </p> <p class="cart-empty"> have no items

asp.net mvc - How to maintain devexpress gridview data for each call back function without using static variable -

i have written following code datagrid. controller: public class employeecontroller : basecontroller { public static list<employeemodel> employees { get; set; } public actionresult employeesearchpartial() { return partialview("employeesearchpartial", employees); } } employeesearch partial view @html.devexpress().gridview( settings => { settings.name = "gvemployeesearch"; settings.keyfieldname = "employeeid"; settings.settingspopup.editform.width = 600; settings.callbackroutevalues = new { controller = "employee", action = "employeesearchpartial" }; settings.width = 720; settings.height = 600; settings.settingspager.pagesize = 15; settings.settings.verticalscrollbarstyle = devexpress.web.aspxgridview.gridviewverticalscrollbarstyle.standard; settings.settings.verticalscrollableheight = 350; settings.controlstyle.paddings.padding = system.web.ui.webcon

android - Ship an application with a database -

if application requires database , comes built in data, best way ship application? should i: precreate sqlite database , include in .apk ? include sql commands application , have create database , insert data on first use? the drawbacks see are: possible sqlite version mismatches might cause problems , don't know database should go , how access it. it may take long time create , populate database on device. any suggestions? pointers documentation regarding issues appreciated. i found way in reigndesign blog in article titled using own sqlite database in android applications . precreate database, put in assets directory in apk, , on first use copy "/data/data/your_package/databases/" directory.

php - redirection to another page if array does not match -

have built login system, can assign permissions user lets them access page or not, works fine. if user logged in , has permission shows content , if not logged in redirects login page. i trying add redirect in if logged in no have permission takes page has information on product. i have set : <?php if (!securepage($_server['php_self'])){die();} $parts = parse_url($_server["request_uri"]); $page_name = basename($parts['path']); //links logged in user if(isuserloggedin()) { //links permission level 3 (bof) if ($loggedinuser->checkpermission(array(3))){ *do something* (more code) <div id='default'> <?php } else { ?> *login* i know going through , "if permission not this" have on 20 permissions , climbing. trying like: if ($loggedinuser <> 3){ header( 'location: http://www.yoursite.com/new_page.html' ) ; } however parses displ

excel - VBA slow allocation in long amount of data -

i'm trying develop vba macro excel find value (one o more occurrences) in quite large amount of data , copy value set of data. code is: sub filaspallet() dim k long worksheets("datos").range("e:f").clearcontents application.screenupdating = false application.calculation = xlcalculationmanual k = 3 worksheets("datos").range("l:l") while (k < (worksheets.count - 1) * 28 * 25) set c = .find(worksheets("datos").cells(k, 3).value, searchdirection:=xlnext, searchorder:=xlbycolumns, lookin:=xlvalues, lookat:=xlwhole) if not c nothing firstaddress = c.address oldpcount = 0 pcount = c.offset(0, 5).value d1 = k + oldpcount d2 = k + oldpcount + pcount - 1 worksheets("datos").range("e" & d1 & ":e" & d2).value = c.offset(0, 3).value worksheets("datos").range(&q

ios - View Controller With two different XIB's..Tricky -

i have tricky question here..please help.. i have 1 viewcontroller called "demoviewcontroller" 2 different xib's (demo1controller.xib & demo2controller.xib) linked demoviewcontroller, load xib based upon condition.. i have navigation controller implemented in appdelegate, pushing view controller(demoviewcontroller) xib demo1controller, when user taps button in demo1controller, need load same viewcontroller i.e, demoviewcontroller xib demo2controller.. can possible?? or need maintain different classes 2 xib's let me know if have questions... as viewcontroller object other object can stack many of them need on top of each other. creating many instances of object want. when instantiate them can do: uiviewcontroller *viewcontroller = [[demoviewcontroller alloc] initwithnibname:@"demo1controller" bundle:nil]; or uiviewcontroller *viewcontroller = [[demoviewcontroller alloc] initwithnibname:@"demo2controller" bundle:n

javascript - Add / show different divs' content according to a defined timing -

good morning everybody. i built grid wordpress template should work way: fade in div#1's content, show time, fade out content; fade in div#2's content (a slider), start slider, show slides, when finishes loop fade out content; fade in div#3's content, show time, fade out content; fade in div#4's content, show time, fade out content; start loop again step 1. i managed achieve result can see here , it's difficult match correct timing each fade in / fade out, and slider's behaviour isn't need . here html structure: <div class="entry-content"> <section id="home_first_box" class="sec_double first"> <span>some content</span> </section> <section class="sec_single"></section> <section id="home_box_3" class="sec_single last"> <img> </section> <section id="home_box_4" class="sec_single first">

c# - Why is the return type IdentityUser and not ApplicationUser? -

Image
i have class public class applicationuser : identityuser { public string email { get; set; } public string confirmationtoken { get; set; } public bool isconfirmed { get; set; } ... } and in dbcontext class i've done public partial class pickerdbcontext : identitydbcontext { public pickerdbcontext():base("defaultconnection") { } protected override void onmodelcreating(dbmodelbuilder modelbuilder) { base.onmodelcreating(modelbuilder); modelbuilder.entity<applicationuser>().totable("users"); modelbuilder.entity<identityuser>().totable("users"); modelbuilder.entity<identityrole>().totable("roles"); } //public dbset<license> licenses { get; set; } .... } now when try query users table in repository like var user = _db.users.singleordefault(u=>u.anyfield); i think has return type identityuser , not applicationuser because when

string - What does ?/ mean in Ruby? -

this question has answer here: what unary question mark (?) operator do? 3 answers i stumbled across piece of code: if source[0] != ?/ source = compute_asset_path(source, options) end what's " ?/ "? i've never seen writing strings way. $ irb 2.0.0p247 :001 > ?/ => "/" apparently works single characters only: 2.0.0p247 :001 > ?a => "a" 2.0.0p247 :002 > ?foo syntaxerror: (irb):2: syntax error, unexpected '?' what ? mean? ? used represent single character string literals. ?a , ?b not ?ab . to answer comment of op : yes, are. irb(main):001:0> ?x + 'y' => "xy" irb(main):002:0> 'x' + 'y' => "xy"

When should I use `sudo` for `npm install -g cordova`? -

i'm looking through phonegap / cordova cli documentation http://docs.phonegap.com/en/3.4.0/guide_cli_index.md.html#the%20command-line%20interface , recommends installing cordova cli sudo $ sudo npm install -g cordova however linux co-workers have kicked *ss using sudo willy nilly, need when installing package or able continue normal cordova cli use without it? thanks, danc the cordova package meant used command line utility, rather module require('cordova') in other node.js code. -g (or global install) option install cordova module @ location specified npm's prefix config setting : the prefix config defaults location node installed. on systems, /usr/local you can view current value of setting npm config prefix . typically, using global install option add shell scripts global module, cordova script, location visible shell's search $path . enables execute commands cordova create foo without specifying path cordova shell script.

.htaccess - how to put php files out of webroot -

how can know web root folder ? , how put folders out of web root folder? , how test not accessible outside ? the structure of hosting this: www.website.com : public_html/ includes / logs/ ... is enough protect includes folder , logs folder htaccess? , out of web root in case? i know $server[document root] provide root of website , confused how put files out of , welcome , all all files in public web root folder. the 'inside' of root publichtml/ . place in there publicly accessible. name of root can vary host host, public_html or httpdocs . the 'outside' 1 directory up. remember hosts not give enough permissions. you cannot test documents outside root, because not accessible. php can access files. that's why not place img/js/css files outside root cause need direct access. can serve them through php.

java - Unmarshal NullPointerException (with JAXB reference implementation) -

i'm trying unmarshall xml file, strange npe depths of jaxb library. you, please, me solve problem? here's exception stacktrace's top: java.lang.nullpointerexception @ com.sun.xml.bind.v2.runtime.unmarshaller.loader.reporterror(loader.java:258) @ com.sun.xml.bind.v2.runtime.unmarshaller.loader.handlegenericexception(loader.java:245) @ com.sun.xml.bind.v2.runtime.unmarshaller.scope.add(scope.java:123) @ com.sun.xml.bind.v2.runtime.property.arrayerproperty$receiverimpl.receive(arrayerproperty.java:213) @ com.sun.xml.bind.v2.runtime.unmarshaller.unmarshallingcontext.endelement(unmarshallingcontext.java:538) here's xml classes code: public class base { public base() { } } public class extends base { public a() { } } public class b extends base{ public b() { } } @xmlrootelement(name = "test") @xmlaccessortype public class testxml { @xmlelementwrapper(name = "list") @xmlanyelement @xmljavatypeadapter(adap

Git: Reverting a git reset --hard -

just ran git reset --h accident. had lots of modified files, , few new files. previous reset, hadn't created commit, can't in reflog , revert commit. tell me there's way can these files back?! :( no, cannot modifications back. the exception if had stashed , unstashed them, in case read how recover dropped stash in git? .

java - Different Encoders Provided Different Encoded Values -

pardon me! weak in java. i referring stackoverflow post: digital signature creation , verification . added base64 encoders of bouncy castle , apache. return differemt strings ([b@a470b8,[b@1e4457d,[b@10b4b2f, [b@750159..). "sun.misc.base64encoder" returns encoded. but, restricted. please advise how use bouncy castle base64 or apache bas64 classes. in advance! my code , results follows: package abc; import java.io.fileinputstream;<br> import java.security.key;<br> import java.security.keystore;<br> import java.security.privatekey;<br> import java.security.security;<br> import java.security.signature;<br> import java.security.cert.x509certificate;<br> import java.util.arraylist;<br> import java.util.list;<br> import org.apache.pdfbox.pdfwriter.coswriter;<br> import org.bouncycastle.cert.jcajce.jcacertstore;<br> import org.bouncycastle.cms.cmsprocessablebytearray;<br> import org.bouncycastle.cms.