mardi 21 avril 2015

Change colour filter of screen to work with multiple monitors

Vote count: 0

I've made a program to change the colour filter of the screen similar to the way Flux does (the code shown to do this is in the main question from here). However, a couple of my users say it won't work with two or more monitors. How would I modify the code so that it does?

asked 1 min ago
Dan W
570



Change colour filter of screen to work with multiple monitors

copy values from pivot table to sheet in specific cell

Vote count: 0

I have some data that is displayed in a pivot table, from that pivot table I currently copy and paste them in another table with the corresponding current day, with so many operation numbers it takes about 1hr to complete this process daily, I'm trying to make a macro in witch will help me in making this process in less time

this is the pivot table in witch I copy the data Pivot Table

and here is where I paste it (in this table I use it to create some graphs)

enter image description here

both tables consist of many different numbers of operation, as you can imagine this is very tedious.

Any help or ideas that can help me solve this is appreciated, I'm willing to try some other alternatives like fomulas, vba (preferred), even closedxml for c#

I dont know if im explaining my self? This is my logic. 1.-look for operation number 2.- Copy Sum of "Sx" 3.- Look in other sheet for the same operation number. 4.- Paste value in corresponding day. 5.- look for same operation number with next "Sx" ... 6.- End

Right now I'm just focusing on Operation1, since in Operation2 I use another sheet in witch I do the same thing. (will probably use the same code as Operation1).

  • To clarify I'm not asking for someone to just give me the solution (although it is appreciated ), but any guide on this is helpful.
asked 1 min ago



copy values from pivot table to sheet in specific cell

Javascript remove object from array with splice

Vote count: 0

i knows that there's tons of examples answering to my question but i'm still having problem to do it:

Here's my data:

$scope.data = [
    {
      users:[
        {name: 'Stephen', age: 50, dev: 'js', car: 'red', shoes:'green', happy:true, videoGame:[{isPlayer:true, console:'PS3'}]},
        {name: 'Stephen', age: 28, dev: 'angular', car: 'gold', shoes:'silver', happy:true, videoGame:[{isPlayer:false, console:'none'}]},
        {name: 'Adam', age: 43, dev: 'php', car: 'blue', shoes:'yellow', happy:true, videoGame:[{isPlayer:true, console:'XBOX'}]},
        {name: 'John', age: 27, dev: 'java', car: 'green', shoes:'black', happy:true, videoGame:[{isPlayer:true, console:'PC'}]},
        {name: 'Steve', age: 29, dev: 'ruby', car: 'white', shoes:'blue', happy:true, videoGame:[{isPlayer:false, console:'none'}]},
        {name: 'Pablo', age: 34, dev: 'java', car: 'pink', shoes:'red', happy:false, videoGame:[{isPlayer:true, console:'GAMEBOY'}]}
      ],
      futureUsers:[
        {name: 'Walter', age: 56, dev: 'js', car: 'red', shoes:'green', happy:true},
        {name: 'Jessi', age: 27, dev: 'angular', car: 'gold', shoes:'silver', happy:true},
        {name: 'Arnold', age: 34, dev: 'php', car: 'blue', shoes:'yellow', happy:true},
        {name: 'Bill', age: 67, dev: 'java', car: 'green', shoes:'black', happy:true},
        {name: 'Josh', age: 21, dev: 'ruby', car: 'white', shoes:'blue', happy:true},
        {name: 'Sam', age: 31, dev: 'java', car: 'pink', shoes:'red', happy:false}
      ]
    }
      ];

I want to remove in users the user who have the property videoGame with isplayer property set to false

Here's what i'm trying:

  $scope.removeNotPlayer = function(){
      for(var i=0; i<$scope.data.length; i++){
        if($scope.data[i].users.videoGame === false){
            $scope.data.splice(i, 1);
            break;
        }
      }
      return $scope.data;
  };

here's a link to a plunker:http://ift.tt/1yMUbuh

Any help would be kind, i'm a beginner forgive my question please.

asked 40 secs ago



Javascript remove object from array with splice

Python - Distance Vector routing simulation

Vote count: 0

I am using python to Simulate Distance vector routing. The goal is to create 4 routers and have them communicate and get the lowest cost.

I have to display each update on each router. Below I have the code for 1 of my routers. I believe this code should work as I have pieced it together from my server client version which worked for just the two communicating.

I am having an issue figuring out how to finish the code and get it to stop after all the updates are complete.

import socket, pickle
import sys

s = socket.socket()

host = ''
port = 50421

try:
    s.bind((host, port))
except (s.error , msg):
    print ('Bind failed. Error Code : ' + str(msg[0]) + ' Message ' + msg[1])
    sys.exit()

print ('Socket bind complete')
s.listen(4)

print ('Got connection from', addr)

table = [0,1,3,7]
router = 0;

print ('Router 0:', repr(table))

while 1:
data = router.recv(4095) 
data_arr = pickle.loads(data)

data = router.recv(4095)
otherRouter = pickle.loads(data)

print ('Router'repr(router)':', repr(data_arr))
print (' ')

for i in range(0, 4):
    if data_arr[i] + table[otherRouter] < table[i]: 
        table[i] = data_arr[i] + table[otherRouter]
        print (' ')
    print ('Adjusted Router 0:', repr(table))
    print (' ')
    else 
    print ('Nothing to update')

data_string = pickle.dumps(table)
client.send(data_string)
print (' ')
data_string = pickle.dumps(router)
client.send(data_string)
print (' ')
if 

asked 38 secs ago



Python - Distance Vector routing simulation

Jersey2 with Spring3: Abstract class JSON serialization and missing properties

Vote count: 0

I'm using Jersey-spring3 v2.17

All is working fine. Objects serialized from REST services are correctly exposed with JSON format.

Only objects from abstract classes are not correctly serialized. Only the type of the concrete class is present and correctly defined in the JSON object.

Some information regarding my configuration: Jersey / Jackson configuration in the Application configuration class:

register(JacksonFeature.class);

The abstract class:

    @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type")  
    @JsonSubTypes({  
            @Type(value = Dog.class, name = "dog"), 
            @Type(value = Cat.class, name = "cat"), 
            @Type(value = Horse.class, name = "horse") })
    public abstract class Animal {
private String name;
private String description
    ...

Output is currently on this format (no object property are present)

[{"type":"dog"},{"type":"cat"},{"type":"horse"}]

Any idea to fix my issue regarding missing properties in my JSON output ?

asked 29 secs ago
fvisticot
1,438



Jersey2 with Spring3: Abstract class JSON serialization and missing properties

Draw soft edge line in c# wpf

Vote count: 0

I'm trying to draw a line in WPF (C#). I use Line to do it. Picture is presented below:

enter image description here

As you see the line has hard edges. How can I fix this problem?

asked 1 min ago



Draw soft edge line in c# wpf

Sending Request-Payload data with a POST request?

Vote count: 0

Here is the Request-Payload data I'm trying to send:

------WebKitFormBoundaryliTECbsC0ebQkFD2
Content-Disposition: form-data; name="__EVENTTARGET"

ctl00$cphRoblox$pgItemsForResale$ctl02$ctl00
------WebKitFormBoundaryliTECbsC0ebQkFD2
Content-Disposition: form-data; name="__EVENTARGUMENT"


------WebKitFormBoundaryliTECbsC0ebQkFD2
Content-Disposition: form-data; name="__VIEWSTATE"

Here is what it's sending in request-payload format:

{"__EVENTARGUMENT":"ctl00$cphRoblox$pgItemsForResale$ctl03$ctl00"}
    "__EVENTARGUMENT":"ctl00$cphRoblox$pgItemsForResale$ctl03$ctl00"

Here's my code that I'm using to send the data:

var object = {"__EVENTARGUMENT" : "ctl00$cphRoblox$pgItemsForResale$ctl03$ctl00"},


$.ajax({
  url : "http://ift.tt/1DdZNdz",
  method : "POST",
  contentType: 'application/json; charset=UTF-8',
  dataType: 'json',
  data: JSON.stringify(object)
  success : function (data) {
    console.log(data)
}
})

How could I configure this to send the data I'm trying to send??

asked 47 secs ago



Sending Request-Payload data with a POST request?

When using "Controller as" syntax, what "scope" is the controller instance property published into?

Vote count: 0

The documentation for Controller says:

The controller instance can be published into a scope property by specifying ng-controller="as propertyName".

What is the scope that controller instance is published into? Where does that scope come from? Where can I learn more about this "scope"?

asked 2 mins ago
richard
3,762



When using "Controller as" syntax, what "scope" is the controller instance property published into?

Dont load markup around DNN Pane if its empty

Vote count: 0

How do i not load the markup around the DNN pane/panel if its empty and not logged in?

Like this

<div class="dont-load-if-pane-is-empty">
    <div class="dont-load-if-pane-is-empty">
        <div class="pane" id="pane" runat="server"></div>
    </div>
</div>

asked 52 secs ago



Dont load markup around DNN Pane if its empty

Android ListView, adding items from database in listview

Vote count: 0

I have a process in which a user selects a city, then sees medical practitioners in that state.

I have results that show the name of the medical practice:

 @Override
    protected void onResume() {
        super.onResume();

        setProgressBarIndeterminateVisibility(true);

        Bundle b = getIntent().getExtras();



        final String[] resultArr = b.getStringArray("selectedItems");

        String location = b.getString("selectedItems");



        ParseQuery<ParseUser> query = ParseUser.getQuery();

        query.orderByAscending(ParseConstants.KEY_PRACTICE_NAME);

        query.findInBackground(new FindCallback<ParseUser>() {
            @Override
            public void done(List<ParseUser> users, ParseException e) {
                setProgressBarIndeterminateVisibility(false);

                if (e == null) {
                    // Success
                    //store users variable in Parse to mMidwifeLocations
                    mMidwives = users;
                    mCurrentUser = ParseUser.getCurrentUser();
                    //mMidwifeType = ParseUser.getString("usertype");

                    //store users in string array, locations
                    String[] midwives = new String[mMidwives.size()];
                    String[] locations = new String[mMidwives.size()];
                    String check;
                    String location;

                    int i = 0;
                    for(ParseUser user : mMidwives) {
                        //get city value from user, assign it to check variable

                        location = user.getString("city");

                        check = user.getString("userType");

                        if (!Arrays.asList(midwives).contains(check) && type != "patient" && Arrays.asList(resultArr).contains(location) ) {

                            //in locations array, assign practiename values
                                midwives[i] = user.getString("practicename");


                        }
                    }
                    i++;

I also want to return in the list the primary contact, address, and practice philosophy..what is the best strategy to do this? I am using a simple_list_item_1 list type...there are other list types...wondering if using one of those might be the answer..thanks in advance..

asked 50 secs ago



Android ListView, adding items from database in listview

XCode 6.3 Produces an Invalid iOS Application Archive

Vote count: 0

After upgrading to Xcode 6.3, my existing swift-based Xcode project no longer can create a valid iOS application archive, so I can't submit it to the app store or distribute it.

The command-line build error is as follows:

Project name does not contain a single–bundle application or contains multiple products. Please select another archive, or adjust your scheme to create a single–bundle application.

It seems only one other person has run into this on SO ("After upgrading to Xcode 6.3, newly built iOS app archives can't be submitted") -- but the extensive workarounds suggested in the linked question haven't worked. My build settings have not changed from my 6.2 -> 6.3 project and they appear to be correct. I can still generate a valid archive in Xcode 6.2

Has anyone else experienced Xcode 6.3 generating invalid application archives, or know of any workarounds?

The contents of the bad archive

The archive artifact that xcode generates (in both debug and release mode) is clearly invalid. The info.plist inside the archive is missing critical information and there is no SwiftSupport directory in the root of the archive (unless this changed in XCode 6.3):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://ift.tt/vvUEPL">
<plist version="1.0">
<dict>
    <key>ArchiveVersion</key>
    <integer>2</integer>
    <key>CreationDate</key>
    <date>2015-04-16T19:27:31Z</date>
    <key>Name</key>
    <string>AppName</string>
    <key>SchemeName</key>
    <string>AppName</string>
</dict>
</plist>

Other potentially interesting stuff

  • Project is about 80% swift.
  • There's a single application extension.
asked 4 mins ago
smithclay
1,630



XCode 6.3 Produces an Invalid iOS Application Archive

update each row of postgres table using shell script

Vote count: 0

I have a shell script which has a list of ips.

Under the for loop of that script, every time 15 ips are picked and changed the status to 'removed'.

Can some expert shed some light on how should I update those list of ips under a shell script's for loop ? Meaning what should I do from inside the for loop of shell script to make those continous changes to postgres database ?

asked 27 secs ago



update each row of postgres table using shell script

Building HTTP POST request for registering printer with Google Cloud Print service

Vote count: 0

I am trying to register a printer by sending a HTTP POST request using the Google Cloud Print register API at:

http://ift.tt/1J7osHT

Here's my source code:

void IllustratePostWithData(const char* url, HttpTransport* transport){

    scoped_ptr<HttpRequest> request(transport->NewHttpRequest(HttpRequest::POST));
    request->AddHeader("X-CloudPrint-Proxy", "my proxy");
    request->set_content_type("multipart/form-data; boundary=-----------RubyMultipartPost");
    request->HttpHeader_CONTENT_LENGTH;
    request->set_url(url);
    util::Status status = request->Execute();
    if (!status.ok())
        cerr << status.error_message();

    HttpResponse *response = request->response();
    if (response->ok()) {
        cout << "Success" << endl;
    } else {
        cout << "Failed with status=" << response->status().error_message() << endl;
    }
    string body;
    util::Status stat = response->GetBodyString(&body);
    cout << "Received HTTP status code =" << response->http_code() << endl;
    if (stat.ok()) {
        cout << "HTTP body" << body << endl;
    }
}

int main() {
    char* Cloud_print_url = "http://ift.tt/1JqX44f";
    scoped_ptr<HttpTransport> transport;

    HttpTransportFactory* factory = new CurlHttpTransportFactory();
    HttpTransport* globalTransport = factory->New();

    IllustratePostWithData(Cloud_print_url, globalTransport);
    return 0;
}

I get the following response:

Success
Received HTTP status code =200
HTTP body{
 "success": false,
 "message": "Proxy ID is required.",
 "request": {
  "time": "0",
  "params": {
  }
 },
 "errorCode": 115
}

Going through the API, I could not find a function to set proxy. Am I missing out on something in the HTTP POST request?

Thanks

asked 2 mins ago



Building HTTP POST request for registering printer with Google Cloud Print service

Enable gzip on Nginx without "'http' directive is not allowed here" error

Vote count: 0

I've inherited a code base that needs gzip enabled. I added these lines to my nginx staging.conf file (which shows up in two more places: /etc/nginx/sites-enabled/ and /etc/nginx/sites-available/):

http {
    # enable gzip compression
    gzip             on;
    gzip_min_length  1100;
    gzip_buffers     4 32k;
    gzip_types       text/plain application/x-javascript text/xml text/css;
    gzip_vary        on;
    gzip_disable     "MSIE [1-6]\.(?!.*SV1)";
    # end gzip configuration
}

But when I try to restart nginx, it fails (without any error message), and running "sudo nginx" gets me this error: nginx: [emerg] "http" directive is not allowed here in /etc/nginx/sites-enabled/staging.conf:37

This is the entire conf file:

# Myexample staging nginx setup. This is meant to be included in /etc/nginx/sites-available.

ssl_certificate      /home/django/http://ift.tt/1K2us26;
ssl_certificate_key  /home/django/http://ift.tt/1yMuzOh;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA !RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS";

server {
    listen 80;
    listen 443 ssl;
    server_name http://ift.tt/1K2us28;

    return 301 $http://ift.tt/1yMuCcV;
}

server {
    listen 80;
    listen 443 ssl;
    server_name stagingpy.myexample.io;

    access_log /var/log/nginx/myexample_access.log;
    error_log  /var/log/nginx/myexample_error.log;

    location ^~ /apple-touch-icon { root /home/django/http://ift.tt/1K2us2a; expires  1h; }
    location = /favicon.ico       { root /home/django/http://ift.tt/1K2us2a; expires  1h; }
    location = /humans.txt        { root /home/django/http://ift.tt/1yMuCta; expires  1h; }
    location = /robots.txt        { root /home/django/http://ift.tt/1yMuCta; expires  1h; }
    location /static/             { root /home/django/myexample.io/           ; expires 30d; }

    location / {
        uwsgi_pass  unix:///var/run/uwsgi/app/staging/socket;
        include     uwsgi_params;
    }
}

http {
    # enable gzip compression
    gzip             on;
    gzip_min_length  1100;
    gzip_buffers     4 32k;
    gzip_types       text/plain application/x-javascript text/xml text/css;
    gzip_vary        on;
    gzip_disable     "MSIE [1-6]\.(?!.*SV1)";
    # end gzip configuration
}

I've tried putting the http block after the server blocks and before the server blocks, and I've tried putting the server blocks into the http block, but none of these things have worked. I get the same problem on my production server (the production.conf file looks pretty much the same, except without the "stagingpy" subdomain).

Where should the http block go so that I can restart nginx successfully and have gzip enabled for file compression?

asked 25 secs ago



Enable gzip on Nginx without "'http' directive is not allowed here" error

Comments in all the same page

Vote count: -2

i have for example two articles and when i post a comments, the comments display in both pages.

i dont know what part of the code show you?

this is the beginning of the two page

<?php
    session_start();

    try {
        $connection = new MongoClient();
        $database   = $connection->selectDB('projet');
        $collection = $database->selectCollection('articles');
    } Catch(MongoException $e) {
        die("Failed to connect to database ".$e->getMessage());
    }

    $cursor = $collection->find();

    ?>

asked 1 min ago



Comments in all the same page

C++ extern pointer

Vote count: 0

So I'm writing a program which has a big class called oglapp, and a whole bunch of other classes using it. What I want to achieve is to have a super-global oglapp* across all my .cpps. My approach is to declare an oglapp* in the main.cpp, which has the entry point (which sets up the pointer and starts running the class), and I have an extern reference at the end of the header file of oglapp. In theory, if I use the oglapp class anywhere in my project I need to include the header for it, which includes the extern, and I'm good. This is sorta what I have:

//main.cpp
oglapp* app;
entrypoint(){app=new oglapp(); app->run();}

//oglapp.h
class oglapp { ... }; extern oglapp* app;

//classX.h
#include "oglapp.h"
classX { ... };

//classX.cpp
#include "classX.h"
void classX::somefunction(){app->dosomething();}

What I get is a big null reference error. I tried including the oglapp header from the .cpp of classX, also tried putting the extern oglapp* app; to each of the classXs individually, I tried everything I could think of. Also, weirdly enough, I don't get null reference errors in all the classXs. Some of them can use the app without a problem, some of them see it as a null pointer. I've yet to discover what determines if it's working or not.

What am I doing wrong? Also, if it's impossible to declare a single super-global pointer to a class this way, how should I go about doing it?

asked 30 secs ago



C++ extern pointer

Handling EXCEPTION response from WMS Server

Vote count: 0

I tried to get a map image from a wms server using the following code.

<!doctype html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Playing with fis broker berlin</title>

  <link rel="stylesheet" href="../../libs/ol3/css/ol.css"/>
  <link rel="stylesheet" href="../../css/samples.css"/>

</head>
<body>
<div id="map" class="map"></div>
<script src="../../libs/ol3/js/ol.js"></script>

<script>

  var imageSource = new ol.source.ImageWMS({
    url: 'http://ift.tt/1J78RYX',
    params: {
      'LAYERS': '0',
      'REQUEST': 'GetMap',
      'STYLES': ['default'],
      'SRS': 'EPSG:4326',
      'BBOX': [13.079, 52.3284, 13.7701, 52.6877],
      'WIDTH': '256',
      'HEIGT': '256',
      'FORMAT': 'jpeg'
    }
  })

  imageSource.on('imageloaderror', function (event) {
    var imageState = event.target.getState()
    var request = event.image.n

    console.log('imageloaderror, state = ' + imageState)
    console.log('request: ' + request)
  })

  var imageLayer = new ol.layer.Image({
    opacity: 0,
    source: imageSource
  })

  var view = new ol.View({
    center: [13.4297269, 52.4594867],
    zoom: 10
  })

  var map = new ol.Map({
    target: 'map',
    layers: [imageLayer],
    view: view
  })
</script>

</body>
</html>

ol3 fails to show the image, because the wms sends backs a xml exception report instead of jpeg data meaning crs is not permitted: EPSG:3857. On the java console we see the message Resource interpreted as Image but transferred with MIME type text/xml ...

I understand, that the image source is not set up correctly. This needs further investigaton by me. But My question is: How can I catch the message crs is not permitted: EPSG:3857 and any other error messages from the wms server by the ol script?

asked 1 min ago



Handling EXCEPTION response from WMS Server

Unable to read an uploaded multipart xml file

Vote count: 0

I am trying to write a service that receives a xml file and parses it and does some additional processing. At the UI controller I converted the multipart file contents to a string and passed it to the service. From the UI controller - I upload the file and call the service method to parse the xml file

 MultipartFile newFile=multiPartRequest.getFile("newFileUpload");
 String fileContent = new String(newFile.getBytes());
 DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
 DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
 InputSource is = new InputSource(new StringReader(fileContent));
 doc = dBuilder.parse(is);

However, doc is always null. What is the best way for me to rest this xml file?

asked 56 secs ago
Mary
103



Unable to read an uploaded multipart xml file

Svm missing value where TRUE/FALSE needed in R

Vote count: 0

I'm trying to implement binary svm. I've got the following error message:

Error in if (any(co)) { : missing value where TRUE/FALSE needed

For the following code:

library(e1071)
dataset <- read.csv("C:/Users/Backup/Desktop/pos.csv")
# Subset the dataset dataset to only 2 labels and 2 features
dataset.part = subset(dataset, label != 1)
dataset.part$label = factor(dataset.part$label)


# Fit svm model
fit = svm(label ~ ., data=dataset.part, type='C-classification',   kernel='linear')

# Make a plot of the model
dev.new(width=5, height=5)
plot(fit, dataset.part)

# Tabulate actual labels vs. fitted labels
pred = predict(fit, dataset.part)
table(Actual=dataset.part$label, Fitted=pred)

# Obtain feature weights
w = t(fit$coefs) %*% fit$SV

# Calculate decision values manually
dataset.scaled = scale(dataset.part[,-3], fit$x.scale[[1]],  fit$x.scale[[2]]) 
t(w %*% t(as.matrix(dataset.scaled))) - fit$rho

# Should equal...
fit$decision.values

I'm a beginner in R and i don't know how to solve this. Could any one help me?

asked 1 min ago



Svm missing value where TRUE/FALSE needed in R

parameter numIter in stronglyConnectedComponents (GraphX Spark)

Vote count: 0

I am making myself familiar with GraphX library from Spark using the guide http://ift.tt/1pA8E5Q However, reading this (and searching the internet) I couldn't realize what is the input parameter numIter of function stronglyConnectedComponents: def stronglyConnectedComponents(numIter: Int): Graph[VertexID, ED]

Could you help me to understand what does it mean here and what algorithm is used for SCC by GraphX?

asked 44 secs ago



parameter numIter in stronglyConnectedComponents (GraphX Spark)

Infrastructure-less communication between iPhone and Windows PC

Vote count: -2

I’m researching how to wirelessly send data (without using any infrastructure such as a Wifi router) between an iOS app (that we want to publish on the App Store) and a Windows library that I might develop if this is possible. I need to send a few tens of kilobytes at a time and waiting a few seconds for the transmission each time would be acceptable.

Here a a few obvious ideas, and why we can’t use them:

  • Bluetooth Low Energy: BLE is not be available on all PCs that we need to support and it’s not practical to send Bluetooth USB sticks to all our users.

  • Open hotspot on PC, connect iPhone to it: There are PCs with an old Wifi chipset that doesn’t allow this.

  • Open hotspot on iPhone, connect PC to it: When there is no cell coverage, the hotspot is automatically disabled by iOS and there is no way to re-open it programmatically without using private APIs (which we can’t use). Please correct me if I’m wrong about this.

Regarding the wireless, electromagnetic communication methods, basically the only thing that we can rely on is that the PC can connect to a Wifi hotspot.

This led to the idea that the PC could connect to the iPhone on the infrastructure Wifi access point that is opened to support the peer-to-peer features that some of the iOS frameworks use to communicate between devices. I’m aware of these: GameKit and Multipeer Connectivity (please let me know if you know of additional infrastructure-less peer-to-peer communication methods). From what I’ve read and tried (in the case of Multipeer Connectivity), both frameworks can function without bluetooth and since they are supported on iPhones that don’t have a Wifi chipset that supports P2P-Wifi, at least one side must open an infrastructure access point.

I read on Engadget that Apple has made it really difficult to reverse engineer and develop an independent implementation of the GameKit protocol: http://ift.tt/1PbAJeV

How the Multipeer Connectivity communication works hasn’t been documented by Apple, but I’ve found this presentation from a security researcher that explains who the connection is established: http://ift.tt/1HraKNK

The question is now if it is possible (and how much time it would take) to further reverse-engineer and re-implement the required parts of one of those protocols. Maybe you know about someone who has started such a project? (I couldn’t find anything on Google.)

Please reply with any additional ideas for a solution, or if I’m wrong about any of my assumptions why certain things can’t work.

asked 1 min ago



Infrastructure-less communication between iPhone and Windows PC

Objective-C Variable naming

Vote count: -1

I have a question about naming variables. I have noticed that many people name their variables with a lower case first then a upper case. Is that just their way of naming it or is there something behind it? eg.

IBOutlet UITextField *addressBar; IBOutlet UIButton *startGame;

asked 1 min ago



Objective-C Variable naming

Detect Encoding with Java

Vote count: 0

i need r help pleas?

i have an example wich is working very fine. with this example (see code below) I can detect the encoding of file using universaldetector framework from mozilla.

but I want that this example detect the encoding of input and not of the file for Example using class SCANNER? how can i modify the code below to detect the encoding of input instead of file?

thanx in advance

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import org.mozilla.universalchardet.UniversalDetector;

public class TestDetector {
  public static void main(String[] args) throws java.io.IOException {
    byte[] buf = new byte[4096];


    java.io.FileInputStream fis = new java.io.FileInputStream("C:\\Users\\khalat\\Desktop\\Java\\toti.txt");


    // (1)
    UniversalDetector detector = new UniversalDetector(null);

    // (2)
    int nread;
    while ((nread = fis.read(buf)) > 0 && !detector.isDone()) {
      detector.handleData(buf, 0, nread);
    }

    // (3)
    detector.dataEnd();

    // (4)
    String encoding = detector.getDetectedCharset();
    if (encoding != null) {
      System.out.println("Detected encoding = " + encoding);
    } else {
      System.out.println("No encoding detected.");
    }

    // (5)
    detector.reset();
  }
}

asked 52 secs ago



Detect Encoding with Java

Fancybox Youtube videos not working on Firefox

Vote count: 0

This is my config for my videos. On Chrome everything is fine but on Firefox when I click my link Firefox tries to download link.

I'm using iframe but on Firefox it says x-shockwave-flash. My Firefox has not flash extention. I don't want to work with flash. How can I fix it?

enter image description here

$(document).ready(function () {
  $("a.productVideo").click(function() {
      $.fancybox({
          'padding'       : 0,
          'autoScale'     : false,
          'autoPlay'      : true,
          'transitionIn'  : 'none',
          'transitionOut' : 'none',
          'title'         : this.title,
          'width'         : 680,
          'height'        : 495,
          'href'          : this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
          'type'          : 'iframe',
          'iframe'        : {
              scrolling : 'auto',
              preload   : true
          }

      });
      return false;
  });
}); // ready

asked 2 mins ago
hakkikonu
1,089



Fancybox Youtube videos not working on Firefox

How to loop through files in directory with order

Vote count: 0

I would like to loop through a directory with a certain order. Let 's say I have files named 1,2,3,4 in the directory. When I use for i in *; , I get this order 1,2,3,4. How can I change it to get the other order 4,3,2,1

asked 2 mins ago



How to loop through files in directory with order

Prevent scrolling back to first slide after scrolled past

Vote count: 0

I'm using fullpage.js and was wondering how I would go about preventing the user from scrolling back to the initial (first) slide after they've scrolled past it?

I still want to be able to scroll between all subsequent slides as intended, but essentially remove the first slide once past it so that it cannot be scrolled back up (basically making the second slide the first, as if the first is no longer there).

Hopefully this makes sense? The first slide is basically an intro/video slide and I only want it shown on initial page load, then after scrolled passed for it to no longer be accessible.

asked 3 mins ago



Prevent scrolling back to first slide after scrolled past

Using Jquery to animate logo in

Vote count: 3

I have text that I want to be swapped out for a logo once the user scrolls past a certain point. I already have this working

http://ift.tt/1Ob28At

The issue is that it just swaps the two items. I actually want a nice animation in. Maybe the logo appearing from the top and pushing out the text. I'm not really sure how to achieve this.

JavaScript

$(document).on('scroll', function() {
    if($(window).scrollTop()> 200) {
        $('#logo2').show();
        $('#logo1').hide();
    }
    else {
        $('#logo2').hide();
        $('#logo1').show();
    }
});

jsve
2,719
asked 9 mins ago

2 Answers

Vote count: 4

for simple fade you can use

$('#logo2').fadeOut();
$('#logo1').fadeIn();

or

$('#logo2').slideOut();
$('#logo1').slideIn();

for more complex animations you will need to use animate [http://ift.tt/kmaMBU] and set the options

options = {123: 456};
$('#logo2').animate(options);

answered 6 mins ago
DrCord
1,658

Vote count: 1

You can use fadeOut/fadeIn, slideOut/slideIn of you can create your own animation using animate method in jQuery.

Docs: http://ift.tt/kmaMBU

answered 4 mins ago
Tushar
634


Using Jquery to animate logo in

Lipo error while converting ARC

Vote count: 0

I am trying to convert ios old project(which does not contain ARC) to ARC i got following error

/Applications/http://ift.tt/Jy6XVe: can't figure out the architecture type of: /Volumes/Macintosh HD 2/xyziPhone-11-03-15/xyz.build/Objects-normal/i386/xyz

thank you

asked 1 min ago



Lipo error while converting ARC

Order of group element, 'NoneType' object has no attribute 'value'

Vote count: 0

I am trying to write a function to find the order of an element of a group. I keep getting this message " 'NoneType' object has no attribute 'value' ". Here is my code :

def order_group_element(G, x):
    if not ((IsSymmetricGroup(G) or IsCyclicGroup(G)) and x in G):
       raise ValueError
   identity = G.identity()
   if x == identity:
       return 1
   a = 2
   i = x
   while not i == identity:
       i = G[i]
       a = a + 1
   return a 

My input would be similar to the following:

a = CyclicGroup(500)
print 'G[1] Order = ',order_group_element(a, a[1])

I get the error from this line in my function:

while not i == identity:

Any help would be much appreciated. Thanks, Andy.

asked 1 min ago



Order of group element, 'NoneType' object has no attribute 'value'

How to update a wordoress translation file

Vote count: 0

I want to localize a wordpress plugin and translate it to Persian with POEDIT. I created the fa_IR.po , fa_IR.mo and all the texts loaded but when i write the translation texts and save the file, nothing happens, and it still shows me english texts in front-end.What should i do?! enter image description here

asked 1 min ago



How to update a wordoress translation file

Object detection in images (HOG)

Vote count: 1

I want to detect objects inside cells of microscopy images. I have a lot of annotated images (app. 50.000 images with an object and 500.000 without an object).

So far I tried to extract features using HOG and classifying using logistic regression and LinearSVC. I have tried several parameters for HOG or color spaces (RGB, HSV, LAB) but I don't see a big difference, the predication rate is about 70 %.

I have several questions. How many images should I use to train the descriptor? How many images should I use to test the prediction?

I have tried with about 1000 images for training, which gives me 55 % positive and 5000, which gives me about 72 % positive. However, it also depends a lot on the test set, sometimes a test set can reach 80-90 % positive detected images.

Here are two examples containing an object and two images without an object:

object01

object02

cell01

cell02

Another problem is, sometimes the images contain several objects:

objects

Should I try to increase the examples of the learning set? How should I choose the images for the training set, just random? What else could I try?

Any help would be very appreciated, I just started to discover machine learning. I am using Python (scikit-image & scikit-learn).

asked 2 mins ago



Object detection in images (HOG)

if (time < 10) { greeting = "Good morning";} else if (time < 20) { greeting = Good day";} else { greeting = "Good evening";}

Vote count: 0

if (time < 10) {  
   greeting = "Good morning";
} else if (time < 20) {  
   greeting = Good day";
} else { 
   greeting = "Good evening";
}

asked 1 min ago



if (time < 10) { greeting = "Good morning";} else if (time < 20) { greeting = Good day";} else { greeting = "Good evening";}

Changing path in an config file stored in TFS

Vote count: 0

We have a solution stored in TFS that deploys to SharePoint. As part of the solution we have a config file that has a path to a specific site. The problem is this path changes dependent on the users dev machine e.g

<site>devmachine1/somesite</site>
<site>devmachine2/somesite</site>

This can obviously be updated to work locally after a check out however when the file gets checked back in it will be incorrect on the next users machine if they do a Get. Is there a way that the file can be excluded or a script can be run to update the path when checked back in or out?

asked 2 mins ago



Changing path in an config file stored in TFS

How to define several figure-objects in matplotlib?

Vote count: 0

I would like to define two figures objects and then in a loop I would like to contribute to each of them. The following code will not work but it demonstrate how it works.

import matplotlib.pyplot as plt

plt1.figure()
plt1.xticks(rotation=90)

plt2.figure()
plt2.xticks(rotation=90)

for i in range(5):

   plt1.plot(xs_a[i], ys_a[i], label='line' + str(i))
   plt2.plot(xs_b[i], ys_b[i], label='line' + str(i))

plt1.savefig(fname_1)
plt2.savefig(fname_2)

I always perceived plt as an image object for which I can set some parameters (for example xticks) or to which I can add some curves. However, plt is a library that I import. So, what I should do when I need to define two or more figure objects?

asked 2 mins ago
Roman
9,483



How to define several figure-objects in matplotlib?

Laravel hasManyThrough and lazy eager loading

Vote count: 0

I have the following models set up in Laravel 5 (everything is namespaced into App\Models, but I've removed that for readability) :

class Client extends Model {
    public function templates() { return $this->hasMany('Template'); }
    public function documents() { return $this->hasManyThrough('Template', 'Document'); }
    public function users() { return $this->hasMany('User'); }
}

class Template extends Model {
    public function client() { return $this->belongsTo('Client'); }
    public function documents() { return $this->hasMany('Document'); }
}

class Document extends Model {
    public function template() { return $this->belongsTo('Template'); }
}

In a controller, I have the current user:

$user = \Auth::user();
$client = $user->client;

I want to show a list of

  • the templates for a client
  • the documents for a client, separately, not grouped by template

It seems easy enough; I already have both of the relations needed. The question is, if I lazy eager load templates and documents onto $client, do I still need to eager load templates.documents (hasManyThrough) or is Laravel smart enough to realise?

$client->load( 'templates', 'documents' );
// or...
$client->load( 'templates', 'documents', 'templates.documents' );

asked 39 secs ago
Joe
10.7k



Laravel hasManyThrough and lazy eager loading

Create Defaul Page in Subfolder in VB.Net

Vote count: 0

I created a web project in VB.Net and deployed it on an IIS 7.0.

This application is in a sub folder named /api.

I am unable to set the default document for this sub folder

I already tried to make a web.config entry with following code:

 <system.webServer>
      <defaultDocument enabled="true">
           <files>
                <clear/>               
                <add value="Default.htm"/>
           </files>
     </defaultDocument>
 <system.webServer>

But this doesn't work. I'm always getting a 404 error when accessing this sub folder by browser.

The list with the default documents which is configured in my IIS includes the following entry:

Default.htm

asked 1 min ago



Create Defaul Page in Subfolder in VB.Net

slideDown immediate li and slide up other li elements

Vote count: 0

I want to slideUp all li element and slideDown li elements under current ul element

 $(document).ready(function(){
     $("li").slideUp();
    });


     $(".nav").hover(function(e){
         $(this).children("li").slideDown();
          $("li").slideUp();
         e.stopPropogation();
     });

this is the fiddle

Problem is it is sliding up everything in the end What is the mistake i have done?

asked 1 min ago
vignesh
1,396



slideDown immediate li and slide up other li elements

HOW TO STORE C# COMPLEX OBJECT WITHOUT SESSION

Vote count: 0

Expert can anybody tell me how can i store c# complex object without session & viewstate that uses cookiescontainer class. i have created a class which is used for screen scraping for another website, keep tracking this site's session in cookiescontainer class. it is work fine for destop application. but when same application i used for web application, then it needs object to get saved for next concurrent access to website. now my criteria is that i want to save that object without session. i am using it inside webmethod

asked 36 secs ago
arup
19



HOW TO STORE C# COMPLEX OBJECT WITHOUT SESSION

Intelij Plugin Development add eventListener so when i press esc all line highlighters disappear

Vote count: 0

I have this code

private static void highlightElement(int lineNum,Project project,VirtualFile virtualFile) {

    final FileEditorManager editorManager =
            FileEditorManager.getInstance(project);
    final Editor editor = editorManager.getSelectedTextEditor();
    final TextAttributes textattributes = new TextAttributes(null, new Color(239, 43, 18), null, EffectType.LINE_UNDERSCORE, Font.PLAIN);
    editor.getMarkupModel().addLineHighlighter(lineNum, HighlighterLayer.CARET_ROW, textattributes);
    editor.getMarkupModel().
    final WindowManager windowManager = WindowManager.getInstance();
    final StatusBar statusBar = windowManager.getStatusBar(project);
    statusBar.setInfo("Press Esc to remove highlighting");
}

The code works as intended but what i want is to attach an event listener so when i press esc the function editor.getMarkupModel().removeAllHighlighters(); will be called.Thank you in advance!

asked 27 secs ago



Intelij Plugin Development add eventListener so when i press esc all line highlighters disappear

Migrate from jsdom to phantom JS ? (basic DOM creation)

Vote count: 1

M. Bostock pointed out that nodejs' jsdom have incomplete support for svg, and, critical for me, doesn't support getBBox(). Also, he advised to switch to nodejs' PhantomJS.

My nodejs + jsdom script create a virtual DOM, with which my d3js plays and is as follow :

var jsdom = require('jsdom');
jsdom.env(
  "<html><body></body></html>",        // CREATE DOM HOOK,
  [ 'http://ift.tt/JmLP3T',    // JS DEPENDENCIES online ...
  '../js/d3.v3.min.js',                // ... & local
  '../js/jquery-2.1.3.min.js'],

  function (err, window) {
           //my normal JS code here !
  }
);

How to migrate nodejs + jsdom into nodejs + PhantomJS ?

asked 1 min ago
Hugolpz
3,248



Migrate from jsdom to phantom JS ? (basic DOM creation)

Android whats URI in simple SqliteQueryBuilder class

Vote count: 0

i want to use simple SqliteQuery builder in this link, but in this page refer to developer we can simply use :

Cursor c = new QueryBuilder()
    .select( "_id" )
    .whereColumnEquals( "firstname", "Jesper" )
    .query( context, uri );

in this sample i dont know whats uri and i can not how to combine this class with my sqliteHelper class, i want to use QueryBuilder with my created database in this class:

public class SqliteHelper extends SQLiteOpenHelper {

    /**
     * CATEGORIES LIST Table
     */
    public static String TB_CATEGORY = "categories_list";
    //------------------ Field_Category_Id
    public static String F_C_ID = "_id";
    public static String F_C_TITLE = "title";
    public static String F_C_FOLLOWERS = "followers";
    public static String F_C_TYPE = "type";
    public static String F_C_DATE = "date";

    public  static String DATABASE_NAME = "db.sqlite";
    private static int DATABASE_VERSION = 3;

    public SqliteHelper(Context context) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        ...
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        ...
    }
}

for example:

Cursor c = new QueryBuilder()
    .select( sqliteHelper.F_C_ID )
    .whereColumnEquals( "firstname", "Jesper" )
    .query( getBaseContext() , uri );

how to set correct uri for my sqlite helper class

asked 34 secs ago



Android whats URI in simple SqliteQueryBuilder class

How do I custom label a node in Spring Data Neo4j 3.0 (Release)?

Vote count: 0

I have an @NodeEntity Person class. I'd like the label in the database to be uppercase (:PERSON). I've seen examples @Label("Person") and @NodeAlias("Person") but neither seem to exist.

asked 1 min ago
Spider
2,946



How do I custom label a node in Spring Data Neo4j 3.0 (Release)?

Does APUu benefits Symfony2 natively

Vote count: 0

I used to run Symfony with APC to achieve better performance. APC provides two features :

  • bytecode caching
  • Cross-page, in-memory server side caching.

With newer PHP versions, APC is deprecated. I will use the native opcache for the first feature.

However, I'm wondering about installing APCu for caching. If Symfony and its core bundles (Doctrine, Twig...) don't rely on APC memory caching functions, then installing APCu won't affect performance at all.

So does Symfony2 natively leverage APCu / the memory caching part of APC?

asked 32 secs ago



Does APUu benefits Symfony2 natively

Scattered data in Cartesian coordinates to Polar coordinates. Matlab

Vote count: 0

This is my problem:

I have a group of scattered data that is related to some measurements of Antenna Testing. The data is in Cartesian coordinates, and is limited by a grid of X=-7,7 and Y=-7,7. I have already interpolated the scattered data in to a grid in this way:

Matlab Code:

F_cp=scatteredInterpolant(X,Y,E_cpdB);
x=-7:lda/2:7;
y=-7:lda/2:7;
[x1,y1]=meshgrid(x,y);
IM_cp=F_cp(x1,y1); %Interpolation evaluated in a grid of X=Y=-7*7 

Where X and Y are the scattered coordinates and E_cpdB is a Scattered vector of values (Electric Field in dB). The results of the interpolation are as expected:

[I cannot post images yet]

Now I need to interpolate and plot that Scattered data in Polar coordinates. I'm still using the same Function obtained by "scatteredInterpolant()". So this is what I've done:

%% Conversion to polar Coordinates
 th=-2*pi:pi/16:2*pi;
 ro=0:0.05:sqrt(7^2+7^2);
[th1,ro1] = meshgrid(th,ro);
[x2,y2]=pol2cart(th1,ro1);
IMp_cp=F_cp(x2,y2);

So I created a Grid with my limits in terms of Polar coordinates (TH,Ro), next that grid is converted to Cartesian, and the function of the Scattered Data is evaluated with respect to the new Grid Points. The result is not as I expect.

I have already used "interp2", I have also converted straight forward the Scattered Cartesian coordinates to Polar ones and interpolated the data. But the results are not as expected, the magnitude is changing without any reason.

For the ones that have worked with Antenna measurements, this is data extracted from FEKO related to a Compensated Compact Range measurement.

I need your ideas for the conversion of coordinates and respective interpolation. Thanks in advance!

asked 1 min ago



Scattered data in Cartesian coordinates to Polar coordinates. Matlab

Scheme, generating states to solve a 2x2x2 rubick's sphere

Vote count: 0

For a scheme assignment I need to write a brute force solver for a 2x2x2 rubick's sphere.

Half of the sphere can turn in positive/negative x, y and z directions.

My function genStates is meant to take in a state and generate 6 states from it saving the moves to reach those states in a second list (with matching indices to access later)

A state is a list of positions and directions ((1 1) (2 1) (3 1) (4 1) (5 3) (6 3) (7 3) (8 3)) and is coupled with a moves list ("x" "Y" "y" "Z").

My problem is that I can't seem to save the states and moves in the way I'd like.

(list
    (list
        ;all states
    )
    (list
        ;all moves
    )
)

My genStates function

(define (genStates n state moves)
    (if (= n 0)
    ;if last recurse just return current state
        (list state moves)
    ;else call helper
        (genHelper n (generateSuccessorStates state moves))

    )
)

My genHelper function

(define (genHelper n state)
    (list
        (append (append (append (append (append 
                                        (genStates (- n 1) (index (car state) 0) (index (cdr state) 0))
                                        (genStates (- n 1) (index (car state) 1) (index (index state 4) 0)))
                                (genStates (- n 1) (index (car state) 2) (index (cdr state) 2)))
                        (genStates (- n 1) (index (car state) 3) (index (cdr state) 3)))
                (genStates (- n 1) (index (car state) 4) (index (cdr state) 4)))
        (genStates (- n 1) (index (car state) 5) (index (cdr state) 5)))
    )
)

This method seems to return the states as ("x" "X" "y" "Y" "z" "Z") just before each 6 lines of states instead of as lists of moves at the end.

I have been able to produce the correct output using print statements and forking each time without appending to a list but I'm unsure how to collect the data from the recursive calls.

My generateSuccessorStates function

(define (generateSuccessorStates state prevMoves) 
(list
    (list
        (rotate "x" state)
        (rotate "X" state)
        (rotate "y" state)
        (rotate "Y" state)
        (rotate "z" state)
        (rotate "Z" state)
    )
    (list
        (append prevMoves '("x"))
        (append prevMoves '("X"))
        (append prevMoves '("y"))
        (append prevMoves '("Y"))
        (append prevMoves '("z"))
        (append prevMoves '("Z"))
    )
)
)

To any of my classmates who may likely see this, I am of course fine with you using my ideas but please don't just copy paste my code into your project. That will end badly for everyone involved.

asked 1 min ago



Scheme, generating states to solve a 2x2x2 rubick's sphere

Appstore Architecture warning

Vote count: 0

I developed first version app in xcode 5 and the second version work with xcode 6 , in this version i have drop box sdk1.3.13 it is not support the arm64 so i removed this from valid architecture now my app work fine and my STANDARD ARCHITECTURE is armv7,arm64 and my VALID ARCHITECTURE is armv7 , armv7s. I submitted my app into appstore in my validation warning is

The archieve passed validation with several warnings

iTunes store operation failed

    Missing 64-bit support. Starting February 1, 2015, new iOS apps uploaded to the App Store must include 64-bit support and be built with the iOS 8 SDK, included in Xcode 6 or later. To enable 64-bit in your project, we recommend using the default Xcode build setting of "Standard architectures" to build a single binary with both 32-bit and 64-bit codes.

My Question is

1.If i will submit my app without clear this issue the appstore will accept or not?

2.Please clearly explain why the warning is occur , what mistake i did in my STANDARD ARCHITECTURE and VALID ARCHITECTURE

3.Why the Dropbox sdk 1.3.13 not supported the arm64 architecture?

asked 1 min ago



Appstore Architecture warning

Creating an irregular UIButton in Swift where transparent parts are not tappable

Vote count: 0

I am making a pie chart where each sector is a separate button with a background image, but UIButton has a rectangular shape and all the buttons overlap. Is there a way to make a UIButton the exact shape of an irregular image (in Swift) so this does not happen?

Any help would be appreciated

asked 1 min ago



Creating an irregular UIButton in Swift where transparent parts are not tappable

About wifi scanning in iOS

Vote count: 0

I'm wondering if it's possible to scan wifi networking nearby like what WiFi Map did? And in this application, it can even provide password of the wifi hotspot. Is it legal and what kind of technology is used? Thanks.

asked 36 secs ago



About wifi scanning in iOS

Cannot get repository contents as .zip file (zipball) in Octokit.net

Vote count: 0

I am using Octokit.net version 0.9.0 (GitHub API for .NET) for getting zip contents of few repositories.

I already have the list of repositories I need but I am having trouble with getting the the content of the repositories as .zip files (called zipball)

What I've tried so far

// ... client = new Client(...);
// some authentication logic...
// some other queries to GitHub that work correctly
var url = "http://ift.tt/1aNfRLy";
var response = await this.client.Connection.Get<byte[]>(
        new Uri(url),
        new Dictionary<string, string>(),
        null);
var data = response.Body;
var responseData = response.HttpResponse.Body;

Problems with my attempts

  1. data is null
  2. responseData.GetType().Name says the responseData is of type string
  3. When I try Encoding.ASCII.GetBytes(response.HttpResponse.Body.ToString()); I get invalid zip file

Quesion

What is the correct way to get zipballs of repositories after being authenticated using Octokit.net library?

I've also opened an issue in octokit.net repository.

asked 4 mins ago



Cannot get repository contents as .zip file (zipball) in Octokit.net

opencart How to display in cart item quantity if item added to cart in category page

Vote count: 0

I am using opencart 1.5.6.4

I would like to display the count of each item in cart on the item in category page, whenever item is added to cart the quantity of the item in cart will be displayed on the item.

this is opencart website example using the same function: http://trolley.ae/fruit

is there any code or extension to do this?

asked 36 secs ago



opencart How to display in cart item quantity if item added to cart in category page

lundi 20 avril 2015

jQuery .on is not recognizing new link elements in a warning callout

Vote count: 0

I have the following code to display an error message if someone already has a registered email address:

$output['error'] = __('Email is taken. Is that you? Try to <a href="#" data-template="login">login</a> to this site or 
<a href="#" id="extend_membership_email">extend your membership to this site</a>
<input type="hidden" id="extend_membership_email_value" value="'.$input_value.'">','userpro');

I then have the following JS to check this:

$( "#extend_membership_email" ).on('click', 'a', function(e) {
    e.preventDefault();
    alert("it is in here");
    var email_member = $('#extend_membership_email_value').val();
    alert(email_member);
});

asked 46 secs ago



jQuery .on is not recognizing new link elements in a warning callout

How to us math.max and math.min to omit high and low scores

Vote count: 0

In my method, I am calculating 7 scores given to me in a file. I have to set the a max and min, initialize them that is, where I'm having problems at. Also, i have to use math.max and math.min with my sum. If more of my program is needed please ask. public static double calculateDiveScore(String diveLine) { Scanner diveLineSc = new Scanner(diveLine);

int dive = diveLineSc.nextInt();
double difficulty = diveLineSc.nextDouble();
double sum = 0.0;
double max = ;
double min = ;


for( int i = 1; i < 7; i++){
    double score = diveLineSc.nextDouble();
    max = Math.max(max,score);
    min = Math.min(min,score);
    sum +=score;

}

double totalScore = (sum - max - min )* difficulty * 0.6;

return totalScore;

}

asked 42 secs ago



How to us math.max and math.min to omit high and low scores

Connection not working with localdb in visual studios

Vote count: 0

Sorry to be asking this I know there are many other questions and have tried to use the solutions provided but I just cannot get my code to work. Thanks for looking!

Connection String as shown in Properties: Data Source=(LocalDB)\v11.0;AttachDbFilename="C:\Users\Jacob\Documents\Visual Studio 2013\Projects\WindowsFormsApplication2\WindowsFormsApplication2\ChatDB.mdf";Integrated Security=True

Connection string in app.config: Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\ChatDB.mdf;Integrated Security=True

Error: An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll Additional information: Incorrect syntax near the keyword 'User'.

Code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
//NC-1 More namespaces.
using System.Data.SqlClient;
using System.Configuration;

namespace WindowsFormsApplication2
{
    public partial class SignUp : Form
    {



        string connstr = ConfigurationManager.ConnectionStrings["WindowsFormsApplication2.Properties.Settings.ChatDBConnectionString"].ToString();


        public SignUp()
        {
            InitializeComponent();
        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void SubmitBtn_Click(object sender, EventArgs e)
        {
            string Name = NameText.Text;
            string Pwd = PwdText.Text;
            //make sure they have entered text
            if (Name.Length > 0 && Pwd.Length > 0)
            {


               SqlConnection conn = new SqlConnection(connstr);



                //NC-10 try-catch-finally
                try
                {
                    //NC-11 Open the connection.
                    conn.Open();

                    SqlCommand insert = new SqlCommand();
                    insert.Connection = conn;
                    insert.CommandText = "INSERT INTO [User] (Name,Password) VALUES ('" + Name + "','" + Pwd + "')";

                    insert.ExecuteNonQuery();
                    MessageBox.Show("Congrats!!!");



                }
                catch
                {
                    //NC-14 A simple catch.

                    MessageBox.Show("User was not returned. Account could not be created.");
                }
                finally
                {
                    //NC-15 Close the connection.
                    conn.Close();
                }
            }
            //if no text make them enter
            else
            {
                MessageBox.Show("Please enter Text in both fields.");
            }
        }
    }
}

Again thank you for looking.

asked 23 secs ago
tnyN
25



Connection not working with localdb in visual studios

GCM PHP server more than 1000 users not working

Vote count: 0

I´m new with PHP and need some help. I had a GCM(Google Cloud Messaging) server but now there are more than 1000 users and no longer works the code I used is from this tutorial with some changes http://ift.tt/R4qKMa

Now this is where I think is wrong

<?php
 
class GCM {
 
    //put your code here
    // constructor
    function __construct() {
         
    }
 
    /**
     * Sending Push Notification
     */
    public function send_notification($registation_ids, $message) {
        // include config
        include_once './config.php';
 
        // Set POST variables
        $url = 'http://ift.tt/YbbTRA';

        // set group
        $groups = array_chunk($registation_ids, 1000);

        foreach($groups as $group) { 
        $fields = array(
            'registration_ids' => $group,
            'data' => array('contentTitle'=>'The Title','contentText'=>$message,'tickerText' => 'New Video!!!','type'=>'notification'),
        );
 
        $headers = array(
            'Authorization: key=' . GOOGLE_API_KEY,
            'Content-Type: application/json'
        );
        // Open connection
        $ch = curl_init();
 
        // Set the url, number of POST vars, POST data
        curl_setopt($ch, CURLOPT_URL, $url);
 
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 
        // Disabling SSL Certificate support temporarly
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
 
        curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
 
        // Execute post
        $result = curl_exec($ch);
        if ($result === FALSE) {
            die('Curl failed: ' . curl_error($ch));
        }
        
        }
        // Close connection
        curl_close($ch);
        echo $result;
        
    }
 
}
 
?>

But I get a 403(Forbidden) error on send_message.php which is:

<?php

if (isset($_POST["regId"]) && isset($_POST["message"])) {
    $regId = $_POST["regId"];
    $message = $_POST["message"];
    $strRegID = strval($regId);
     
    include_once './GCM.php';
    include_once './db_functions.php';
    $gcm = new GCM();
 
    $registation_ids = $regId;
    //$message = array("messageTyped" => $message);

    $result = $gcm->send_notification($registation_ids, $message);
    $db = new DB_Functions();

    if (strcasecmp ( strval($result) , 'NotRegistered' )) {
        //print "No Registrado";
                $db->deleteUser($regId);
    }
 
    echo $result;
}
?>

I´m really lost please any help is appreciated.

asked 27 secs ago



GCM PHP server more than 1000 users not working

function that will iterate bank deposits

Vote count: 0

Create a function, checkBalance, that will iterate through a list of bank deposits to add up the values and print out the account balance.

I've tried to come up with something, but everything that I try doesn't work.

asked 20 secs ago



function that will iterate bank deposits

Need one div's input value to switch from true to false onclick and then revert onclick of another div

Vote count: 0

I have these buttons...which use the jqery knobs by Anthony Terrien http://ift.tt/JfcxXL

these buttons have jquery functions which Ive added and are already working which toggle certain styles (display this box shadow /don't display it, etc.)

however I now need to hide/display a value of an input field

So it looks like this:

<div id="button"><input class="knob" value="80" data-displayInput="true"/></div>
<div id="button"><input class="knob" value="60" data-displayInput="true"/></div>
<div id="button"><input class="knob" value="40" data-displayInput="true"/></div>
<div id="button"><input class="knob" value="20" data-displayInput="true"/></div>

When one div is clicked the input val "data-displayInput" should be false, When a DIFFERENT one of these buttons is clicked (not the same one) it should return to true, and the next one should be false.

I tried the following:

$('#button').on('click', function() {
    var hiddenField = $('#data-displayInput'),
        val = hiddenField.val();

    hiddenField.val(val === "true" ? "false" : "true");
    console.log("new value: " + hiddenField.val());
});

Just not really sure what I'm missing. Note it has to be a click on the button and NOT on the Input itself.

asked 31 secs ago



Need one div's input value to switch from true to false onclick and then revert onclick of another div

Uniform field heights in jQery Mobile

Vote count: 0

Is there a way to make form fields the same height in jQM, without using a bunch of messy CSS hacks? When I place a text input field next to a select dropdown, the select field has a larger height.

I thought jQM was supposed to make it easy to create uniform/seamless mobile designs. If not, can you recommend a framework that does?

asked 57 secs ago



Uniform field heights in jQery Mobile

cassandra key cache hit rate differs between nodetool and opscenter

Vote count: 0

I checked my key cache hit rate via nodetool and opscenter, the first shows a hit rate of 0.907 percent.

Key Cache : entries 1152104, size 96.73 MB, capacity 100 MB, 52543777 hits, 57954469 requests, 0.907 recent hit rate, 14400 save period in seconds

but in opscenter the graph shows 100%. enter image description here

any one understands why the difference?

asked 1 min ago



cassandra key cache hit rate differs between nodetool and opscenter

Round-robin table using only basic data structures

Vote count: 0

I have a list of elements (database tables) that may have relations with each other, including themselves.

Let's assume I have table1, table2, table3 and table4. What I would like to create and use in a loop would be structure like this:

      |table1|table2|table3|table4||
table1| 1:1  |      |      |      ||
table2|      |  1:1 |      |      ||
table3|      |      | 1:1  |      ||
table4|      |      |      |  1:1 ||

Note that while it is not necessary to have 1:1 relations pre-filled, it is important for me to be able easily address any of these cells in a loop.

There will be while(True) loop that will iterate over and over again until the iteration without change occurs.

What I am currently struggling with is to find an efficient and pythonic way of doing this with basic python structures, while keeping decent performance and easy addressing.

Example of what I tried

tableNames = d.items(); # returns me this format ([(tableName, ['column1', 'column2']), ... ])
for tName in tableNames:
  # some sort of comparism and conditions resulting in whatever decision
  # for example, that I need to insert information about 
  # relation on [actualtable][table2]

  fancyStructure[actualtable][table2] = "1:N";

Is it a good idea to use dictionary? Respectively dictionary of dictionaries? What is the best way?

And is it okay to pre-initialize that dictionary to the values that I will change in time? Note that this script will work with millions or even billions of records.

asked 1 min ago



Round-robin table using only basic data structures

Can I have Visual Studio 2013 run a Powershell command on File Save?

Vote count: 0

I have a powershell window constantly open, so that when I'm making edits to files that don't require recompile (like angular pages, Views, configs, images, etc), I can just run a command (I call it 'Sync'), and it will copy over the files I changed to my build directory, without having to do a Build.

Is it possible to have Visual Studio run that command when I do a Ctrl+S, or Ctrl+Shift+S? The amount of time to Alt+Tab to the new window, run the command, then tab to the browser, seems inconsequential, but I do it dozens, if not hundreds, of times a day, and I know it would save time.

asked 50 secs ago
PKD
99



Can I have Visual Studio 2013 run a Powershell command on File Save?