dimanche 31 mai 2015

Yii: how to respond with 404

How do I generate a response in Yii using $this->render, while setting an answer code to 404 instead of 200?

I want my flow to be like this:

if ($isOk) {
  $this->render('page', ...);
} else {
  // set 404 header  
  $this->render('error', ...);
}




Technology Discussion Python

I am aware this is not the place to discuss the technology. Pls direct me to proper discussion group where I can discuss what programming / Scripting languages can be used for unstructured big data analysis and plotting graphs in real time on web platform. Light weight with python as base. Thanks




Changing a number upon every refresh?

How could I generate a random number every refresh using html and javascript?

I have the javascript that would generate a decimal number.

        function DecimalGenerate() {
    var min = 1.03,
        max = 5.99,
        NumberResult = Math.random() * (max - min) + min;

    alert(parseFloat(NumberResult).toFixed( 2 ));
};

DecimalGenerate();



Change the querystring pattern of web api

If we put a variable (say it is myvariable) in the action method, the api's url will look like: api/myservice?myvariable={ myvariable }

But I want to see it like: api/myservice?myvariable={ var }

how can I do it without changing route table?




What is Website Patenting? [on hold]

I have many software as well as web applications originally made by me so before launching them I have to be sure that they may not get hijacked and what process is necessary to protect hijacking, I heard about the Process of Patenting so please briefly tell me about Patenting, Copyrights and How to do them?




how to use ruby code after its written, is it standalone or need to be in a web application?

Confused a little on ruby... I know it makes .rb files, but does it make exe or com files or is it just used as as web application? I know a bit writing the code, but what to do with the files after.




The right language for the right game

I want to make a simple card game that takes 2 to 4 players. I want to make the game online so that real people can play each other.
I prefer to make this game over a website rather than code an .exe
My question is what's the simplest combination of languages to make the game? Should I try and do it on a website and use Javascript or use ActionScript3 and which one will require less work in order to make 2 different computers play in real time?




How to access a URL with JavaScript?

I'm new to javascript and am looking to make a chrome extension for my school that would pull specific professor results from rateMyProffesor.com.

My question is...how do I access a website with java-script, search the website for a professor, and then grab data about that professor and return it back to the extension. Hiding all of this from the user of course.

If this question is too broad I understand, if you can't help me please direct me towards the appropriate resources.




Grab value from sql insert, php

I have a table with three feilds orderID (auto increment), custID, date I want to insert a new row into this table and at the same time find what the orderID is. Is there a way to set that value to a php variable?




Web Software / Server Setup for Fee Based Training Videos Website

I hope this is the right place to ask such a question.

I'm looking for some direction in helping a client choose a software package and server recommendations for a fee based training video website.

The users will be able to view sourced videos stored on a server (or a 3rd party service?) for a monthly or one time fee.

The users may be able to view: - (x) amount of times - for a number of days - one time view

I also have to recommend a server architecture, high bandwidth maybe, etc. Should I be serving these videos from a service that offloads bandwidth from a server? (media server? / CDN ?)

PHP/Linux recommendations are a plus but not completely required at this time (Any information is more than helpful).

And of course, thanks in advance! I'd be happy to clarify if I need to.




Removing case sensitivity Node subfolder

I have a Linux webserver using node which hosts a directory containing a static index.html file. I am wondering how I can make it so a user getting to the correct URL does not rely upon case sensitivity.

Currently, server.com/caa/ points to something different than server.com/CAA/ -- the directory holding index.html is lowercase "caa"




Text blurry after css transform in Chrome

I'm working on the web and I had to skew parent element without content. Problem is that when I skew content back text is blurry i Chrome but when I open web in Firefox it's not(it is for a second but it fixes right after). Can someone tell me why and is there any way to fix this. I saw several questions this kind but I cant find answer. Tnx




Access Bluetooth device from PC using HTML5

Is it possible to write an android application that communicates with the HTML5 code on a PC browser, via Bluetooth ?
Are there any HTML5 libraries that lets you access Bluetooth functionalities in the system (PC) ?




What's the best way to learn how to create an accessible website?

I want to create a website and since a big number of internet user are accessing the internet through their smartphones and other devices, so I want to learn to to make a website that is perfect for computer user and in the same time perfect for all the other devices people can be using, where should start?
Thanks a lot :)




When should i use Absolute and Relative positioning? [duplicate]

I have read so much about absolute and relative positioning but still haven't understand it properly. What's the practical use of Absolute and relative positioning and when should i use them exactly?




Pubnub real-time communication

I am new to the socket communication concept and I have few basic questions.

We have server serving multiple clients WEB,MOBILE etc.. we want to implement real time changes in the web app (web app is consumer only)

Lets say that each user has it's own private channel and the channel name will be the UUID of the user.

How does the server side can keep track which users connected to their channel?

In our case there is no meaning to send message to a channel which no device is listning to.

  • I saw presence feature but I am not sure that is the way it seems more appropriate for many users which can connect to a single channel and not 1-1

Basically when the server is handling somekind of user related operation I need a way to know if someone is listning to that user channel.

How it can be done with pubnub?

Lets say I am sending a message to a channel no one is listen/suscribed to

  1. if no one consuming the msg pubnub will consider it in the usage?
  2. once device will connected to that channel the message will be consumed?



Is it good idea to make separate CSS file for each HTML page?

I am building a personal homepage. I have 4 HTML pages and only one CSS sheet linked for all of the pages. That is, inside a single CSS file I have set up layout for all different pages. [In fact, each page has pretty much the same layout, only the contents and their style looks different. And my website isnt that advance.]

Is it a good practice? Or I should create separate CSS for each page?

An example of that what I have done:

page-1.html:

<link rel="stylesheet" type="text/css" href="design.css">

page-2.html:

<link rel="stylesheet" type="text/css" href="design.css">

design.css:

/*
.......
*/




Laravel 4.2 link to action links & as %27

hello I have the following line:

{{ link_to_action('FriendController@add', 'Friend ' .explode(" ", $user->name)[0],[Auth::user()->id,$user->id]) }}

and a route defined as

Route::post('friend/add{id}&{fid}', ['as' => 'friend.add', 'uses' => 'FriendController@add']);

however the url isn't parsing the 2 arguments correctly as it comes up as /add1%262 instead of /add?1&2

I cant figure out why, it was working before. Also it comes up with method [show] does not exist when it does go through.




How does a Servlet class knows which html script to handle?

How does a Java Servlet class knows which HTML script should it handle? Many examples/tutorials I saw online actually coded their html inside their servlet class. I'm wondering how do I tell a servlet which particular html script to handle?




MySQL JDBC Web Program: error in DB config

I am trying to do a simple select from a MySQL database in a Java Web Project.

I have MySQL up and running on localhost. I have a database named "lab" and a table named "lab_user" with 1 record:

enter image description here enter image description here

The issue is that every time that I try to select this 1 row from the program, I get an error saying that the table does not exist. So I believe that I may be doing something wrong with my DB config.

Below you can find my code, my web.XML and my context.XML.

Could you please help me to find out if there is anything wrong in here that is preventing from me to accessing the correct database?

THANK YOU

code

package DAO;

import java.sql.*;
import javax.naming.*;
import javax.sql.*;

import DTO.UserDTO;

public class UserDAO {

    private Connection connection = null;
    private Statement statement = null;
    private PreparedStatement prepStatement = null;
    private ResultSet results = null;
    private static final String DATASOURCE_NAME = "java:comp/env/jdbc/lab";


    public void getConnection() {
        if (connection == null) {
            try {
                Context initialContext = new InitialContext();
                DataSource ds = (DataSource) initialContext.lookup(DATASOURCE_NAME);
                connection = ds.getConnection();
            } catch (NamingException e) {
                e.printStackTrace();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
    }

    public UserDTO selectUser(String userID) {

        //pessoal
        String id = "";
        String name = "";

        try {
            getConnection();
            statement = connection.createStatement();
            results = statement.executeQuery("select * from lab_user where user_id = 1");

            if (results != null) {
                results.next();

                id = results.getString("id");
                name = results.getString("name");
            }
            results = null;
            ///

        } catch (SQLException e) {

            String error = "" + e;
            e.printStackTrace();

        } finally {
            cleanUp();

        }
        results = null;

        UserDTO uDTO = new UserDTO();
        uDTO.setName(name);
        uDTO.setID(id);

        return uDTO;
    }

web.XML

<description>DB Connection</description>
  <res-ref-name>jdbc/lab</res-ref-name>
  <res-type>javax.sql.DataSource</res-type>
  <res-auth>Container</res-auth>

context.XML

<Context>
  <Resource auth="Container" driverClassName="com.mysql.jdbc.Driver" maxActive="30" maxIdle="100" maxWait="10000" name="labDB" password="hacking" type="javax.sql.DataSource" url="jdbc:mysql://localhost:3306/lab?zeroDateTimeBehavior=convertToNull" username="fabio"/>
</Context>

Error: java.sql.SQLSyntaxErrorException: Table/View 'LAB_USER' does not exist.




samedi 30 mai 2015

Dynamic Content Loading (Infinite Scroll)

So, I am building a website that has some photos on it (similar grid to Weheartit) and the main idea is that I will update those photos daily (I will put new photos on a daily bases). At first I wanted to make a pagination but then I realized that loading the content dynamically is a better idea. So, I wanted to load the content in a similar way like Weheartit (when user reaches the bottom of the page, new content is loaded and so on to infinity)... I am generally new to web design but I have a good knowledge of HTML and CSS and some base to mid knowledge on Javascript. So, I wondered if some of you could help me get on the right road of achieving my ideas. What do I need to learn to make this possible? Is it doable without PHP, do I need AJAX and so on... Thanks guys.




Generating java from wsdl and xsd error

I am a beginner in wsdl/xsd trying to generate Java classes with the following two files

I am getting a number of errors including the wsdl file defines no service, and that elements from the xsd file cannot be found.

Does anyone know what the problem might be?

ChipDataJob.xsd

 <?xml version="1.0" encoding="ISO-8859-1" ?>
    <xs:schema xmlns:xs="http://ift.tt/tphNwY"
    xmlns:tns="http://ift.tt/1PVrdAo"
    targetNamespace="http://ift.tt/1PVrdAo"
    elementFormDefault="qualified" attributeFormDefault="qualified">

    <xs:element name="dataChipperJob" type="tns:ChipJob"></xs:element>
    <xs:element name="dataChipperResponse" type="xs:long"></xs:element>
    <xs:element name="cancelResponse" type="xs:boolean"></xs:element>

    <xs:complexType name="ChipJob">
        <xs:sequence>
            <xs:element name="outputFilename" type="xs:string">
            </xs:element>
            <xs:element name="uuidDataObjects">
                <xs:simpleType>
                    <xs:list itemType="xs:string" />
                </xs:simpleType>
            </xs:element>
            <xs:element name="parameters" type="tns:ChipParameters"></xs:element>
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="ChipParameters">
        <xs:all>
            <xs:element name="chipStartTime" type="xs:double">
            </xs:element>
            <xs:element name="chipEndTime" type="xs:double">
            </xs:element>
            <xs:element name="fillDuration" type="xs:float">
            </xs:element>
            <xs:element name="GapFillMethod">
                <xs:simpleType final="restriction">
                    <xs:restriction base="xs:string">
                        <xs:enumeration value="NONE" />
                        <xs:enumeration value="ZERO_FILL" />
                    </xs:restriction>
                </xs:simpleType>
            </xs:element>
            <xs:element name="StitchMarkerFormat">
                <xs:simpleType final="restriction">
                    <xs:restriction base="xs:string">
                        <xs:enumeration value="NONE" />
                        <xs:enumeration value="FILL" />
                    </xs:restriction>
                </xs:simpleType>
            </xs:element>
            <xs:element name="SequenceMethod">
                <xs:simpleType final="restriction">
                    <xs:restriction base="xs:string">
                        <xs:enumeration value="TIMECODE" />
                        <xs:enumeration value="MANUAL" />
                    </xs:restriction>
                </xs:simpleType>
            </xs:element>

        </xs:all>
    </xs:complexType>


</xs:schema>

DataChipper.wsdl

   <?xml version="1.0" encoding="UTF-8" standalone="yes"?>

    <wsdl:definitions xmlns:soap="http://ift.tt/KIQHA2"
    xmlns:tns="http://ift.tt/1PVrdAo"
    xmlns:wsdl="http://ift.tt/LcBaVt"
    xmlns:xs="http://ift.tt/tphNwY"

    targetNamespace="http://ift.tt/1PVrdAo">
    <wsdl:types>
        <xsd:schema
            targetNamespace="http://ift.tt/1PVrdAo"
            xmlns:tns="http://ift.tt/1PVrdAo"
            xmlns:xsd="http://ift.tt/tphNwY"
            elementFormDefault="qualified"
            attributeFormDefault="qualified">
            <xsd:include schemaLocation="ChipDataJob.xsd" />
        </xsd:schema>
    </wsdl:types>

    <!-- Chip Message -->
    <wsdl:message name="dataChipperJob">
        <wsdl:part name="job" element="tns:ChipJob" />
    </wsdl:message>
    <wsdl:message name="dataChipperResponse">
        <wsdl:part name="taskId" element="xs:long" />
    </wsdl:message>
        <wsdl:message name="cancelResponse">
        <wsdl:part name="cancelSuccess" element="xs:boolean" />
    </wsdl:message>

  <wsdl:portType name="DataChipperServicePort">
    <wsdl:operation name="submitRequest">
      <wsdl:input message="tns:dataChipperJob"/>
      <wsdl:output message="tns:dataChipperResponse"/>
    </wsdl:operation>
    <wsdl:operation name="cancelRequest">
      <wsdl:input message="tns:dataChipperResponse"/>
      <wsdl:output message="tns:cancelResponse"/>
    </wsdl:operation>
  </wsdl:portType>

</wsdl:definitions>




is it wise to globalise my e-commerce website in early stages


I Created An E-Commerce Website for Classifieds & Online Shopping. Would It Be Wise To Globalise it In All Other Countries. Despite The Fact That Olx, Quikr, Amazon, Ebay Are My Competitors. So Give Me Advise That Should I Globalize My Website In All Other Countries
Thank You




Insert part of web page

I'm new to php and html.

INB4: I HAVE TO use php, so please, don't advice me to choose another language.

I'm using bootstrap to build my web project. All my pages have a NavBar, contents of which are different depending on the users role. So I made a web page, including php scripts, which forms that NavBar for each user. And I want to know, Is there any easy way to put that php+html code in specific part of web page? Elseway I have to put a code of it in every page, which is not very good.




how to orient a polymer paper button at the bottom of the screen

I am working on a polymer app. I need to place a button which will always at the bottom of the screen. how can I achieve the same.




r shiny application tabbed view reuse data

Hi I want to build a R shiny application. It will include several different (tabbed) views / plots of the same data. I do not want to repeat my data pre-processing code for each plot. For now I try it like that

    reactive({
    if(input$allClusters == 1){
          filteredData <- rawData
        }else{
          filteredData <- filter(rawData, cluster_id == input$selectedCluster)
    }
  })

Using reactive elements. However my if / else does not seem to be evaluated anymore. Do you have any tipps how to be able to a) use the if else again b) if not possible do the filtering in a different way

Thank you very much.




How do I make the text inside a div fluid when browser resizes?

Ok so I have 3 main divs; Grey div which is the wrapper, Blue div which is on the left side and Orange div which is on the right side. Blue div has a fixed width and height.

My question is, how do I make the TEXT inside the Orange div fluid when browser window resizes? I dont want the whole Orange div to just jump down under the Blue div, I want the text to be fluid instead. How do I achieve this?

Thank you for your time :)

Here's a JSFiddle link http://ift.tt/1HCBS9t

.wrapper {
    position: absolute;
    max-width: 1200px;
    width: 100%;
    margin-left: 10px;
    background: #3c3c3c;
}

.leftimg{
    width:600px;
    height: 2900px;
    background: #8cceff;
    position: relative; 
    float: left;
}

.rightside {
    background: #F96;
    float: right;
    width: 50%;
    height: 100%;
}

.projectimg {
    width: 600px;
    position: relative; 
    float: left;
    margin-bottom: 50px;
}

.project-title {
    font-family: 'Abel';
    color: #FFF;
    float: left;
    margin-left: 40px;
    font-weight: 300;
    display: block;
}

.project-title .title1 {
    font-size: 2.5rem;
}
.project-title .title2 {
    font-size: 1.4em;
    clear: both;
    display:block;  
}

.context {
    float: left;
    color: rgba(255,255,255, 0.7);
    width: auto;
    margin: 20px 0 0 40px;
    display: block;
    position: relative;
}
.context p {
    font-size: 1.06rem;
    line-height: 1.6rem;
    font-family: 'Roboto Condensed';
    font-weight: 300;
}




Rendering in Rails (ruby 2.2.1, rails 4.2.1)

My problem is in rendering error messages, when @post.save returns false. I don't want use flash messages.

I have two resourses: config/routes.rb

  resources :users
  resources :posts, only: [:create, :destroy]

User can have many microposts on his personal page (e.g. users/1). And I need to add ability of creating microposts from user's show view. Creating with valid information works well, but I want to display error messages from model Post in another way.

app/controllers/posts_controller.rb

...
  def create
    @post = current_user.posts.build(post_params)
    if @post.save
      redirect_to user_path(current_user)
    else
      #?????
      render ???
    end
  end

app/views/users/show

...
<%= form_for(@post) do |form| %>
  <%= render 'shared/error_messages', object: form.object %>
  <%= form.text_area :text, placeholder: "Что у Вас нового?" %>

  <%= form.submit "Добавить" %>
<% end %>

In partial I am using object.errors.full_messages. Any ideas?




How to create attractive,responsible and animated website like link below?

I want to create attractive, good responsive and animated website like Sample Website. In this sample site i want know what are techniques and plug in they used and i want some reference for create website like this.

Thank you for Advance.




Difference between web application and e-commerce web application

Is there any difference between web application and e-commerce shopping cart application. I want to know the architectural difference between these two entities. Or, are they regarded as the same family of internet application? Do they differ in architectural wise? Do they differ in performance wise? What is the core differences. Can we consider web application n-tier architecture as e-commerce architecture to.




How to understand param-values in servlet?

<servlet>
  <servlet-name>moReceiver</servlet-name>
  <servlet-class>hms.kite.samples.api.sms.MoSmsReceiver</servlet-class>

  <init-param>
    <param-name>smsReceiver</param-name>
    <param-value>com.devsapce.samples.sms.FeedbackListner</param-value>
  </init-param>
</servlet>

what is implied by "com.devsapce.samples.sms.FeedbackListner" ? If I copy this and paste this in my web.xml file how should I change this ? I do not have a folder or any such as "devspace/samples/sms". I have stored files in "C:\Users\nser\workspace\cofeeshop". How should I change "com.devsapce.samples.sms.FeedbackListner" ?




Web-GIS and Android Applications

Is it possible to use Open-Layers or a similar library of scripts for the creation of Android Applications? I would like to create a Web - GIS application.




What is use of module in require list but not in callback function

I have 2 questions basically. 1.

  1. What is use of "abc/component/database/XYZSettings" in below code snippet.It is not being used in callback function.

  2. What is happening after ready function. With Base Edit

        <script type="text/javascript">
    require(
        [
            "dijit/registry",
            "dojo/ready",
            "awl/database/BaseEdit",
            "dojo/_base/connect",
            "awl/admin/Subscriptions",
            "abc/component/database/XYZSettings"
        ],
        function(registry, ready, BaseEdit, connect, Subscriptions){
            ready(function(){
                BaseEdit({
                    objId: "Settings",
                    readUrl:'/ui/settings/',
                    updateUrl:'/ui/settings/' ,
                    defaultsUrl:'/ui/elmsettings',
                    creatable:false,
                    deletable:false
    
                });
            });
         }
    );
    </script>
    
    



vendredi 29 mai 2015

standalone web app link script - stop it from appending links which have a specific class? bis

Following the discussion -> this thread: standalone web app link script - stop it from appending links which have a specific class?

Is Does anyone can help me? I have the same problem but i can't get to solve it with this code ->

 && !$(noddy).hasClass('lightbox')

I do not know where exactly I can add it in the script above

Any idea to solve it? or Is there another solution?

Best, Lina




404 Error Page Not Working

I have a new page, I made a custom folder, with a html 404 template and everything, I just added this:

ErrorDocument 404 /404/index.html

to my .htaccess file. I can load my 404 template page manually (And it looks great) But when I load the 404 from a 404 error, I see this. Screenshot! My 404 page: http://ift.tt/1FkORfp What could be wrong?

EDIT: When I get a 404 error from the /404/ directory (where the template is) it works.




Jquery ajaxStop nested inside load function

I would like to show my page after the ajax call ends and the images are loaded since my page has some animations they crash or dont show correctly. Im using jquery, and I would like if there is some way to nest ajaxStop in load function.

Thanks




How HTML FORM take only letters not numbers?

In may Addvalue.php file 3 fields id, name, color… in id only numbers allow, in name and color only letter is allowed. Values successfully inserted into my database, but the problem is when user write NAME and COLOR in the HTML FORM field only LETTERS allow to write, if write any NUMBER message appears "Only letter allowed".... But it takes both Numbers and Letter. here is my both file code:

Addvalue.php code:

<form  method="post" action="addh.php">
<input type="number" name="id"  id="id" required /> <span class="error">* </span> 
<input type="text" name="name" id="name" required /> <span class="error">* </span>
<input type="text" name="color" id="color" />
<?php
include("config.php");
if (isset($_POST["submit"])) {
                 $id = $_POST["id"];
      $name = $_POST["name"];
      $color = $_POST["color"];     
     if (!preg_match("/^[a-zA-Z -]+$/",$name)) {
       echo "Only letters allowed"; 
     } 
 if(!preg_match("/^[a-zA-Z -]+$/",$color)) {
       echo "Only letters allowed"; 
     }
     }
?>

addh.php code:

<?php
include("config.php");
    $sql="INSERT INTO honda (id, name, color)
VALUES ('$_POST[id]','$_POST[name]','$_POST[color]')";
    $result = mysqli_query($link,$sql) or die(mysqli_error($link));
    echo "Values Inserted";
?>




Center input field in bootstrap

This code show the input to the left of div

<div class="col-sm-8 col-md-7" style="min-width: 270px;">
<input type="text" name="address" class="form-control" value="<?php echo$data["address"]; ?>">
</div>

I intent with center and align div and show same. Sorry for the english. Thanks very much. Regards




Where should I divide a mobile-friendly website from it's android counterpart?

I am creating both a mobile-friendly website and an android app for a client. Each will have similar functionality and objectives. As I began to create responsive pages for the website, the thought occurred of using the very pages that I was making as webview menus for my android app. Which lead to me thinking, is an android app needed at all?

My question is this What functionality can my android app provide that a responsive website does not?

The purpose of the app is primarily reading content(think ebook), sharing the content with others, and a link to buy the physical book. I believe that reading the content offline is justification enough for the existence of the app I just was wondering what else could I provide that only an app can offer?

My second question is From a design standpoint, should I use webviews for the main menus and content? Or should I just duplicate my responsive pages with android layouts/buttons.?

Webview based menus seems somewhat awkward, having to use javascript to run my android functions. However duplicating my web pages with android activities seems equally awkward.




media Query for macbook pro 15"

I'm trying to apply media query for laptop 15" and smaller with no success.

Here is my media query:

@media screen and (min-device-width: 1200px) and (max-device-width: 1600px) and (-webkit-min-device-pixel-ratio: 1) { }

And:

@media screen and (min-device-width: 1200px) and (max-device-width: 1600px) and (-webkit-min-device-pixel-ratio: 2)  and (min-resolution: 192dpi) { }

I works for 13inch macbook pro but no for the 15".

Any help would be much appreciated.

Thanks




what is this plugin on bottom right corner of websites?

I have found on most of the site "ics_preview_panel". But not finding on google. what is this pluging called and fro where i can get this? her are the images of "ics_preview_panel".

![][1] ![ ![this example can be found on http://ift.tt/1ACUgS9] ![this example can be found on http://ift.tt/1HB1xPE] ][2]

on bottom right there is a preview pane.




!preg_match for letters not working

I am developing a website in which I use !preg_match("~/^[a-zA-Z ]*$/~",$name) that when user write his/her NAME in the HTML FORM field only LETTERS allow to write if number write message appears "Only letter allowed".... But it takes both Numbers and Letter. what to do??? here is my code:

<?php
    $nErr = $naErr = $cErr =  "";
    $id = $name = $color =  "";

    if (isset($_POST["submit"])) {

         $id = $_POST["id"];
         $name = $_POST["name"];
          $color = $_POST["color"];

        if (!preg_match("[0-9]",$id)) 
         {
           $nErr = "Only number allowed"; 
         }
           else if (!preg_match("~/^[a-zA-Z ]*$/~",$name)) 
         {
           $naErr = "Only letters allowed"; 
         } 

         else if (!preg_match("~/^[a-zA-Z ]*$/~",$color)) 
        {
           $cErr = "Only letters allowed"; 
         } 
       }
    ?>




Load different pages while leaving certains divs behind

I want to know how some web pages move between different PHP pages without reloading the entire page. Here some divs stays the same. If I use AJAX i cannot share the link of the page, so I need to do this. Thank you.




Unity3D WWW get HTML displayed in browser

I currently have in a web page, on a localhost server, some information that I want to use in Unity. My problem is that this information are stored in some js variables.

I tried to use the WWW class in a coroutine, but I only get the html source code. Is there a way to get the value of this variables inside Unity Editor ?

Thanks !




What approach is efficient for embedding a video on a front-end welcome page

Can someone explain how the HD video is embedded in the background of the front end(websites) welcome pages and it would be great if it's explained for Vimeo Site. It has an amazing design and I am supposed to implement something similar. I have tried to find similar answers on SO but they weren't convincing.




Learning ASP.Net and Sessions

I am trying to wrap my head around Session variables and ASP. I have a strong working knowledge of PHP and I am trying to get someone to relate it to how sessions work there.

So if I wanted to build a PHP login page I could ask them for username and pass and authenticate them against a database and create some cookies using their username and other values etc. I could then check to make sure those values are there on every page that I want and if they aren't redirect them back to either home or login page. I could also destroy those variables upon logout.

Can ASP do the same? If so where do I add the redirect code and how would I initially set the Sessions?

Thank you.




How to dump SOAP request in a variable in my java web service

I have a web service in which user invokes using SOAPUI. I want to dump the contents of SOAP request into a variable. I know that com.sun.xml.ws.transport.http.client.HttpTransportPipe.dump dumps to console but I want to dump whatever the user input in SOAPUI (SOAP request XML) into a variable in my web service class.

I tried using SOAPMessageContext soapMsgContext = (SOAPMessageContext) webservicecontext.getMessageContext(); to get SOAP request but it gives cast exception.

Any ideas ? Also is there any way to implement SOAP handler in server side without using @Handler annotation (all done in web service code) ?

Thank you,




How to make a div proportionally fluid when scaling browser?

So I want to make my content a 2 Column layout div that fills up the whole "container". But I want the "335px X 250px" div to be resized proportionally when window is scaled up or down. Here's a sample image of how I want it to look like

enter image description here

How can I do this?

The JSFiddle link http://ift.tt/1FH7UTs

<body>
<div id="body-wrap">

<div id="mobilenav">
</div>


<div class="content-wrap">

    <div id="container">
        <div class="mix"></div>
        <div class="mix"></div>
        <div class="mix"></div>
        <div class="mix"></div>
        <div class="mix"></div>
        <div class="mix"></div>
        <div class="mix"></div>
        <div class="mix"></div>
        <div class="mix"></div>
        <div class="mix"></div>
        <div class="mix"></div>
        <div class="mix"></div>
        <div class="mix"></div>
        <div class="mix"></div>        
    </div>

</div>




</div> <!-- end of Body Wrap -->
</body>




!preg_match for letters not working

i am developing a university project in which !preg_match is not working for letters in FORM it takes both Numbers and Letter, do not giver error here is my code:

<?php
$nameErr = $naErr = $cErr = $yErr =  "";
$id = $name = $color = $year =  "";

if (isset($_POST["submit"])) {

     $id = $_POST["id"];
     $color = $_POST["name"];
      $color = $_POST["color"];
       $year = $_POST["year"];

    if (!preg_match("[0-9]",$id)) 
     {
       $nameErr = "Only number allowed"; 
     }
       else if (!preg_match("~/^[a-zA-Z ]*$/~",$name)) {
       $cErr = "Only letters allowed"; 
     } 

     else if (!preg_match("~/^[a-zA-Z ]*$/~",$color)) {
       $cErr = "Only letters allowed"; 
     } 


  else if  (!preg_match("[0-9]",$year)) {

       $yErr = "Only number allowed"; 
     }
   }
?>




AngularJS UI Router reload not working

I have two states in my current apps, which is login and register. If I just open my website towards localhost:8001, it is automatically redirect to /login because I've set

$urlRouterProvider.otherwise('/login')

But if I open my website towards localhost:8001/asdf, it does not redirect to /login. It just print not found.

What am I missing?

Here is my full code

app.module.js

var myApp = angular.module('myApp', ['routesApp']);

app.routes.js

var routesApp = angular.module('routesApp', ['ui.router','loginApp']);

routesApp.config(['$stateProvider', '$urlRouterProvider', '$locationProvider', function($stateProvider, $urlRouterProvider, $locationProvider) {  

  $urlRouterProvider.otherwise('/login');

  $locationProvider.html5Mode(true);

}]);

login.routes.js

routesApp.config(function($stateProvider, $urlRouterProvider, $locationProvider) {
    $stateProvider
        .state('login', {
            url: '/login',
            templateUrl: 'app/components/login/login.html',
            controller: 'loginController'
        });
});

register.routes.js

routesApp.config(function($stateProvider, $urlRouterProvider, $locationProvider) {
    $stateProvider
        .state('register', {
            url: '/register',
            templateUrl: 'app/components/register/register.html',           
        });
});

login.controller.js

var loginApp = angular.module('loginApp', ['ngAnimate']);

loginApp.config(function($sceDelegateProvider, $httpProvider) {
    $sceDelegateProvider.resourceUrlWhitelist([
    // Allow same origin resource loads.
    'self'
    ])
});

var loginController = function($scope){
    //test controller
}

loginApp.controller('loginController', loginController);

index.html

<!DOCTYPE html>
<html>

  <head>
    <title>MyApp</title>
    <base href="/">
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- CSS -->
    <link href="assets/css/bootstrap.css" rel="stylesheet">
    <link href="assets/css/font-awesome.css" rel="stylesheet">
    <link rel="stylesheet/less" type="text/css" href="assets/less/phinisi.less">
    <link rel="stylesheet/less" type="text/css" href="assets/less/dropdown.less" />
    <!-- JavaScript -->
    <script src="bower_components/angular/angular.min.js"></script>
    <script src="bower_components/angular-ui-router/release/angular-ui-router.min.js"></script>
    <script src="bower_components/angular-animate/angular-animate.min.js"></script>
    <script src="assets/js/angular-payments.js"></script>
    <script src="assets/js/jquery-2.1.3.min.js"></script>
    <script src="assets/js/bootstrap.js"></script>
    <script src="assets/js/ui-bootstrap-0.12.1.min.js"></script>

    <script src="app/app.module.js"></script>
    <script src="app/app.routes.js"></script>

    <!-- Login Script -->
    <script src="app/components/login/login.controller.js"></script>    
    <script src="app/components/login/login.routes.js"></script>

    <!-- Register Script --> 
    <script src="app/components/register/register.routes.js"></script>    

    <script src="assets/js/less.js"></script>


  </head>

  <body ng-app="myApp">
    <div ui-view></div>  
  </body>

</html>




jeudi 28 mai 2015

Web service websphere error

I have to save SOAP envelope when user invokes my web service. So, I used a SOAP handler to intercept java web service to get SOAP body. My web service implementation class has annotation

@HandlerChain(file = "webServiceHandler.xml")

and webServiceHandler.xml contents are

   <?xml version="1.0" encoding="UTF-8"?>
    <javaee:handler-chains xmlns:javaee="http://ift.tt/nSRXKP">
    <javaee:handler-chain>
    <javaee:handler>
    <javaee:handler-    class>com.services.webServiceHandler</javaee:handler-class>
    </javaee:handler>
    </javaee:handler-chain>

This is working correctly in tomcat but when code is built in websphere it gives this error

"WSModuleDescr E WSWS7027E: JAX-WS Service Descriptions could not be correctly built because of the following error: javax.xml.ws.WebServiceException: Validation error: This is a Provider that does not specify a valid Provider interface. Implementation class: org.apache.cxf.js.rhino.DOMMessageProvider at org.apache.axis2.jaxws.ExceptionFactory.createWebServiceException(ExceptionFactory.java:173)"

To overcome this I tried getting SOAP body from WebServiceContext instead of using Handler.

 MessageContext msgCtxt = webservicecontext.getMessageContext();

 SOAPMessage soapMessage = ((SOAPMessageContext) msgCtxt).getMessage();

but I am getting "java.lang.ClassCastException: com.sun.xml.ws.server.EndpointMessageContextImpl cannot be cast to javax.xml.ws.handler.soap.SOAPMessageContext"

Any help would be appreciated on how to correct these errors ?




What are the concepts a Java/javaEE programmer must know [on hold]

What are the concepts a Java/javaEE programmer must know,

it can regarding tools, api, framework and design pattern.

Looking forward for some amazing response!!!

Many Thanks




How to test Jquery Mobile web App on an iPhone

I have an iPhone and a local mobile web app created on my desktop. I can't figure out how to test this web app on my iPhone. What is it I need to do to run and test the web app on the iPhone?




how amazon do Web content personalization

I'm wondering how websites like amazon do Web content personalization based on user activities or behavior ? do they access the user browsing history or use cookies ? and is that legal ? sorry if my question so silly and any help and guidance really appreciate it thank you in advance




How to make function work when the mouse not moving?

$(document).ready(function() {
var score = 0;

$("body").mousemove(
function(){

score ++;

$("#result").val(score);

console.log(score);
    }

  );

 }

);

The score will increase every time when I move the mouse, but how to add a function of the score keep decrease until to 0 when the mouse is not moving?




How Do I store and display (automatically) stories that users can submit on my website

I'm Making a website for a friend where people will submit stories. These will be short stories, presented on the website with a Title, a "by" section, ideally a picture of the author, and finally the story.

Now I've already got the design of the site up, but this is partly because I know how to use HTML and CSS. Though I know a bit of Jquery, Javascript, PHP, and SQL, I'm at a loss for how I should be saving any of the files and displaying them.

Assuming I want the website to automatically take in any stories, what is the best way to go about doing this? Right now, we have a contact form that would connect to our email where the stories can be sent it... is there a better way to do this so we can somehow just approve the story, then save the story somewhere, then have the website grab the story from where all stories are saved, and finally display it on the website?

If there's any hints or things I can look into that would help me accomplish all of this, I would greatly appreciate it!

Thanks in advance!




Connect to Sql Azure from 1and1 wensite

I have a problema when I try to connect my SQL Azure database from my web which is hosted in 1and1 servers. I did a lot of tests but without a good result. I added the proxy in web.config but the same issue was reproduced. Exactly, the proxy is:

I change the firewall of my SQL Azure to make diferent tests but they didn't work fine. The firewall was set to accept connections from 0.0.0.0 to 255.255.255.255. I know this is not recommended, but I did it to test.

Do you know how could I resolve this issue, please?

Any information will be appreciated.

Thanks a lot in advance.

Cheers.

David Ortega.




website loads over wifi but not mobile data

Hello I created a quick website last night using html, css, javascript with bootstrap. I am using 000webhost just to host it for now to test the website and all. The link is http://ift.tt/1SF4Vlh. The website loads perfectly on laptop and on my phone when connected to wifi but once I try to use mobile data I just get an ERR_CONNECTION_RESET error. I tried to use google developer console but there's nothing that seemed to help. I read a couple questions that covered this and followed their advice and still have the same error.

I tried this question: iOS Web page errors over Cellular Data but not over Wifi? Recent change to AT&T Cellular network?

And this one: Web site exhibits JavaScript error on iPad / iPhone under 3G but not under WiFi

Both did not fix the problem. It could definitely be something stupid but I just can't find the mistake. Thanks




Using IIS URL Rewrite to limit content to one of two domains results in redirect loop

I have two domain names for my website, one of which is the ubiquitous cookie-less static content domain. One name is merely an alias for the "main" name (using CNAME), so without additional configuration, any resource could be accessed through either domain. For security reasons in addition to just wanting navigation to be intuitive, I want to make sure that static content and only static content is available through the static domain, and in particular, that static content is NOT available through the main domain.

I accomplished the latter using IIS's URL Rewrite, with the following rule:

<rule name="StaticContentRes" patternSyntax="ECMAScript" stopProcessing="true">
    <match url=".*" />
    <conditions logicalGrouping="MatchAll">
        <add input="{HTTP_HOST}" pattern="^maindomain$" />
        <add input="{REQUEST_URI}" pattern="^/res/.*$" />
    </conditions>
    <action type="Redirect" url="https://staticdomain/{R:0}" />
</rule>

This works perfectly fine, and ensures requests for certain static content (all located in the "res" directory) are served only through staticdomain. However, I tried to further enforce that staticdomain be used ONLY for requests to that directory:

<rule name="RegularContent" patternSyntax="ECMAScript" stopProcessing="true">
    <match url=".*" />
    <conditions logicalGrouping="MatchAll">
        <add input="{HTTP_HOST}" pattern="^staticdomain$" />
        <add input="{REQUEST_URI}" pattern="^/res/.*$" negate="true" />
    </conditions>
    <action type="Redirect" url="https://maindomain/{R:0}" />
</rule>

Adding this second rule results in an infinite redirect loop whenever either domain is used to serve that directory. I'm completely stumped, as I thought the negate="true" logic was perfectly clean and workable. What can I do so that staticdomain requests are let through only if they're to the "res" dir, without incurring this loop?




Get a list of all domains that a website must contact in order to work properly

I am designing a piece of software for a customer who wants to use a firewall to limit web browsing access to a certain set of domains. Because of the way websites are built, it is not sufficient to simply whitelist these domains; I must also whitelist all the domains which these sites must contact in order to properly display content.

I'm relatively inexperienced in web development, and while I have been able to get some sites successfully whitelisted just by poking around the developer console in Chrome and blindly whitelisting every domain I can find in the source for a given site, I have no systematic way of figuring out exactly what needs to be whitelisted in order for a site to function.

Is there a way to conveniently get a list of all the domains that a site is using/could potentially use?

Some details about the project itself:

  • We are working on this for Samsung devices running Android OS, though I'm not sure if that really matters.
  • The firewall rules are enforced using Samsung's built in Knox API. I can feed that API either a domain or an IP. Domains will be resolved using DNS, so these are preferred to IPs which might change over time resulting in an outdated firewall policy.
  • The customer has specifically requested that this be done using firewall rules, not through other means, such as a restricted browser.



How to properly throw and handle exceptions with web services REST c#

I'm following MVC pattern in my Application server. I'm trying to throw an exception but its not been properly thrown.

Here is the code from controller:

[HttpPost]
public IHttpActionResult PostAddSuperUser(SuperUserViewModel SU)
{
    try
    {
        //more code
        blHandler.addSuperUser((SuperUser)SU.user, SU.Password);
        return Ok();
    }
    catch (EUserAlreadyExist ex)
    {
        var resp = new HttpResponseMessage(HttpStatusCode.NotAcceptable);
        resp.Content = new StringContent(string.Format("Already exist ", SU.user.Mail));
        resp.ReasonPhrase = "Already exist";
        throw new HttpResponseException(resp);
    }

Then the client side calls it as follow:

        try{
                    HttpClient client = new HttpClient();
                    client.BaseAddress = new Uri("http://localhost:50687/");

                    HttpResponseMessage response = await client.PostAsJsonAsync<SuperUserViewModel>("/api/SuperUser/PostAddSuperUser", SUVM);

                    if (response.IsSuccessStatusCode)
                    {
                        new SuccesPupUp("", "SuperUser " + SupUserName + " was added");
                    }
                    this.Close();
                }
        }
        catch (HttpResponseException Exc)
        {
            new ErrorPopUp("", Exc.Message);
        }

According to this this I'm throwing it correctly, but when I run it I got this errorenter image description here

How can I fix it?




What the best way to get my site links on google

I have my company on google but my site links through webmatser tools is not working I get enough traffic ?

A verified user has blocked or unblocked sitelinks for this site: https://protocore.net/. This is what it says

site:protocore.net




How to make website popular? [on hold]

I just created a website and I want to make it popular. But it seems that there are already a lot of similar websites. How can I make my website popular without spending a lot of money?




how can i devide web development project among a team [on hold]

i and some of my friends want to start a web development project we all know basic html, CSS, javascript, php, database(mysql) separately but we dont know how to work in a professional way . is there any link or tutorial, which can help me to build a proper team with perfect workflow of web developing .




Static "Connection" in JDBC: Can connections get mixed up?

Below is my code.

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package DB;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

/**
 *
 * @author Yohan
 */
public abstract class DBMaster 
{
    public static Connection con;

 /**
 *
 * Initializes the connection
 */
    public void createConnection() 
    {   
        try
        {           
            Class.forName("com.mysql.jdbc.Driver");

            try
            {               
              con=DriverManager.getConnection("jdbc:mysql://localhost:3306/myDB","root","");
            } 
            catch (SQLException ex)
            {
                ex.printStackTrace();
            }            
        } 
        catch (ClassNotFoundException ex)
        {
             ex.printStackTrace();
        }
    }


    public void closeConnection() 
    {

    }

 /**
 *
 * check if the connection is successful or not
 */

    public void checkConnection() 
    {            
            ResultSet resultset=null;
            String cmd="select * from user";    

            try
            {
                Statement statement=con.createStatement();
                resultset=statement.executeQuery(cmd);

            }
            catch(SQLException ex)
            {
                if(ex.getLocalizedMessage().equals("No operations allowed after connection closed."))
                {
                    createConnection();
                    System.out.println("System Loaded");
                }
            }
            catch(NullPointerException ne)
            {
                createConnection();
                System.out.println("System Loaded");
            }

    }
}

As you can see, this is a super class, where the subclasses will extend. The sub classes will use the static variable con after extending. sub classes will contain the database code.

I have implemented this class in web applications, where JSP and Sevlet are being used. Now my question is, can JDBC connection "ever" be shared in web applications? The Connection is static here, so can "connection1" get mixed up with "connection2" and and do some nasty work?

For an example, in this web application, "connection1" is deleting a record while "connection2" is updating a record. "connection1" belongs to "web application user 1" and "connection2" belongs to "web application user 2". Instead of deleting the record, can connection 1 mix with connection 2 and perform the "update"?

As far as I know, this code allows very speed database access without issues upto now(tested only with one web application user), but I am willing to learn more.




web service abstract; cannot be instatiated

Hey I am working on a java dynamic web project. I am using netbeans 8.0.2, and my project is deployed on a glassfish server. I recently had a need to use a web service from the web project I generated using primefaces crud generator. So I wrote a web service by injecting the ejbs whose methods I need. Upon redeployment of the project no problems were encountered and when I tested the web service everything is fine. Now I imported the webservice into a new java application project, but when I try to instantiate the webservice the IDE signals an error, TestWS is abstract; cannot be instantiated, but the TestWS is defined as a public class.

Please can someone help me out this mess. This is my first webservice I am building, I don't even know if I must declare a remote interface for my stateless bean before I would be able to consume the webservice generated from them. Thanks in advance!




Different webfont for Japanese special characters

I'm working on a Japanese website and I'm using the Meiryo webfont. I really like this font but the special characters have too much margin. The exact issue is that there's too much space in front of special characters like 【, which makes the design look off if such a character is the first on a line.

font-family: "ヒラギノ角ゴ Pro W3","Hiragino Kaku Gothic Pro",Osaka,"メイリオ",Meiryo,"MS Pゴシック","MS PGothic",sans-serif;
<h3>【好き】</h3>
<p>猫、アクリル板、真空管、リンゴジュース、ゾロ目、柄物、ドラッグストア、レゴ、アイドル、アニメ、光る物、製菓、イラスト、ドラム(叩けない)、ダリ</p>
<h3>【好きくない】</h3>
<p>煙草、カフェイン、満員電車及び人混み、パンチのあるアルコール類、刺激物全般(辛い、苦い)、算数、スポーツ全般、読書、プンプンしてる人</p>
<h3>【弱点】</h3>
<p>近眼乱視、虚弱、猫舌、譜面が読めない、書けない。方向音痴、機械音痴、運動音痴。睡眠をとらないと死ぬ。強く怒られると死ぬ。</p>

An image of the issue in my browser: http://ift.tt/1LLMJ4R

My idea to solve this is to write a script that puts every special character in a container which has a negative margin. That is obviously very hacky, and not practical at all, so are there any better solutions, like a different font for special characters only?




Web service written in C# for http://www.nameapi.org/ "Disposable Email Address Detector"

I'm trying to create custom webservice client for "Disposable Email Address Detector" for my ASP.NET web application written in C#. I added Service Reference to my project and successfully generated proxy class and whole configuration using http://ift.tt/1FcSUcF

Below is the code which I use to query web service:

SoapDisposableEmailAddressDetectorClient service_client = new SoapDisposableEmailAddressDetectorClient();
soapContext context = new soapContext();
context.apiKey = "myapikey";
soapDisposableEmailAddressDetectorResult result = service_client.isDisposable(context, "test@testmail.pl");
Debug.Print("soapDisposableEmailAddressDetectorResult.disposable: {0}", result.disposable);

Unfortunatelly webservice throws HTTP error 400 BAD request.

I decided to test web service using SoapUI, and I also used Fiddler to check what is send to NameAPI webservice from my app.

Below SOAP message generated by SoapUI:

<soapenv:Envelope xmlns:soapenv="http://ift.tt/sVJIaE" xmlns:dis="http://ift.tt/1eA8QQK">
   <soapenv:Header/>
   <soapenv:Body>
      <dis:isDisposable>
         <context>
             <apiKey>*****</apiKey>
         </context>
         <emailAddress>test@testmail.pl</emailAddress>
      </dis:isDisposable>
   </soapenv:Body>
</soapenv:Envelope>

And SOAP message generated by my app:

<s:Envelope xmlns:s="http://ift.tt/sVJIaE">
  <s:Body xmlns:xsi="http://ift.tt/ra1lAU" xmlns:xsd="http://ift.tt/tphNwY">
    <isDisposable xmlns="http://ift.tt/1eA8QQK">
      <context xmlns="">
        <apiKey>*****</apiKey>
      </context>
      <emailAddress xmlns="">test@testmail.pl</emailAddress>
    </isDisposable>
  </s:Body>
</s:Envelope>

Below implementation of isDisposable method:

public MyNamespace.NameAPI.soapDisposableEmailAddressDetectorResult isDisposable(MyNamespace.NameAPI.soapContext context, string emailAddress) {
    MyNamespace.NameAPI.isDisposableRequest inValue = new MyNamespace.NameAPI.isDisposableRequest();
    inValue.context = context;
    inValue.emailAddress = emailAddress;
    MyNamespace.NameAPI.isDisposableResponse retVal = ((MyNamespace.NameAPI.SoapDisposableEmailAddressDetector)(this)).isDisposable(inValue);
    return retVal.@return;
}

The difference is obvious, but how to fix my app to generate proper SOAP message?




Best way to redirect domain to www. (vice versa)?

First off, do I have to put www. in front of my domain when hosting a website? I know that both do the same thing, is it recommended practice to keep the www. or does it not matter? What would be the best way to redirect mydomain.com to www.mydomain.com, is it better to use the DNS server (BIND and Godaddy) or Apache? If it were in BIND, how would I edit my current forward lookup zone configuration?

$ORIGIN mydomain.com.
$TTL 86400
@   IN  SOA mypc.mydomain.com. info.mydomain.com. (
    2013071101 ;serial
    21600      ;refresh after 6 hours
    3600       ;retry after 1 hour
    604800     ;expire after1 week
    86400 )    ;minimum TTL 1 day

    IN  NS  mypc.mydomain.com.

    IN  A   EXTERNALIPHERE

    IN  MX  10  mail.mydomain.com.

mail    IN  A   EXTERNALIPHERE

www IN  A   EXTERNALIPHERE

mypc    IN  A   EXTERNALIPHERE

ftp IN  A   EXTERNALIPHERE

mc  IN  A   EXTERNALIPHERE

Would I change "www IN A EXTERNALIPHERE" to "mydomain.com IN CNAME www.mydomai.com" or is that in reverse? How would the reverse lookup look like?




Benefits of using Web development stacks

I'm starting to get into the new web development technologies and I was wondering if there is any substantial difference from using "stacks" (i.e MEAN.io, LAMP) than lets say start building your own for a specific project (putting technologies together)?




Technologies and languages to use for a personal website?

I am planning to build my personal website, but kind of confused between so many new technologies in market right now. I want to learn web development while building this site. I would like to have suggestions for a very basic starting project ( like Java, Javascript or angularJS , etc) ? How much difference in technologies it will make if I have future plans to scale it?




HttpContext is null in the controller during Unit Testing in Asp.net MVC

Here is my Asp.net Controller Property and Method

    public ApplicationSignInManager SignInManager
    {
        get
        {
            return _signInManager ?? HttpContext.GetOwinContext().Get<ApplicationSignInManager>();
        }
        private set { _signInManager = value; }
    }


    [HttpPost]
    [AllowAnonymous]
    [ValidateAntiForgeryToken]
    public async Task<ActionResult> Login(LoginViewModel model, string returnUrl)
    {
        if (!ModelState.IsValid)
        {
            return View(model);
        }

        // This doesn't count login failures towards account lockout
        // To enable password failures to trigger account lockout, change to shouldLockout: true
        var result = await SignInManager.PasswordSignInAsync(model.UserName, model.Password, model.RememberMe, shouldLockout: false);


        switch (result)
        {
            case SignInStatus.Success:
                return RedirectToLocal(returnUrl);             

            default:
                ModelState.AddModelError("", "Invalid login attempt.");
                return View(model);
        }
    }

My Unit Test

 [TestMethod]
    public void Login_WhenEnteredValidCredential_AllowsUserToLogIn()
    {

        var model = new LoginViewModel
        {
            Password = "TestPassWord1",
            UserName = "TestUserName",
            RememberMe = true
        };

        HttpContext.Current = new HttpContext(
    new HttpRequest(null, "http://tempuri.org", null),
    new HttpResponse(null));

       var accountController = new AccountController(); 
        var result= accountController.Login(model,null);
        Assert.AreEqual(result.Status,TaskStatus.RanToCompletion);


    }

The problem here is that whenever i run the unit test HttpContext inside the property SignInManager becomes null. Is there a way to set the HttpContext from the Unit Test? PLease note i have referred to this links but the solution there doesnt work me

Mock HttpContext using moq for unit test

Using httpcontext in unit test

http://ift.tt/1BrpkPW




Website logo placement on top right corner?

I am not sure what I am doing is according to guidelines/standards/rules or against it(it's weird actually from my point of view.). I tried to find a website with site logo placed on right top corner, but I didn't found one. From my observations It seems that logo of the website should always be on left side/left corner.

My questions are- Is it good to place your site logo on right side instead of left? Can it affect the user experience of my site or it will have no effect on users of the site? Is there proper guideline to place your site logo on left side? If yes can anyone share this with me?

I tried to find answers to above question but didn't found any useful information(maybe I am not searching with proper keywords). Please guys share your thoughts on this topic, If anyone has some useful link or this topic is previously discussed, please share with me.

Thanks.




3d application for web and raspberry pi

I want to build an application where the user can switch off and on the lighst in a 3d scene (building and lights modeled in blender). It should work both for a webbrowser and for raspberry pi (model B, B+), local.

For the web I normally use xdom, but this does not work for the raspberry, because there is no WebGL. Is there a technology I can use that works for both?

Best regards

Adriana




Download images using WebClient

I'm having an image url and I want to download it to my local folder. I'm doing using webclient class to do it.Here is my code

      using (WebClient client = new WebClient())
      {
          client.DownloadFile(urlOfImages, pathForImagesToSave);
      }    

But I'm getting an exception

An exception occurred during a WebClient request.

And the Url is Url




How does django handle multiple users

How does Django handle multiple users? I know that Apache creates a new thread and expressjs uses asynchronous methods. But I do not understand Django because it is working synchronously would'nt this slow down the process if there are more than say 2-3 users ?

Thanks




Detailsview templatefield mapping to ObjectDataSource?

I need help to understand the proper way to map or associate TemplateFields to the ObjectDataSource. I show only one (of many) template definitions here:

    <asp:TemplateField HeaderText="First Name" SortExpression="cFIRSTNAME">
    <ItemTemplate>
        <asp:Label ID="lblValFirstName" runat="server" Text='<%# Eval("cFIRSTNAME") %>' style="font-weight: bold;" ></asp:Label>
    </ItemTemplate>
    <EditItemTemplate>
        <asp:TextBox ID="txtFirstName" runat="server" Text='<%# Bind("cFIRSTNAME") %>' MaxLength="20"></asp:TextBox>
    </EditItemTemplate>
    <InsertItemTemplate>
        <asp:TextBox ID="txtFirstName" runat="server" Text='<%# Bind("cFIRSTNAME") %>' MaxLength="20"></asp:TextBox>
    </InsertItemTemplate>
   </asp:TemplateField>

The ObjectDataSource and update parameters are:

    <asp:ObjectDataSource ID="ODS_LOGIN_DETAILS" runat="server" 
    SelectMethod="GetLOGINSbyLoginID" 
    TypeName="bllLOGINS" 
    DeleteMethod="DeleteFromDetailsView" 
    InsertMethod="InsertFromDetailsView" 
    UpdateMethod="UpdateFromDetailsView" OldValuesParameterFormatString="original_{0}"> <UpdateParameters>
  <asp:Parameter Name="p_UID_LOGIN" Type="Int32" />
  <asp:Parameter Name="p_UID_CONTACT" Type="Int32" />
  <asp:Parameter Name="p_UID_USER_TYPE" Type="Int32" />
  <asp:Parameter Name="p_TXT_USERNAME" Type="String" />
  <asp:Parameter Name="p_TXT_PASSWORD" Type="String" />
  <asp:Parameter Name="p_BOOL_IS_ACTIVE" Type="Boolean" />
  <asp:Parameter Name="p_DT_END" Type="DateTime" />
  <asp:Parameter Name="p_FirstName" Type="String" />
  <asp:Parameter Name="p_LastName" Type="String" />
  <asp:Parameter Name="p_CONTACTTITLE" Type="String" />
  <asp:Parameter Name="p_TXT_PHONE" Type="String" />
  <asp:Parameter Name="p_CONTACT_EMAIL" Type="String" /> </UpdateParameters>

What is NOT clear to me is how is the mapping made from the templatefield textbox (txtFirstName) to the UpdateParameter "p_FirstName"?

In the existing code I am working with, I see the ObjectDataSource_Updating()-event that does a series of DVW.FindControl() values being assigned/set to the

e.InputParameter("param-name") = text-box-value

Questions?

Is this done in either the ObjectDataSource_Updating()-event or in the DetailsView_Updtaing()-event -or- by declaration aspx code?

or how?

What is the best way to do this?

Would naming the textbox-ID and the parameter-name simplify the code?

I am assuming the solutions offered would be "similar" or the same as with SqlDataSource -- please confirm?

Thanks in advance...John




JSON-LD Schema.org: Multiple video/image page

I can't figure out how you would define a bunch of videos on the same page. i.e. a search page. Let's say you've a site that returns 50 different videos. Then how are you supposed to define this with JSON-LD?




Schema.org: Video webpage layout

<div class="vidya">
    <a href="{{url_to_video}}">
        <img src="{{thumbnail_of_video}}"><!--alt???-->
        <h3>{{video_duration}}</h3>
    </a>

    <h2><a href="{{url_to_video}}">{{title}}</a></h2>
</div>

Is the proper way to use schema.org this:

<div class="vidya" itemprop="video" itemscope itemtype="http://ift.tt/yp0nX0">
    <meta itemprop="url" content="{{url_to_video}}">
    <a href="{{url_to_video}}">
        <meta itemprop="thumbnail" content="{{thumbnail_of_video}}">
        <img src="{{thumbnail_of_video}}"><!--alt???-->
        <meta itemprop="duration" content="{{time}}">
        <h3>{{video_duration}}</h3>
    </a>

    <meta itemprop="url" content="{{url_to_video}}">
    <h2><a href="{{url_to_video}}">{{title}}</a></h2>
</div>

Or am I missing something? // Not getting it




Putting 2 divs next to each other with same class

I have 2 divs which i cannot give different class names, due to them being the same but in a repeatable php code, which doesen't allow me to give them different class names. So i basically want to display them side by side. I have tried giving them a float left and relative position and a master div surrounding them with absolute position and other things like that, but to no avail.

HTML:

<div class="master"> 
<div class="second">1st</div>
<div class="second">2nd</div>
</div>

CSS currently applied:

.second{
    color:#FFF;
    width:300px;
    height: 10%;
    background-color:#69F;
    border-radius:25px;
    opacity: 0.7;
    filter: alpha(opacity=40);
    float:left;
}
.master{
width:960px;
padding-top:12%;
margin: 0 auto;
font-size:50px;
}




i want only desktop version of my site

I am begginer in web development , I m working on this site http://ift.tt/1LLLwtC Now when I open this site on lappy then it looks fine but when I open it on mobile then everything looks bad. I read many articles on responsive WD but I want to open this site as always desktop. For example this site http://ift.tt/1G2ePdh , when I open it on mobile then too it's open in desktop version. Any help would be appreciated. Plz give answer in a specific way. Thank.




python desktop application with database from webserver

I am new to python. I running database on localhost. I want to host database on webserver. I tried with localhost to web hostname, nothing works. please help me.

db.setHostName("localhost")
db.setDatabaseName("testDB")
db.setUserName("root")
db.setPassword("password")




Override values in web.xml for jboss eap 6

I have a requirement, In case of jboss change the value in web.xml at run time, before deployment. Is there a way to do this?

<init-param>
      <param-name>com.sun.jersey.config.property.packages</param-name>
      <param-value>com.testRest</param-value>
</init-param>

Same ear file is used for deployment on all servers, hence need to remove above code from web.xml at run time before deployment on jboss.

If I remove this code, this stops working in dev environment, that deploys application on Tomcat.

Please suggest ways to make it work with both jboss and Tomcat or a way to change web.xml at run time.




What these MySQL global variables really mean?

Today I contacted a hosting company to get information about their Java hosting performance. In their response, they said

MySQL:
max_connections=300
max_user_connections=50

Apache:
MaxClients 150 (this mean that 150 query could be handling at once, all other queries will be put to the queue).

Now I am confused. I read the NySQL developer document seeking for an answer but I am not convinced enough. Here are my questions;

  1. What is the difference between max_connections and max_user_connections ?
  2. Does it mean only 300 people can use the site at once? Or only 50 people? or something else?

The application I have is an online HR package, where users and their sub users will log into and perform operations like insert, delete, update. Any help would be greatly appreciated.




Running exe file on webpage

I just saw photoshop provides online service. Photoshop online

I would like to make a web site like this but I don't really know how and what to do. (I do have my own exe file). Can anyone explain me how this works? Thank you :)




How to send data outside of the browser sandbox?

I'm creating a (vaadin) web application with java. I will also have the requirement to send data from within the client browser to a local application of the user.

The user clicks a specific button, and the data is pushed to a local application on his machine, eg through a socket or whatever native OS functions. I will only have to support applications on windows.

Question: how could I achieve this? Of course the browser itself is a sandbox, so I cannot just get the data out of it directly.

Is there any chance?




mercredi 27 mai 2015

how to add website intro or take tour

i want to create website intro or "Take tour" like if your press a button it will take you different pages and show you the functionality just like in stack overflow and other website




Making an URL Alias

Let's say I have this page: http://ift.tt/1eyxL78;

That's a pretty ugly URL. I want to make it like this: http://ift.tt/1eyxNvG;

Because it looks prettier, is easier to type, easier to speak, and you aren't locked into the php file if you decide to rename it(or something).

How do I achieve this?




.Net Web Project Documentation Courses

Is there any courses available for Web Project Documentation?

I tried searching: Pluralsight -search/documentation and Googled a as well but couldn't find any relevant links.




Auto submit form for web crawling

I've got an old ASPX+XML website created by an external agency here. I only have access to sections of the XML as the web.config is locked.

I want to crawl this site to scrape the pages and capture the relational data. I can do a blank search which returns back all the data - from here a web crawler would be fine. However, I cannot find a web crawler that will hit search - I've tried a JavaScript that submits the form on page load but this still does not work (I guess it's not fast enough).

The URL does not contain the query string (so I cant just do a blank search and copy the results URL for example).

Any ideas?

Thanks in advance




Accessing WAR file from outside

We have static HTML files which are outside of the WAR file. The files are "index.html", "about_us.html", "news.html". Lets say our war file name is "MyWarProject". Right now we launch the tomcat and directly access the WAR file using

localhost:8080/MyWarProject/

After we host it, the lcoalhost part will be replaced by a domain name.

But what we actually need is that user first access the "index.html", after that he click on "SIGN-UP" button to access the WAR file. How can I do this?




how to get/trigger check box 's Jquery executed it self after page loaded

so I have few check boxs line up with some JQuery event/logic when user click on it.

however, when the page load I have a trigger Jquery event, which makes one of the check box by ID

$("#ro0").trigger('click');

and It checked the box but I also want is (it will execute the jquery behind #ro0)

$('input[type=checkbox][name=Main]').click(function(){ alert('thanks you for taking ur time to answering my question! :) ');    }




Hide Rows That Contain A Certain String Using PHP and MySQL

I have this block of PHP code which is pulling its information from a database.

All I want to do is filter/hide the rows that has "Player" like "string".

    <?php
    while ($row = mysql_fetch_assoc($result))
    {
        echo "<tr>";

        echo "<td>";
        echo $row["player"];
        echo "</td>";

        echo "<td>";
        echo $row["by"];
        echo "</td>";

        echo "</tr>";
    }
    ?>

For example I would have a table below:

BEFORE

And I want it to look like the table below:

AFTER




How to do search things(type a keyword..etc) indirectly in a code, not just search engine?

I try to do web scraping from a hashtag search site : http://ift.tt/1Rpguvn

Here are 3 questions.

1. Maybe, by Python, I want to use a kind of 'keyword list' to search. But I just know a normal search method : type a keyword in that site and see some results. How to do searching in a python code using my keyword list? In other word, 1. In a code, there is a keyword list or just one keyword. 2. using some functions, I get a search result from the site.

2. In that site, There is a button 'Load More'. As I need a lots of data, I have to click and click it to get more results. Is there any way to click it in a code, not just by human clicking? if can, I wanna use for loop until i get enough information.

3. I think to do this project by Python. Or would you recommend a good language to do my project?

Thanks!!!!




How to just keep one copy of list for data validation on both client and server sides

Basically we need to validate data on both client and server sides like many applications. One type of validation is to check if the value is on a LIST or not:

Eg: person_type and id_type must be selected from the list:

  • Person Type List: Student, Teacher, Staff.
  • ID Type List: Driver License, Medicare Card.

So the question is: how to keep these lists identical for both client and server sides.

Now I save these lists on BOTH client and server sides, which means I have to keep two copies in the codebase. Potential solution is loading the value of list from db or cache, but I reckon it's overengineering in this simple case.

Any suggestion?

Thanks.




Ajax calling WEB API throwing a Parser Error

So I am trying to make an AJAX call to get JSON information from a WEB API. The WEB API method seems to be working properly and when I try to access it via Fiddler, it returns a result:

Fiddler accessing Web API

When I try to access it via JQUERY AJAX, it fails and says that there is a parser error. Below is my AJAX call:

    $.ajax({
            url: 'http://example:port/api/values/',
            type: 'GET',
            dataType: 'jsonp',
            success: function (data) {
                alert("works");
            },
            error: function (request, error) {
                console.log(arguments);
                alert(" Can't do because: " + error);
            }
        });

Below is my WEB API Method:

    [System.Web.Http.HttpGet]
    public List<Users> Get()
    {
        List<Users> user= (from m in new DataAccessLayer.MapRepository().GetUsersRelatingTo("UserName")
                       select new CommonLayer.Views.Markers
                       {
                           ID= m.UserID,

                       }).ToList();
        return users;
    }

I would appreciate any sort of tip, thanks!




How to have two css animations in one tag

I am working with css animations and I have a series of animations with different css tags. I start at #water then go to other animations then I want to go back to #water with a different animation. This is my code:

#water {
    position: relative;
    left: 48px;   
    z-index: 1;
    opacity: 0;
    width: 197px;
    -webkit-animation: squeez 2s 1s 1 forwards;
    -moz-animation: squeez 2s 1s 1 forwards;
    -o-animation: squeez 2s 1s 1 forwards;
    -webkit-animation: fadeOut 10s 10s 1 forwards;
    -moz-animation: fadeOut 10s 10s 1 forwards;
    -o-animation: fadeOut 10s 10s 1 forwards;
}

It does not work how I want it to. The code is disregarding the first animation "squeez" and only doing the animation "fadeOut" which messes everything up. Any ideas on how to make this work?




What is the difference between using partial and not using partial for tornado.options.define?

I see two ways of setting up define in tornado.

import tornado.options
def define_web(hidden=False):

    define = partial(tornado.options.define, group='Web', hidden=hidden)
    define('thread', False, type=bool,
        help='threading')

and without using partial

from tornado.options import options, define

def define_web(hidden=False):
    define('thread', False, type=bool,
        help='threading')

So I was wondering what is the difference, and what is advantage of using partials




Google Maps not showing on webpage but shows on localhost

So I'm trying to implement Google maps on a website, and on my localhost it works fine, and I see it perfectly. However when I upload this to my hosting company, the map doesn't show at all. When I inspect the element and check the console, I don't see any errors. Code is below:

    <script type="text/javascript" src="http://ift.tt/1CzOMXn"></script>
    <script>
      function initialize() {
        var mapCanvas = document.getElementById('map-canvas');
        var myLatlng = new google.maps.LatLng(53.092975, -7.895479);

        var mapOptions = {
          center: myLatlng,
          zoom:16,
          mapTypeId: google.maps.MapTypeId.ROADMAP
        }

        var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);

        var marker = new google.maps.Marker({
          position: myLatlng,
          map: map,
          title: 'LCCEurotex'
        });


      }
      google.maps.event.addDomListener(window, 'load', initialize);
    </script>

I have no idea what could be causing it as my code looks the same as the one from the google documentation. Any ideas on what could be causing it would be great. Thanks for any help




Fetch text/html only from website using python

I am looking for a way to fetch text/html only from a webpage. No images, no videos. Currently I'm using urllib2 and I have gotten into some serious performance issues, since I need to parse A LOT of sites.

Can it be done?




Hi all, I am trying to figure out how to move content on a page dynamically when something else is clicked.

Example: You have 4 rows of images all clickable. When you click on image, then all the rows push down and opens up the content.

ITs bit more like pop-up user click and pop-up but i was wondering if can do it with push down..

Thanks




Access IP camera video stream through getUserMedia

I want to be able to access IP camera streams in a web browser in a similar way I can currently access USB cameras.

Is it possible to provide a URL stream as input into getUserMedia instead of a USB camera?

enter image description here

http://ift.tt/1q10OAC




Access windows directory from a web application PHP

I'm New to PHP programming. I'm searching for a solution. After googling a lot, finally i'm here.

My Assignment is like : 'My web application have to detect the device connected to the PC with a name say "My_DEVICE" and if it is found programtically, i should generated a file and keep it in the device. If device is removed and again connected, i should check for a directory as per some....specifications and upload the images into the server'.

I have done it in my local XAMPP server, it's working fine. Whereas when i upload it into the server, i facing the problem. Please help me.

My Code as follows:

for($i = 'C'; $i < 'Z'; $i++)
    {
        // Try to grab the volume name
        if (preg_match('#Volume in drive [a-zA-Z]* is (.*)\n#i', shell_exec('dir '.$i.':'), $m)) 
        {
            //$volname = ' ('.$m[1].')';

            if ($m[1]=='MY_DEVICE')
            {
                $path = $i.":/";
                if ($dh = opendir($path)) 
                {
                    if(file_exists("myfile.txt"))
                    {
                       //my logic here
                       echo "file already exists";
                    }
                    else
                    {
                        $file = fopen("myfile.txt", "w") or die("Unable to open file!");
                        $id=$myid."\r\n";                   
                        fwrite($file, $id);                         
                        fwrite($file, $name);
                        fclose($file);
                    }
                }
                $device = 0;
        }
        else
        {
            //echo "No SMARTSCOPE device";
            $device++;
        }
    }
}

    if($device==0)
    {       
         echo '<h1 align="center" style="padding-top:40px">You Plugged-in Device !!</h1><br />';
    }
    else
    {
         echo '<h1 align="center" style="padding-top:40px">No Device detected !</h1><br />';
    }

When i debugged, i came to know that shell_exec unable to find the path. How to access windows directory from a web application. Is any api's are avaiable? or any libraries are available?

Please help and guide me in the situation. Thanks in Advance !!




Windows Forms webbrowser - Cache C#

Can I save data in cache using Windows Forms webbrowser? If yes, how can I do it with c#?

Thank you for your attention.




How to get key (index) value of a textbox in array textboxes

i want a jquery function or javascript that alert the index and the value of array textboxes : e.g.

<input type="text" name="textbox[]" value="1" onblur="javascriptfunction(this.value,this.index)" />
<input type="text" name="textbox[]" value="foo" onblur="javascriptfunction(this.value,this.index)" />

<input type="text" name="textbox[]" value="banana" onblur="javascriptfunction(this.value,this.index)" />

Whenever mouse moves for example from the first input i have this alerted (1,0) and second is (foo,1) and so on ! i couldnt find the function that does that please help !




How to implement a rich text editor using Polymer?

I tried to integrate TinyMCE with Polymer but it doesn't work due to the shadow doom.

Also, I tried to follow this instructions from the bellow link, but still doesn't work either. :(

How do I wrap tinyMCE inside a polymer element?




Password encryption algorithm

I want to develop a web application where users can login inserting their email and password (chosen when register). I want to know which would be the best password hashing algorithm. I have read that bcrypt is a good option, but what algorithm do sites like facebook use?




Code structure and necessary elements in web development

I'm thinking of developing a database-based web application from scratch but I have some concerns. I'm quite new to the world of web development (I've done Harvard's course CS50, but that's about as far as my knowledge goes) and I've recently tried wordpress a bit.

Something that confuses me is how many different files, how extremely much css and how many different nested divs there are in most wordpress themes, but also on any website in general. This makes me anxious, since I feel like I will miss so many things by starting from scratch.

My questions are basically:

  1. Are all the css rules, nested html divs and php-code necessary or are they to some extent a product of copy-paste (in the case of wordpress themes specifically). If they are necessary, what does it all do? Could someone give me a brief overview of the thousands of lines of css and tens of php-files?
  2. What are the best practices when building a website from scratch? How should the structure of the html look like (especially considering nested divs), how should I build up the css file and what code is important to include? I guess I'm looking for an explanation of the structure of development and a description of a template of code (html, css and php) that you should always include.

I'm planning on building a serious, secure and well-functional web-application and that's why I want to follow the best practices and understand the purpose of all the code. Thank you in advance!




Separating static web pages from WAR file

I have a web application which is a WAR file. I will be hosting this in Amazon cloud, using Linux and Tomcat. However I now need to create a different UI using HTML and CSS, no Java or WAR. My plan is, user will access this static user interface first and from a link there, they will access the actual java based web application.

There are 2 ways I can do this. First is to put all of this static content into the WAR file. Second is seprating the static content from the WAR file. I prefer the second method, because I can add info to the user interfaces without shutting down the entire web application.

But, how can I do this? How can I put these static files to tomcat and link the WAR file to it? Specially is this is possible in amazon cloud?




Where can I find the HIPAA compliance documents or procedures to develop a web application with RESTful service?

I would like to understand the HIPAA compliance to develop a angular js framework web application for health care industry. Is there any place to get some inputs to adhere HIPAA compliance?




show hidden div with jquery by url

i am us jquery to show/hide divs by button click which works well but i would like to be able to show the div using a url: eg: http://ift.tt/1AxLlBA

This is the jquery i am using:

$(function(){
$('#Options ul li a').on('click', function(e){
e.preventDefault();
var newcontent = $(this).attr('href');

$('#Options ul li a').removeClass('sel');
$(this).addClass('sel');

$('#Info section').each(function(){
  if(!$(this).hasClass('hidden')) { $(this).addClass('hidden'); }
});

$(newcontent).removeClass('hidden');
});
});

Any suggestions please.




Creating a downloadable URL web page

If anyone can guide me or give me tutorials.. much appreciated. I want to create a web page (or web service i don't know) where the URL can be used to by Download Manager in Android to download a file. thank you.




Responsive web design and the web standards

Today to design responsive web site we can use, i.e., bootstrap, foundation, etc. but this framework aren't standard. I don't understand if with CSS we can do the same things using, i.e., the grid layout or the flexible box model. Can anyone tell me if there is a w3c standard that allow to make responsive web site?




Alternatives to Java applet to launch Microsoft Office applications

In our web application, we used to use a Java applet to invoke MS. Office applications e.g. Word to open, edit, and save back a file to the server.

Google Chrome will no longer support NPAPI, so soon we can not run our applet in Chrome anymore. Plus, it seems that MS. Edge is not willing to support Java.

So, any suggestions for an alternative for the Java applet. We want to make the same experience for the user, just like before: we do not want to open the files in the browser.

I have also tried Html5 features e.g. FileSystem API. But, it turned out to me that at least that feature cannot help me. (to my knowledge, maybe I am missing something)

Thank you very much for your suggestions in advance.

Reza




My server's some processes are getting killed automatically

[root@localhost ~]# yum install repo Loaded plugins: fastestmirror, protectbase, replace, security Loading mirror speeds from cached hostfile Killed [root@localhost ~]# yum upgrade Loaded plugins: fastestmirror, protectbase, replace, security Loading mirror speeds from cached hostfile Killed [root@localhost ~]#

Please find some solution , I am running Centos 5. Even i unable to run iftop.




Anyone knows which is faster bewteen jsonp and ajax?

I did a simple test in my mac chrome browser, and find that using jsonp to get data from server is faster than ajax do.

I don't know why.

Someone knows?




When do web browser decode compressed 206 chunk?

When web browser decompressed (e.g. gzip) partial content (HTTP 206)? Does it decode it after receiving all the chunks or it can decode with each chunk received?

If it doesn't decode the chunk we receive after 206 request, can we decompress it using JavaScript on the client?




Facebook open graph- share a poem instead of an article

My website shares poems, stories and articles. This is an example of an open graph of a poem.

  {
   "id": "905716739487689",
   "application": {
      "id": "728278247279506",
      "name": "mypen",
      "url": "https://he.mypen.net/"
   },
   "created_time": "2015-04-08T10:48:04+0000",
   "description": "My complexity, my life is yours. You have me in the morning as i get out of bed. You have me in the night as i go to sleep.  My complexi...",
   "image": [
      {
         "height": 408,
         "type": "image/jpeg",
         "url": "http://ift.tt/1AxpHxi",
         "width": 612
      }
   ],
   "is_scraped": true,
   "site_name": "MyPen.net",
   "title": "My Complexity",
   "type": "article",
   "updated_time": "2015-05-27T07:40:27+0000",
   "url": "http://ift.tt/1HvHpyq",
   "data": {
      "section": "Poems"
   }
}

The problem is, that when a user shares a poem, facebook tells it's an article. I've read in other places that i should set og:type to article, but it's doesnt seems right:

Is there any way to set the open graph to say "Eran Shmuel shared a poem on mypen"?

Or do I have to change og:type to "website" for poems and stories?




Roboto font in Chrome is not shown properly

I've been working for a client site and I have problem with rendering of Roboto font.

In Chrome (ver. 43.0.2357.65 m) all the various weights of Roboto looks same. Here is the example: Left is Mozilla Firefox, right is Chrome http://ift.tt/1LI9C94

Do you have any idea what's wrong with it?

thank you




Automatic login through an Android web view / webapp

I'm looking to let a user log in only once in my website. The next time they start the Android web app, they should be logged in already. Does anybody know how this is doable? Thank you




Domain name rejected by nginx

I have a server running a very simple rails app. It has nginx set up to listen on port 80, which further forwards the request to a unicorn socket file under (Rails.root)/tmp/unicorn.sock.

I bought a domain name from domain.com and pointed it to my server's address=.

e.g. Domain: mydomain.com -> Server: 110.56.45.12

Everything works great when I hit the server directly, by either visiting 110.56.45.12 in my browser or ssh-ing into the box and running curl 127.0.0.1. I assume this is because both these actions hit port 80 and nginx serves back the correct content.

However when I try to use the public domain name domain.com or I try curl localhost I get the classic "We're sorry, but something went wrong." rails page.

I checked the rails production log and there is nothing there. I then checked nginx error log at /var/log/nginx/error.log and only got

2015/05/27 07:01:24 [error] 20041#0: *143 connect() to unix:/home/jeeves/my_app/tmp/unicorn.sock failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: mydomain.com, request: "GET / HTTP/1.1", upstream: "http://unix:/home/jeeves/my_app/tmp/unicorn.sock:/", host: "localhost"

Is there any reason my server is rejecting that connection?

Thanks!




mardi 26 mai 2015

Parse.com To Do web app deployment issue

Apologies for basic question. I am very new in web development . I have download parse.com javascript web To Do App from http://ift.tt/1iO8D7M . Now I want to deploy with parse.com. So that I can browse this app using http://ift.tt/1Hvx3yr. But when try to deploy using "parse deploy" command getting error as "Command must be run in a directory containing a Parse project."

Can you please help out me by step by step process.




semantic web recommend-er system development

I'm beginning in semantic web.I want to develop a semantic web recommend-er system.the most important part of my project is moddeling.how can I start it?how long does it take? what soft-wares or tools can I use to develop that?




Scalability (Design) Considerations

I tried searching for accurate information, but I fail to find any. So I am asking you veterans here.

Firstly, What kind of requests has a platform like Facebook/stakoverflow has to perform per unit of time?

Secondly, What kind of resources and restrictions are required to run such a web services, let's say for 10 million users? (hardware/software considerations)

I know my question is a bit vague, but I am having a hard time understanding the scalability in such an application.




What languages do I need to know before I am able to build a custom website like this?

What languages do I need to know before I am able to build a website like this?

I'm able to build websites using a CMS like Wordpress etc but would like to begin learning how to build custom websites from scratch.

What languages/programing skills are needed to build a unique website like this and others you see online... twitter, facebook, etc etc.




How to share the SSRS generated report with users

I have an html, css, javascript website. I want to add a Stat link which will direct users to the SSRS reports based on their entered data. Just like nike fuel band web site where the user is presented with a dashboard on signing in which shows bar graph of walking activity for the last week. Users can change it to month or year etc.

To cut the long story short. I want to show an SSRS report of user activity when the user click a link on the webpage. I dont know what tools I can use to achieve it.




Woocommerce product dimensions not showing on first product

I am using Wordpress with Woocommerce and would like the shop and archive pages to show the product dimensions along with the price and title of the product.

I added this code to my content-product.php woocommerce file: http://ift.tt/1Kyj7dt

Which worked great! Except for the first product in the shop loop. Both on the shop page and in other product lists, the dimensions are not shown on the first product.

How might I resolve this?

Image: http://ift.tt/1F9fEtZ




rewrite get variables in url

I'm working on a website and now i want to edit the htaccess file to change a url with get variable. But i look on the internet for information without any success.

http://ift.tt/1F96Ggv{massageName}

this is the link and i want it to look like this

http://ift.tt/1HJjO2I{massageName}

Can someone help me with that??

Martijn




jquery consumes to JAX -WS

have a java web service (JAX -WS) ...

@WebMethod(operationName = "TraerConsulta")
public String TraerConsulta() {
    try {
        cl_integrens icl_integrens = new cl_integrens();
        String as_xmldat = "";
        as_xmldat = icl_integrens.sp_QueryReturnXML("sa", "dactaZQL2008", "exec sp_sysbas_dd_tabdef ?, ?, ?", 10, "001", "101", "estreg");
        return as_xmldat;
    } catch (Exception ex) {
        Logger.getLogger(ws1.class.getName()).log(Level.SEVERE, null, ex);
    }
    return null;
}

and i'm trying consume with jquery

function WebMethodConsulta() {            
        var codigo =$("#txtCodigo").val();            
        var nombre =$("#txtNombre").val();            
        var q = '<?xml version="1.0" encoding="UTF-8"?><S:Envelope xmlns:S="http://ift.tt/sVJIaE" xmlns:SOAP-ENV="http://ift.tt/sVJIaE">'+
                '<SOAP-ENV:Header></SOAP-ENV:Header>'+
                '<S:Body><ns2:TraerConsulta xmlns:ns2="http://ws/"/></S:Body></S:Envelope>';

        $.ajax({
            url: 'http://ift.tt/1GBGArC',
            data: q,
            type: 'post',
            contentType: 'text/xml; charset="utf-8"',
            success: function(res) {                    
                 var responseWS = $(res);                     
                 var data2 = responseWS.find("Body").find("TraerConsultaResponse").find("return").text();                     
                 alert(data2.toString());
                 $('#spnresu').html(data2.toString());              
            },
            error: ServiceFailed
        });
    }

and it works ... but I get to activate the cross domain

help me please!!