Posts

Showing posts from April, 2013

How to detect a smartphone through JavaScript/CSS? -

i've seen around web best way make responsive design use css @media queries. not seem practical solution many phones identify screen , have many pixels desktop monitors (i.e. iphone 6 plus 1080x1920 , android phones have larger sizes). if said min-width: 800px; desktop design, many smartphones use rules. one workaround use navigator.useragent in javascript detect mobile devices, i've heard not compatible. is there 'best' way determine if user on mobile device (preferably javascript or css)? if add code page head , width of viewport won't the actual number of pixels, instead compareable pixel density of 96dpi: <meta name="viewport" content="width=device-width"/> this results css width of 320 pixels on smartphones though actual resolutions higher.

ios - Is there a CocoaPods Library for Parse? -

i downloaded open source project via cocoapods modifying , i'm trying add parse framework seems can not access framework within open source file located in pods directory. have included parse framework in own project directory can access parse framework within files located in project directory there's error when try access within open source file...so wondering if there cocoapods version of parse. i typed in parse in cocoapods search website can find parseui. i don't know why don't see listed, do: pod 'parse'

php - Codeigniter redirect non-www to www preventing form submission -

issue codeigniter redirection in .htaccess file. redirection code below: rewriteengine on rewritecond %{http_host} . rewritecond %{http_host} !^www\.domainname\.net [nc] rewriterule ^(.*) http://www.domainname.net/$1 [r=301,nc,l] rewritecond %{request_uri} ^/system.* rewriterule ^(.*)$ index.php?/$1 [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.+)$ index.php?/$1 [l] this seems work correctly noticed forms submission stopped working because of redirection. ideas please? use #redirect www rewriteengine on rewritecond %{http_host} ^[^.]+\.[^.]+$ rewritecond %{https}s ^on(s)| rewriterule ^ http%1://www.%{http_host}%{request_uri} [l,r=301]

how to access json array of objects using foreach loop in javascript and jade -

i using foreach loop show data of jason array take 5 iterations show data want show data in single iteration. how can so? here jade file code. each item in data td a.three(href='') |#{item} in first iteration item contains :"youtube#searchlistresponse". in second iteration item contains : " \"bdc7vthym9nfosqm1_koyhtjtew/0mx1aovxl6jrpz_tgqxlq_yhgwi\"". in third iteration item contains :"caiqaa". i want access id or thumbnail in first iteration returns error. how can access in first iteration using above jade code? possible or not? here link of jason array ( https://gist.github.com/paulomcnally/620b76a9afe81f56e8c9 ) you have parse array first using json.parse(json["items"]) access data if want specific index json_array[0]["id"] or json_array[0]["snippet"]["thumbnails"]

c - Is writing 3 instructions separated by comma `,` undefined behaviour? -

i think saw somewhere writing more 1 instruction separated comma , undefined behavior. so following code generate undefined behavior? for (i=0, j=3, k=1; i<3 && j<9 && k<5; i++, j++, k++) { printf("%d %d %d\n", i, j, k); } because there 3 instructions separated comma , : i++, j++, k++ writing more 1 instruction separated comma , undefined behaviour. nope, it's not general case. in case, i++, j++, k++ valid. fwiw, per c11 , chapter §6.5.17, comma operator (emphasis mine) the left operand of comma operator evaluated void expression; there sequence point between evaluation , of right operand. right operand evaluated; [...] [note]: might have got confused seeing along line of printf("%d %d %d", i++, ++i, i); kind of statement, note, there , not comma operator altogether (rather, separator supplied arguments) , sequencing not happen. so, kind of statements are ub. again, referri...

translation - Magento 1.9.1.0 - Can't find sign in (log in) text in language files -

i translating magento 1.9.1.0 not able find log in text in language files located @ app/locale/nl_nl same goes "zip/postal code" have used notepad++ search on files, no hits. has translation downloaded or there other way change text? thanks! this translate located in db. can translate them enabling "translate inline" via admin end: system -> developer -> translate inline (for desire store). when enabled them, can add translate via site user end (click on book @ text). if don't see book - clean cache. after changed - clean cache.

android - avoid a replaced fragment from calling the previous when screen is rotated -

hey guys im trying make activity has 1 framelayout changed when item in drawer selected, problem when rotate screen fragment replaced goes previous fragment. ex. opened app , shows me fragment try select fragment drawer fragment b when try rotate while im on fragment b goes fragment a. here code. @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); initviews(); passedfragment = this.getintent().getextras().getstring("fragmentclass"); if(savedinstancestate != null){ getsupportfragmentmanager().findfragmentbytag(fragment_tag); } switch (passedfragment){ case "com.serverus.oom.fragments.fragmentagency": fragmentclass = fragmentagency.class; menuitemreserve = mmenu.finditem(r.id.agency_menu_item); break; cas...

Ubuntu 15.04 build Android 5.0 error: You are attempting to build with the incorrect version of java. why? -

error: ============================================ checking build tools versions... ************************************************************ attempting build incorrect version of java. version is: picked java_tool_options: -javaagent:/usr/share/java/jayatanaag.jar java version "1.7.0_80" java(tm) se runtime environment (build 1.7.0_80-b15) java hotspot(tm) 64-bit server vm (build 24.80-b11, mixed mode). required version is: "1.7.x" please follow machine setup instructions @ https://source.android.com/source/initializing.html ************************************************************ build/core/main.mk:174: *** stop. stop. #### make failed build targets (1 seconds) #### java -version: $ java -version picked java_tool_options: -javaagent:/usr/share/java/jayatanaag.jar java version "1.7.0_80" java(tm) se runtime environment (build 1.7.0_80-b15) java hotspot(tm) 64-bit server vm (build 24.80-b11, mixed mode) javac -version: $ jav...

apache spark - Scala - Expanding an argument list in a pattern matching expression -

i'm new scala , trying use interface spark. i'm running problem making generic csv dataframe function. example, i've got csv 50 fields, first of task , name , , id . can following work: val reader = new csvreader(new stringreader(txt)) reader.readall().map(_ match { case array(task, name, id, _*) => row(task, name, id) case unexpectedarrayform => throw new runtimeexception("record did not have correct number of fields: "+ unexpectedarrayform.mkstring(",")) }) however, i'd rather not have hard code number of fields needed create spark row. tried this: val reader = new csvreader(new stringreader(txt)) reader.readall().map(_ match { case array(args @ _*) => row(args) case unexpectedarrayform => throw new runtimeexception("record did not have correct number of fields: "+ unexpectedarrayform.mkstring(",")) }) but creates row object single element. how can make expand args in row(args) if ...

sql - CheckBox Not Sending Checked Value to Database C# Asp -

i making attendance system in student record student table in gridview check box. tick check box students present , leave unchecked absent. after submit record attendance system. problem: if check or left unchecked show absent in database results after submission of attendance please check code. html <%@ page language="c#" autoeventwireup="true" codebehind="webform1.aspx.cs" inherits="recordtablesss.webform1" %> <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <asp:gridview id="gridview1" runat="server" autogeneratecolumns="false" onselectedindexchanged="gridview1_selectedindexchanged"> <columns> <asp:templatefield> ...

x86 - Trying to do case insensitive search in assembly and my code doesn't work -

i have array of structures each element number , street name struct house { int number; char streetname[20]; } i want search token passed in. here code, , don't know why not work. please help! mov eax, 0 ; 0 out result mov esi, list ; move list pointer esi mov edi, token ; move pointer of token string edi mov edx, 0 ; reset edx counter mov ecx, 0 ; reset ecx counter l1: mov eax, [esi+4] ; read number of street eax add esi, 4 ; move pointer 4 bytes start reading street name l2: mov al, byte ptr[esi + ecx]; mov each char of street name array al mov bl, byte ptr[edi + ecx]; mov each char of search token bl or al, 20h ; convert al (case insensitive) or bl, 20h ; convert bl (case insensitive) inc ecx ; prepare next char cmp al, bl ; cmp al , bl jne different ; jump different if different cmp bl, 0 ; check if bl reaches end of string je done ; jump if match done jmp l2 ; jump l2 check next ...

C++ compile time dispatch abstraction? -

#include <iostream> struct object1 { object1(int v) : type(1), value(v) {} int type; int value; }; struct object2 { object2(int v) : type(2), value(v) {} int type; int value; }; template <typename headertype> void foo(headertype * hdr) { std::cout << "foo called type " << hdr->type << " , value " << hdr->value << std::endl; } // function doesn't work template <typename handlertype> void dispatch(int type, int val, handlertype handler) { if (type == 1) { object1 h(val); handler(&h); } else { object2 h(val); handler(&h); } } int main() { int type = 1; int val = 1; // part works if (type == 1) { object1 h(val); foo(&h); } else { object2 h(val); foo(&h); } // trying replicate above behavior in more abstract way, // ideally via function call of followi...

java - compile Google Camera source code in Android Studio? -

i cloned source code google camera here: https://android.googlesource.com/platform/packages/apps/camera and imported android studio. think source code not created using gradle , showing tons of errors when build it, related missing packages, eg "import android:content.context" gives java:package android.content not exist. etc. looking advice on how compile, other having add these libraries manually,? (i've seen posts here asking compiling camera gallery. not sure that's required camera code compile) edit : found this, android: having trouble working camera source code i believe it's talking same thing? case closed

html - Center alignment of text in input field for opera mini -

is possible centrally align text in input field in opera mini? i tried this, works fine in other browsers: <input type="text" style="text-align: center; width: 280px;"/> , but in opera mini input fields text still left-aligned. i did few attempts seems unfortunately it's not possible. i think input control in browser quite simple , doesn't allow aligning, changing font size or more complex properties border-radius . tested opera mini 7.1 in nokia c3.

c# - Is it possible to export/dump a DLL from process memory to file? -

first off aware of 1. is possible export dll definition appdomain? 2. is possible save dynamic assembly disk? 3. how can extract dll file memory dump? but none of seem answer question particularly. consider following scenario: c# application loads dll memory stream (so dll isn't directly exposed user). there tool explicitly allows dumping or exporting particular dll memory disk in original form? note: i'd show me full step-by-step procedure of extracting intact dll memory dump of c# application. windbg managed debugging extensions capable of trick. first, download windbg (google microsoft debugging tools windows , not standalone download, parts of other kits). the next part installing psscor2 extension (from https://www.microsoft.com/en-us/download/details.aspx?id=1073 ) , extract folder windbg located. next, run program , attach windbg (its in menu). type following commands: .load psscor2 !saveallmodules c:\modules\ find module want , enjoy. ...

magento - How to get attribute value of mutiple selection in the Owebia shipping method -

how attribute value of multiple selection in owebia shipping method? my owebia code below: {count items array_match_any(product.attribute.**shipping_restriction**.**value**', array('au','nz','au,nz'))} but,i can't attribute value,i can id num of attribute, shipping_restriction custom attribute,which has multiple selected menu. it return index num,not 'nz' or 'au',it return index num,not 'nz' or 'au' if have changed multiple selected menu single selection,it right value. 'nz' or 'au',and not index num. you can try using following syntax value. product.attribute.*.value where * attribute placeholder. reference: http://www.owebia.com/os2/en/doc#formulas_variables_product

nginx - reverse proxy mulitple ipython notebook servers -

currently running ipython notebook server behind nginx proxy. works straightforward 1-to-1 mapping. now want run multipe notebook servers behind 1 proxy. since these servers dynamically added, proxying should dynamic well. ideally i'd proxy on url subpath: http://open.net/py1 -> http://secure1:8888 http://open.net/py2 -> http://secure2:8888 http://open.net/py3 -> http://secure3:8888 etc. problem approach ipython doesn't use relative url's inside it's html. extract: <script src="/static/.../promise.min.js"</script> <script src="/static/.../require.js"</script> <script> ... so inside http://open.net/py2 require.js loaded via http://open.net/static/.../require.js of course result in 502. should http://open.net/py2/static/.../require.js question : what's strategy solve this? constraints : i cannot touch source html i cannot use subdomains each ipython server (as dynamically added) ...

Openlayers 3 vector source issue -

inside ajax callback have features expected, don't have them outside. what missing ? var geojsonsource = new ol.source.vector(); $.ajax('assets/data/data.geojson').then(function(response) { var geojsonformat = new ol.format.geojson(); var features = geojsonformat.readfeatures(response, {featureprojection: 'epsg:4326'}); geojsonsource.addfeatures(features); console.log(geojsonsource.getfeatures()); // work }); console.log(geojsonsource.getfeatures()); // doesn't work everything's fine snippet. @kryger said, ajax asynchronous javascript , xml. so, register listener know when features added source, like: geojsonsource.on('addfeature', function(event){ console.log(geojsonsource.getfeatures()); });

c# - Generating dump file with symbols for a .NET process -

i trying analyze threads , memory usage of .net process (w3wp.exe). that, generating .dump task manager, right click on process , creating .dmp file. doing on 64 bit machine , on 64 bit process. when try debug threads , memory utilization on process using .dmp file visual studio 2013, not see threads , memory data. how verify symbols loaded correctly default , available see threads , memory objects? need manually load symbols specific dlls? please bit careful terms. don't need symbols see threads. symbols needed resolve call stack , variables. seeing call stack need. in vs2013: go debug/options , settings... go debugging/symbols [x] microsoft symbol servers for own symbols, click "new" button in same dialog , add local directory. it not possible create dump including symbols. symbols independently dump, e.g. via http (like microsoft symbols) or local directory (created @ compile time). visual studio either load symbols, if match dump, or not...

Run python function in shell script -

let's want use shell script run python file, called test.py, in directory called test in home directory. tried following code, not work: #!/bin/bash echo "starting." module load gcc/4.8.2 module load python/3.4.1 echo "modules loaded." $home/test/test.py exit 0 i not believe how trying run program ($home/test/test.py) works. have not been able determine how this, despite searching long time. appreciated. this 1 of following, or may combination of both. the python script not executable. fix with: chmod u+x $home/test/test.py the script not start #! line pointing python. fix making first line of test.py : #!/usr/bin/env python you can use full path instead of using /usr/bin/env use $path resolve name. #!/usr/local/bin/python

oracle - error: ORA-01031: insufficient privileges -

Image
i have problem. create table accounts( id integer, name varchar2(100) ) / create or replace function account_balance(account_id_in in accounts.id%type) return number begin return 0; end; / error: error starting @ line : 1 in command - create or replace function account_balance(account_id_in in accounts.id%type) return number begin return 0; end; error report - ora-01031: insufficient privileges 01031. 00000 - "insufficient privileges" *cause: attempt made perform database operation without necessary privileges. *action: ask database administrator or designated security administrator grant necessary privileges please me resolve above error, thank you! as pointed out in comments, missing required permissions create function whatever user account using. let's assume less privileged login called some_user . fix problem, login more privileged account, , apply following grant statement: grant create procedure som...

How can I disable gnome window manager keyboard shortcuts for my linux game? -

i porting game linux. complex game , has lots of keyboard , mouse shortcuts finer control. 1 of shortcuts utilises alt , right mouse click, conflicts window manager functionality - namely context menu appears on machines. have tried disabling @ runtime collecting output of "gsettings org.gnome.desktop.wm.preferences mouse-button-modifier" , altering if conflict detected, hacky , works in few cases. know if there better, more reliable way of doing - preferably way of disabling shortcuts when game window active. you can use x server code grab keyboard , lock apps window. prevent else intercepting keyboard. see example: https://tronche.com/gui/x/xlib/input/xgrabkeyboard.html the disadvantage of taking heavy handed approach breaks things being able alt+tab out of full-screen window. lwn has article tricks valve went through steam work in linux ( http://lwn.net/articles/611969/ ) valve went far use ld_preload in places. had implement special overlay allow stuff...

javascript - add array object into object -

var objectz = {}; objectz.a = 1; objectz.b = 2 objarr = json.parse(localstorage.getitem('myitem')); $.each(objarr, function(key,obj){ objectz.key = obj; } console.log(objectz); i want add array value existing obj, got {1,2,10} 3 9 got override, mistake? aside syntax errors (copy/paste error?), code iterating through objarr , overwriting property literally called "key" on objectz (i.e. objectz.key ). not using function parameter iterator called key . if wanted use function parameter called key update objectz want use objectz[key] . it hard guess localstorage.getitem('myitem') returns. assuming objarr = [{c: 3},{d: 4},{e: 5},{f: 6},{g: 7},{h: 8},{i: 9},{j: 10}] , here corrected version of code: http://jsbin.com/viwiko/edit?js,console var objectz = {}; objectz.a = 1; objectz.b = 2; objarr = [{c: 3},{d: 4},{e: 5},{f: 6},{g: 7},{h: 8},{i: 9},{j: 10}]; //json.parse(localstorage.getitem('myitem')); //$.each(objarr, function(key,...

Excel function to test whether string contains ANY of $THESE CHARACTERS -

Image
given: $characters is there excel function test whether cell contains of characters in $characters? there array formula method involves indirect function check length of string $characters string tested. offset volatile formula recalculate whenever value in workbook changes.          the array formula in c2 is, =and(max(iferror(search(mid($e$2, row(indirect("1:"&len($e$2))), 1), $a2), 0))) array formulas need finalized ctrl + shift + enter↵ . once entered correctly, may filled or copied location. i've used search function case-insensitive. if require case sensitive search, substitute search find function .

How to declare the array type in swift -

so in swift playground file, trying execute following closure: var list = [5, 4, 3] var arraymultiplier = {(list:array) -> array in value in list { value*2 return list } } arraymultiplier(list) when though, error saying generic type array must referenced in <..> brackets, when put brackets, error. what's right way declare array type input , return? array generic type, meaning expects see actual type of members of array specified within < > following array : var arraymultiplier = {(list: array<int>) -> array<int> in // whatever want here } or, in case of arrays, there convenient syntax uses [ ] characters , omits need array reference @ all: var arraymultiplier = {(list: [int]) -> [int] in // whatever want here } i'm not sure original code sample trying do, looks might have been trying build new array each item multiplied 2. if so, might like: let inputlist = [5, 4, 3] let...

Ruby Simple Read/Write File (Copy File) -

i practicing ruby, , trying copy contents file "from" file "to". can tell me did wrong? thanks ! from = "1.txt" = "2.txt" data = open(from).read out = open(to, 'w') out.write(data) out.close data.close maybe missing point, think writing more 'ruby' from = "1.txt" = "2.txt" contents = file.open(from, 'r').read file.open(to, 'w').write(contents) personally, however, use operating systems terminal file operations so. here example on linux. from = "1.txt" = "2.txt" system("cp #{from} #{to}") and windows believe use.. from = "1.txt" = "2.txt" system("copy #{from} #{to}") finally, if needing output of command sort of logging or other reason, use backticks. #a nice 1 liner `cp 1.txt 2.txt` here system , backtick methods documentation. http://ruby-doc.org/core-1.9.3/kernel.html

javascript - switch content class after click image link -

i want build similar concept of site https://www.marketingprofsu.com/course/list with 2 image , when click on image compare specific content on bottom of image(fullwidth).this require responsive how make ? markup similar this: <div class="imagecontainer"></div> <div class="image1"></div> <div class="image2"></div> </div> <div class="contentcontainer"></div> <div class="content1"></div> <div class="content2"></div> </div> update i have tested evry code posted nver work in page not understand why,this page : <?php if ( !defined( 'abspath' ) ) { exit; // exit if accessed directly } ?> <?php if ( have_posts() ) : ?> <div class="row archive-courses course-list archive_switch" itemscope itemtype="http://schema.org/itemlist"> <?php // start loop. whil...

javascript - Easy way to change visual order of input fields dynamically (without changing form HTML)? -

i have form made angular directive template. contains several input fields in order. can not construct form dynamically using ng-repeat approach, because fields have custom behaviour, special validators , such. <div id="1"> input field 1</div> ... <div id="7"> input field 7</div> i have need display these input in different random order under use case. logic , contents of form remains same 1 input used 7th should become 1st. great if can achieve using css class conditionally applied elements (likely, using ng-class option). what css can possibly use keep same template (sketched above) have visually "div id=7" appear before "div id=1" ? i prefer avoid dom manipulating , have angular-friendly way. flexbox can change visual order of elements using order property. .wrap { display: flex; flex-direction: column; } .wrap div { padding: 1em; border: 1px solid black; margin-bottom: 1...

java - Multiple repeated child elements xml -

looking bit of here. i parse xml file using simplexml i´m not 100% sure how procede. this snippet of xml code: <bible abbrev="reinav" name="reina valera actualizada"> <book num="gen"> <chapter num="1"> <verse num="1">en el principio creó dios los cielos y la tierra </verse> <verse num="2"> y la tierra estaba sin orden y vacía. había tinieblas sobre la faz del océano, y el espíritu de dios se movía sobre la faz de las aguas. </verse> <verse num="3">entonces dijo dios: "sea la luz", y fue la luz.</verse> <verse num="4"> dios vio que la luz era buena, y separó dios la luz de las tinieblas. </verse> </chapter> </book> </bible> this had far: @root public class bible { @attribute string abbrev; @attribute string name; @element book bo...

c - Char array to unsigned short conversion issue -

i trying convert char array unsigned short not working should. char szascbuf[64] = "123456789123456789123456789"; int storetoflash(char szascbuf[], int startaddress) { int ictr; int errorcode = 0; int address = startaddress; unsigned short *us_buf = (unsigned short*)szascbuf; // write flash for(ictr=0;ictr<28;ictr++) { errorcode = flash_write(address++, us_buf[ictr]); if((errorcode &0x45)!= 0) { flash_clearerror(); } } return errorcode; } when see conversion, on us_buf[0] have value 12594, us_buf[1]= 13108 , have values upto us_buf[5]` after "0" remaining address. have tried declare char array also char szascbuf[64] = {'1','2','3','4','5','6','7','8','9','1',.....'\0'}; i passing parameters function storetoflash(szascbuf, flashpointer); //flashpointe=0 i using iar embedded workbench arm. big enedian 32. sugg...

android - Measuring compaign for mobile app -

Image
i trying measure campaigns , traffics sources when deep linking mobile app, , following tutorial: https://developers.google.com/analytics/solutions/mobile-campaign-deep-link . i have enabled deep links app content adding intent filters: <application android:name="com.package.deeplinkingapp.myapp" android:allowbackup="true" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:theme="@style/apptheme"> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> <service android:name="com.google.android.gms.analytics.campaigntrackingservice" /> <receiver android:name="com.google.android.gms.analytics.campaigntrackingreceiver" android:exported="true"> <intent-filter> <action android:name="com.android.v...

How to convert MYSQL to MYSQLI CODE -

hello have searched far , wide , cannot find way convert stop getting error fatal error: call undefined function mysqli_result() in /home3/kabone76/public_html/images/test/twando/inc/class/class.mysql.php on line 103 public function sql_result($res,$par) { return mysql_result($res,$par); } can me out? much

javascript - I don't understand the use of $inject in controllers -

i totally confused inject in angular. not know use , why. used factory described here? mycontroller.$inject = ['$scope','notify']; here notify name of factory. that 1 approach support dependency injection after code minified (if choose minify). when declare controller, function takes parameters: function ($scope, notify) when minify code, function this: function (a, b) since angularjs uses function parameter names infer di, code break because angularjs doesn't know a or b . to solve problem, provided additional ways declare controllers (or other services/factories/etc) matter: for controllers, use $inject method - here pass array of literals map parameters of controller function. so, if provide ['$scope', 'notify'] then value of first parameter function scope object associated controller , second parameter notify service. when declaring new controllers, services, etc, can use array literal syntax. here, this:...

javascript - How to change a mouseover event to a onclick one? -

here's want. there many words such test1, test2, test3, ... , each of them associated 1 or more examples. want show words side side, , have examples show when associated word "clicked" @ first, wrote below (mouseover event), realized doesn't work in mobile environments. need change plan. want action occur when user clicks word. https://jsfiddle.net/kyubyong/umxf19vo/ html <a>test1</a> <div class="divs"> <li>this example of test1</li> </div> <a>test2</a> <div class="divs"> <li>this example of test3</li> </div> <a>test3></a> <div class="divs"> <li>this example of test3</li> </div> css a:hover { background-color: lightgray; } .divs { display: none; } a:hover + .divs { display: block; position: absolute; background-color: lightgray; width: 100%; padding: 5px; } it loo...

c# - Using ASP.NET MVC 5, how do I get the localized DisplayAttribute string for an Enum value in a View? -

Image
if using displayattribute on enum value, how localized resource value based on enum value. for example, if have enum defined following: public enum expiremode { [display(resourcetype = typeof (modelres.expiremode), name = "never")] never = 0, [display(resourcetype = typeof (modelres.expiremode), name = "bycreated")] bycreated = 1, [display(resourcetype = typeof (modelres.expiremode), name = "bylastaccessed")] bylastaccessed = 2, } and, assume have created .resx file custom namespace of modelres contains following: how, retrieve proper localized value if have value of enum? use proper localized value display in view. i have looked @ solutions use type converters, extension methods, etc., seem add lot of code should relatively straightforward. using displayattribute other purposes makes localization pretty trivial handles internally. the simplest way found solve problem not require code following cod...

html - Changing position of navbar at mobile view -

Image
i wondering if there way change position of navigation bar in mobile view using css3. example instead of having navigation bar underneath top container in mobile view, have fixed above top container. using wordpress theme, in advanced. website www.capcar.com.au you may try "transform" property media rule.

php - I'm not able to display users data -

this question has answer here: php: “notice: undefined variable”, “notice: undefined index”, , “notice: undefined offset” 23 answers it says: warning: missing argument 1 users_data() notice: undefined variable: user_id warning: mysql_fetch_array() expects parameter 1 resource, boolean given my function: function users_data($user_id) { $data =array(); $user_id = (int)$user_id; $query = mysql_query("select * `sun` `user_id` ='$user_id'"); $user_data = mysql_fetch_array($query); return $user_data; } what do? i know $user_id not defined tell me how define $user_id i have done $user_id = $_session['use_id']; ; says undefined index... then use $sql = "select * users user_id= ???" got stuck can tell me how solve this? please don't tell me add user_id = 1,2,3 etc. because ...

string - Access Instr Vba -

i want copy bi!hersteller , bi!produktname new field when bi!hersteller in bi!produktname shall copy bi!produktname new field, i'll show you, codes tried if instr(1, bi!hersteller, bi!produktname, 1) > 0 .... if instr(1, bi!hersteller, bi!produktname, 1) len(bi!hersteller) .... either doesnt find string bi!hersteller in bi!produktname @ all, or return of instr incorrect... an example bi!hersteller = "siemens" bi!produktname = "siemens lc67ka532" new field should "siemens lc67ka532" try this: dim snewfield dim bi!hersteller : bi!hersteller = "siemens" dim bi!produktname : bi!produktname = "siemens lc67ka532" if instr(bi!produktname, bi!hersteller) > 0 snewfield = bi!produktname else snewfield = bi!hersteller & bi!produktname end if

User control used in user control -

i made user control(example - user control 1) in project , added toolbox. after use same user control (which added toolbox - user control 1) new user control (user control 2). i follow same procedure adding user control 2 in toolbox user control 2 not shows @ toolbox. not receive errors. using 2008 version. pls. help.

sql - How to do faster insert query in c#? -

i insert id's in sql table. following way works take long. best or better way increase speed. using (sqlconnection connection = new sqlconnection(configurationmanager.connectionstrings["defaultconnection"].connectionstring)) { string query = ""; foreach (var id in ids) // count = 60000 { { query += "insert [table] (id) values (" + id + ");"; } } sqlcommand command = new sqlcommand(query, connection); connection.open(); using (sqldatareader reader = command.executereader()) { reader.close(); } connection.close(); } you can use sqlbulkcopy insert large amounts of data - this: // define datatable columns of target table datatable tbltoinsert = new datatable(); tbltoinsert.columns.add(new datacolumn("somevalue", typeof (int))); // insert data datatable (int index = 0; index < 60000; index++) { datarow row = tbltoinsert.newrow(); ro...

php - MySQL SHOW COLUMNS unexpected behavior -

i have following php code: $res = mysqli_query($this->get_connection(),"show columns " . $this->get_table()); $mat = mysqli_fetch_assoc($res); var_dump($mat); the connection ok , returning data, can skip part. the problem that, understand, show columns should return 1 line each column in table. when run code against tb_categoria, description is: create table if not exists `tb_categoria` ( `id_categoria` int(11) not null auto_increment comment 'chave da tabela', `descricao_categoria` varchar(100) not null comment 'nome da categoria (produto)', `situacao_categoria` tinyint(1) not null default '1' comment 'situacao da categoria ( 0 inativo - 1 ativo)', `imagem_categoria` varchar(100) not null default '' comment 'imagem principal da categoria (produto)', `legenda_categoria` varchar(500) default null comment 'legenda da categoria (home)', `resumo_categoria` text comment 'resumo da...

Jenkins: Error in Selenium Publish Report -

i have configured seleniumhq plugin jenkins. i've tried run in local jenkins , worked. problems encounter follows: suitefile directory reads c drive only. example, c:\testselenium\testsuite.html when try specify absolute path test suite (workspace), error the suitefile not file or url ! check build configuration. same thing happens resultfile. when add post-build action "publish selenium report," i'm getting error because newly created resultfile saved c:\testresult\result.html , not in workspace.

javascript - Search data between date range AND add data between predefined date range -

i trying build searching application people can see data according date range inputed, want add predefined date range , add result final output. i have been searching solution did not figure out how it. think must have been missed something. please share knowledge me ? fyi new in coding. here form : <table id="tbl_rekapbeli" class="easyui-datagrid" style="width:900px;height:360px" url="get_lap_beli2.php" pagination="true" idfield="id" title="rekap pembelian berkala" toolbar="#tb" singleselect="true" fitcolumns="true" showfooter="true"> <thead> <th field="no_po" width="50" editor="{type:'validatebox',options:{required:true}}">no po</th> <th field="tgl_po" width="50" editor="{type:'datebox',options:{required:true}}...

mysql - Get percent from one column -

i want % of hard workers each company don't know how. example: google -> 66% microsoft -> 33% based in db: create table a_test (id int ,`business` varchar(25),`name` varchar(25) , `hard_worker` int); insert a_test (id, business, name, hard_worker) values (1, 'google', 'tom rudhot', '1'), (2, 'microsoft', 'thomas carpenter', '0'), (3, 'google', 'peter butcher', '1'), (4, 'microsoft', 'sookie page', '0'), (5, 'microsoft', 'roonie redneck', '1'), (6, 'google', 'robbyn stackhouse', '0'); http://www.sqlfiddle.com/#!9/33fed/1 try ( fiddle) : select business, 100 * count(*) / (select count(*) a_test hard_worker = 1) a_test hard_worker = 1 group business edit: previous query returns percentage of hard workers of company vs. hard worke...

javascript - Is it ok to do a type-converting comparison when checking if something is a string? -

since typeof somevariable === string not return true strings instantiated new string() , ok this: if(typeof somevariable == 'string') { // } to make sure comparison catch cases well, or such comparison have unintended side effects? since typeof somevariable === string not return true strings instantiated new string(), ok this: it's okay , won't give true string objects, it'll still false . it's not == vs. === matters, it's you're checking. if want reliably check both string primitives , string objects, then: if (object.prototype.tostring.call(somevariable) === "[object string]") ...is how that. works because if somevariable string object, that's string object.prototype.tostring guaranteed return it. if somevariable string primitive , either using thisarg in function#call (loose mode) or object.prototype.tostring function (strict mode) coerce string object before figuring out is. either way, "[ob...

How to clone a space in Bluemix -

how clone space in bluemix keeping same organization, clone space? or cloning organization? have several developers working on similar stuff, therefore seeking easy way duplicate or clone "master organization" or space. both sufficient. easiest way. there no way clone orgs or spaces.

php - Symfony isValid False CSRF token is invalid -

i have form , entity , not understand why have error: "error: csrf token invalid. please try resubmit form.\n" i try use form entity , 'data_class' => 'artel\profilebundle\entity\teams', , out not entity , have dump not enough information: formerroriterator {#1194 ▼ -form: form {#1245 ▶} -errors: array:1 [▼ 0 => formerror {#1244 ▼ -message: "the csrf token invalid. please try resubmit form." #messagetemplate: "the csrf token invalid. please try resubmit form." #messageparameters: [] #messagepluralization: null -cause: null -origin: form {#1245} } ] } userprofilecontroller.php on line 178: false//this $form->isvalid() userprofilecontroller.php on line 178: "error: csrf token invalid. please try resubmit form.\n" form: class teaminformationtype extends abstracttype { private $optioncontent; public function __construct($options) { $this->optioncontent = $options; } /** * @param formbuild...

how to show notification that shows up on main screen and all applications - Android -

Image
i wanna show notification messaging app line, both on main screen , on application shows notification box message in seconds , disappear then. something this: so possible ways ? custom toast? or custom dialog? you have create window animation : myservice.java import android.app.service; import android.content.context; import android.content.intent; import android.graphics.pixelformat; import android.os.ibinder; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.view.windowmanager; /** * created darshan.mistry on 7/18/2015. */ public class myservice extends service { view mview; @override public ibinder onbind(intent intent) { return null; } @override public void oncreate() { super.oncreate(); // instance of windowmanager windowmanager mwindowmanager = (windowmanager) getsystemservice(window_service); layoutinflater minflater = (layoutin...

android - How do I restrict a deeplink intent-filter to a particular pathPrefix? -

i've enabled deep linking on android app , it's working fine. however, want intent-filter listen particular pathprefix i.e. http(s)://(www.)mydomain.com/e , not other pathprefix. possible? i'm attaching intent-filter code in androidmanifest.xml <intent-filter android:label="my app name"> <action android:name="android.intent.action.view" /> <category android:name="android.intent.category.default" /> <category android:name="android.intent.category.browsable" /> <data android:scheme="http" android:host="www.domain.com" android:pathprefix="/e" /> <data android:scheme="http" android:host="mydomain.com" android:pathprefix="/e" /> <data android:scheme="https" android:host="www.mydomain.com" ...

node.js - Can't connect to the fakeredis instance (Nodejs + Redis + Fakeredis) -

i write nodejs app redis. want mock redis connection in unit tests. use fakeredis module stub data. have problem getting redis keys created in tests. can keys in tests, unavaiable in code. it's code doesn't connect fakeredis instance. tried set port , host, tried module redis-mock. app: var redis = require('redis'); var redisclient = redis.createclient(6379, '127.0.0.1', {}); redisclient.keys('*', function(error, reply){ console.log('keys', reply); // problem: it's empty array }); spec: var assert = require('chai').assert; var fakeredis = require('fakeredis'); var fakeredisclient; before(function() { fakeredisclient = fakeredis.createclient(); }); beforeeach(function() { // mock data - set random keys fakeredisclient.set('foo', 'bar'); }); aftereach(function(done){ fakeredisclient.flushdb(function(err, reply){ assert.ok(reply); done(); }); }); ...

python - TypeError: an integer is required (got type str) -

i new python , flask. working way throught tutorials: http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-iii-web-forms right getting error can't find fix for. have reinstalled python 3.4.3 , reinstalled virtual environment, have copyed code directly tutorial make sure did not make mistake while typing, still nothing works. init .py from flask import flask app = flask(__name__) app.config.from_object('config') app import views views.py from flask import render_template, flash, redirect app import app .forms import loginform @app.route('/') @app.route('/index') def index(): user = {'nickname': 'miguel'} posts = [ { 'author': {'nickname': 'john'}, 'body': 'beautiful day in portland!' }, { 'author': {'nickname': 'susan'}, 'body': 'the avengers movie cool!' ...

android - Bottom toolbar menu item hint appears at the top -

Image
i have activity 2 toolbars - 1 @ top , 1 @ bottom. both android.support.v7.widget.toolbar package. using xamarin, shouldn't matter. when press , hold menu item bottom toolbar, action hint shown @ top (see screenshot). there way change that? this known appcompat bug has been fixed in version 22.2.1